Light Control - Motion and Manual Turn Off


#1

This may be covered elsewhere - but I've not been able to locate it...

I'm looking to control lights on my patio as follows:

If it's after sunset / before sunrise and motion is detected, turn light on. Turn off after 10 minutes of the motion detector being inactive. If motion is sensed, reset 10 min timer. (This part I think I've got...) Would like the timers to vary based on mode.

Also, if I manually switch on, however, I'd like the same thing. Switch off after a certain amount of time. However, if motion is sensed after I turn it on manually at the switch, the timer is reset and starts counting down for the amount of time according to mode.

I've looked at Motion Lighting and RM posts, and am not seeing this. Thanks for your help!


#2

Welcome to Hubitat!

I'm a little confused by the second part, so let's handle that separately. Because I'm not quite sure you actually need it.

For motion, your rule is simple.
Condition/Rule: Motion Active
Action for True: Lights on
Action False:
Delay by mode: Your delay for each mode with cancel on Truth change
Lights off

Now, you also want to delay turning the lights off when they are turned on manually. So, that would be a trigger....but I am curious as to why you think you need to trigger off the manual activation. Won't the motion sensor eventually go active even if you turn them on manually? Do you really need to have that part? If so, then it would be a simple trigger of
Trigger: Lights on
Action: Delay 5 mins, cancel on Truth change

But then, to keep that from turning the lights off once motion is detected, you would add to the actions if true for the first rule of "Stop actions for" the trigger you just created.


#3

Thanks Ryan! This was very helpful. I'm migrating over from SmartThings and WebCore. Rule Machine approach is a different logic that I think I'm starting to 'get'. I wanted the 2nd part because I don't always go outside when I turn the light on - so the motion sensor wouldn't trip.

I did create a trigger that pops a virtual switch on. And, then the attached rule. Seems to be working just as I wanted. Thanks again.