[OBSOLETE] [BETA MILESTONE 1] CoRE (Community's own Rules Engine)

Probably…but I’ve had a light and fan shut off per an Else statement when only ONE of them had the cancel option enabled. So, think about EVERY time the rule will reevaluate, if even once after the cancel command runs (motion inactive for example) it should reset and start the else countdown again.

1 Like

In rule machine I could trigger lights on when motion starts and then turn them off after x minutes but only if motion isn’t detected with that x minutes. If motion was detected repeat the above process until lights turn off due to no motion after x minutes.

How do I do this in Core?

Simple Rule
IF
Motion Sensor is active

THEN
turn on

ELSE
wait 5 minutes(your own value)
turn off

If motion is detected in the 5 min period before lights turn off, timer is reset.
Works OK for me.

I have missed quite a bit out here where you select the devices etc.

That’s what I thought would work. I haven’t tried it yet. Right now I am using Rule Machine and wanted to convert over to this. I didn’t want to rip out all of my current rules until I understood how to use this tool.

The easy way: enable cancel on piston state change for the turn off action.

The more flexible way: Any action will (by default) override its own future scheduled tasks. What you want will happen automatically. Behavior is defined in the Task Override Scope for the action. If you use the scope Local, when motion is detected, the action that normally turns the light on will remove all turn off scheduled tasks forvthe specified devices, so you’ll get exactly what you want.

scope Local? Not sure what you mean by this.

Each action has advanced options. There are two actually:

Task Override Scope (None, Action, Local, or Global)

Task Cancellation Policy (None, Cancel on piston state change)

There is a short explanation on the override scope there… It prevents different actions fighting over the same device. Action means that when an action is executed, anything pending that has been previously scheduled by the SAME action is cancelled. Local refers to any action within the same piston. If action #1 schedules front light off in 5 minutes and action #2 turns it off now and has the local scope, action #1 is then cancelled…

Ok, I figured out my own question:

Using a latching piston did the trick.

My use case: with motion sensors at the bottom and top of my stairs, when I go up the stairs, turn on the stairway and upstairs lights. When I come down the stairs (and reach the bottom) turn off the upstairs and stairway lights.

IF
Bottom Motion becomes active (trigger)
and
Top Motion is INACTIVE (cond)
and
(Time is between x and y, and mode is Home, and bedside light is off) (cond)

THEN
Set dimmers and turn on lights

BUT IF
Bottom Motion becomes active (trigger)
and
Top Motion is ACTIVE (cond)
and
(Time is between x and y, and mode is Home, and bedside light is off) (cond)

THEN
Turn off lights

1 Like

Can someone help me understand something, please? First, what is ‘Save State’? Secondly, can anyone give me some examples on how one might use variables? I understand what they are, just not sure how you would use them in the context of the app. I realize they will store values though.

I love, love CoRE so far, it has an almost Android Tasker feel to it so in that respect it is familiar, but different too, so I have some things to get used to.

Thanks for all the hard work that is going into this.

Speaking of door locks, is there any way to capture whose code was entered? This is what prompted the variable question actually. I’d like, if possible, to capture whose code was used so that the SMS message could be customized with that name.

What happens if someone else comes up the stairs soon after first person, the lights will switch off?

I’m assuming that there is no answer to this by the lack of answers. Looks like I will continue with Smart Lighting and use 3 rules to do the job.

Sorry Bob, have been travelling and not able to do much thinking (lol). Currently a sleepy head in an airport ;))

@bobbles Assuming you figure out the lux problem, by replacing it with (lux < 11 OR light is on), how do you plan on turning off the light, once it’s been turned on? You would be feeding light into your illuminance sensor which means you won’t know when the external light without your own feed goes over 11 lux?

The light turns off using the else command as the rule becomes false when outside the time window.

And there’s my problem. :worried:

Yeah, but you can fix the lights turning off. But then, when do you turn them off, once turned on?!

Post 18 shows my setup and it does work OK apart from the lux issue. I have tested it using a higher Lux value. Works brilliantly.
I am getting another Lux Sensor for another room. I may try to utilise it in the rule to make it work.

As an aside is it possible to do an
IF
OR IF
OR IF
I’ve had a look but cannot seem to do it.

… A touch of subject hurt what lux sensor would you recommend?

© 2019 SmartThings, Inc. All Rights Reserved. Terms of Use | Privacy Policy

SmartThings; SmartApps®; Physical Graph; Hello, Home; and Hello, Smart Home are all trademarks of the SmartThings, Inc.