Ok I'm trying to set up a night light in my office.
Predicates are:
After Sunset
None of the 3 lights in the room are on (Main Light, Fan light, and LED Strip)
Desired Action Step 1:
When Motion sensor switches to active: Turn on LED Strip to Red, at 50% brightness.
No problem there. But I'm trying to deal with how to shut it off, and it's driving me crazy that I cannot get it right. I want this criteria:
Turn it off 1 minute after inactivity on motion sensor
Reset the 1 minute timer if it goes from inactive and back to active
Cancel the rule completely if I set the LED strip to some other color/brightness..or turn on any of the other lights in the room (meaning, I've entered the room and plan to stay here)
Hereās one way to do this. After Step 1:
Wait for Expression: Motion Sensor inactive, select the āDurationā toggle and set it to 1 minute
If LED strip = red @ 50% and other light in the room = off
Turn off LED Strip
End If
The wait expression will automatically cancel on motion, so this covers your condition 2ā¦. But you will need to change your predicate condition to not include the LED Strip if it is red @ 50% for this to work.
It just means the 1- minute timer will be reset to zero each time motion is detected. When the sensor reads inactive for at least one whole minute, the rule will proceed to check the color and brightness of the lights strip and turn it off if they haven't changed from the "night light" setting.
Also, @Sebastien is probably right, but it seems to me you could leave the predicates as-is. Testing both cases will tell for sure.
Here's how I do something similar in my master bathroom (though instead of a door opening, you'll trigger on the LED changing/other lights being turned on).
Yea I like this. I was just about to break down and make 2 rules ...one for Active and one for InActive. But this makes it eaiser to keep it in one rule. Its actuallly very similar to the way I did this type of rule a couple years back.
So I still have one problem. If the motion goes inactive....it starts the timer delay. If i turn on Office_LEDZen31 while that is ticking down...it still turns it back off.
I think you need a 2nd trigger and IF statement to handle the other lights being turned on. That 2nd IF needs to cancel the delayed action. Same as my bathroom door being closed in my code.
Youāll also have to then update the predicate so the rule will still fire when those lights are on.
Ok NOW i think i really have it. It was even more simple when I really thought i through. What sucks is that the only reason I cannot do this with "Motion Lighting" is because it cant do anything with color properly.
That looks clean. It does require motion to trigger though, e.g., if you turn on office_light from your phone (or Alexa) it wonāt trigger and the timer will still expire.
Minor thing, but you can use a single IF-THEN statement instead of two separate ones (itās in the drop down instead of a button).