Ok I'm trying to set up a night light in my office.
- 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
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.
So if it cancels the wait expression....wouldnt that mean that after 1 minute...the rule is canceled, and the light will never turn off?
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.
Cool. Almost all my lighting rules are done this way too — I like keeping things consolidated in one app to keep related logic all in one place.
ok i think i have it now!
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.
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).