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

You could nest the garage door and arrival sensors

Simple if (the rather than Or If)

If
(anyone is present OR garage door opens)
and
Time is between 5am and 1130pm
then
execute home mode

Or if you don’t care about the time if the garage opens then,

If
(anyone is present and time between 5 and 11:30)
Or
Garage door opens
then
execute home mode

1 Like

If
Door state changes
And
Motion sensor is active

Then
Turn on light

That will turn on the light when the door is opened if there was motion Also in your hallway.

As far as turning off lights, well you won’t want this when it closes, as it would turn off when you were in there…

Personally why don’t you use a motion sensor in the bathroom, and if motion is active in the bathroom, (If the door opened it would be registered by the motion detector) then have a simple rule to turn on th light, and after it doesn’t sense motion for a few min it’ll turn off, we have same setup at home and a second “and” for time of day. I’m considering using a lux sensor for amount of light too so it turns on if the day is dark and not just in the evening

while i think about it … having multiple sensors setup just for the bathroom might get complicated - for example, if you decide once the door closes to reset the above rule, so when you open it again it will turn it off, then you could run into the situation of if someone forgets to close the door after they finish… then someone else goes in… there is no “close” event that happened until they are inside and close the door (so the light turns off when they are in there) or the rule simply will not run correctly until its closed then opened again… One bit of advice i would give anyone with Motion Sensors and Home Automation is keep it as simple as you can. the more steps the more that could go wrong.
Also apart from main entrance doors (or security rooms/rooms you want to keep track of specifically) door sensors are a little bit pointless. a motion sensor in the room instead “normally” gives you more options and also allows simpler rules (like suggested above).

Hope this helps shout back if you have any more questions :slight_smile:

Hello all,

Is there any way to make a rule check its conditions every 15 mins between times in my example. I see the only execute on this minute of the hour. But I see the next scheduled event to be 10:30pm which is the end of my between condition.

I know Smartthings is supposed to be event based but my location mode seems to be out of control and I’d like to poke it with a stick every 15 minutes which doesn’t seem unreasonable, especially with all of ST’s supposed improvements as of late.

You need to use a time trigger for that. Trigger happens every 15 minutes…

i do something similar with my downstairs lights,

If
No Motion detected (a few sensors downstairs)
And
Time between 11pm - sunrise

Then
Turn off all downstairs lights
Set mode to Niight

Else
Wait 10min

Obviously you’d have to change for your specifics, dunno if that would or could work for you…

Just double checked what I had was working and the “wait” function doesn’t work as expected.

Did you ever figure out how to use the dashboard? I can’t seem to get to it.

Joe, you need to go to the IDE and enable OAuth for CoRE. Then try the dashboard…

could someone explain if I’m missing something in my logic?

If
Motion detector is active
And
Variable = 0

Then
Variable = 1
Wait 2min
Variable = 0

So the above should change the variable to 1 and wait 2 min before changing back to 0 if motion is detected.

Currently it doesn’t change the variable to 1 for 2 min. I noticed the task override and cancellation policies? Would these be having an affect, does the wait command still require the initial if to be true to complete?

Edit: apologies - just read through the post a few above about TOS policies
So my understanding would be it will be scheduled. And cancelled depending on TOS settings.

If
Motion detector is active
And
Variable = 0

Then
Variable = 1 (TOS = active)
Wait 2min (TOS = active)
Variable = 0 (TOS = active)

This would essentially schedule the above and reset them if state changes.?
I never seem to get the initial variable change to 1, so when using the dashboard never seems to show the variable = 0 bit of the if statement showing red (false)

You need to initializa the variable to zero once. I am going to add a way in the UI to alter/add variables. Remove the “and variable = 0”, run it once, then add the condition back. Sorry for that

If you enable cancel on piston state change, the variable would remain set to 1 indefinitely if the motion sensor state changes to anything while variable is 1. If you do not enable cancel, then if the motion becomes inactive and active again during the 2 minutes, it would reset the 2 minute wait.

What are you trying to achieve?

I get you, thanks, I get variable = null rather than 0, when I look inside it says 0 but in the main piston page its null. Is this a gui issue or is the variable actually
Not being set to 0?
I’m not using cancel on piston change so no worries there,
I’m only testing this, as I had a piston which should have waited 10min before turning off a light, and would always do it instantly after motion stopped. So thought I would make a simple piston to test the wait function out.

Show me the nonworking piston please. The variable is never set to 0 because it does not exist. Maybe you should try Variable is not equal to 1 - that would self-initialize the variable, because it will match even if the variable doesn’t exist (which assumes value null).

Will try the not equal to 1, quickly and if that fails I’ll post the piston.

Appreciate the help.

I noticed your using a group for the then? And you seem to have a timer counter next to the wait?

My mistake, I’ve now merged all tasks and have a counter working and things responding as expected - my fault

Thanks for the help.

Glad you figured it out :slight_smile: You can have multiple actions, and each action can have multiple tasks. Waits work within the same action and affect the following tasks. You will see a timer next to anything (condition or task) that is “pending”, or in other words, scheduled for reevaluation (in case of conditions) or execution (in case of tasks). That’s a great way to see what’s coming and know ahead if it will work.

1 Like

I’ve also added a way to initialize variables in v0.0.088.20160612 - Alpha test version - Added the ability to initialize/change variables from within the UI

Awesome will update and give it a bash :slight_smile: cheers

1 Like

Hello all again,

Sorry if anyone has asked for this or if this already exists or is way too hard to implement.

It would be nice to import rules enabling us to share rules. Maybe an XML file hosted by URL or something. I know placeholder devices would have to be created but could be swapped out by the end user or deleted.

Thanks!

2 Likes

Im trying to wrap my head around this.
I want to go into my bedroom anytime after 10pm and have motion turn on the bed light at 40%. But, after I use Alexa to turn off the light from my bed, I don’t want motion to turn it back on again. Is this possible with what your talking about above? Somehow using TOS?

Another question, what’s the difference in action restrictions and piston restrictions?
I guess what I’m looking for is a use case?
Thank you for all your hard work on this?

This is something that I’ll look into in the near future. Not there yet.

2 Likes