the delay will always be 10 minutes, so set that.
the timer should start after the motion becomes inactive, once it flips to active it should reset the timer no ?
Yes and works pretty good. The one thing I didn't mention was I also want lights on from Sunrise to 9am. I guess I would have to make 2 motion lighting?
If you want to do it with RM4, here's an example that runs my bedroom lights. It turns on different lights based on mode. You could change it to use a time span.
Here is my living room lights. I have it so that if I'm watching tv, the lights also turn off. Otherwise the rule is based on motion and illuminance. Just thought I'd share. There are lots of possibilities. Start small and build on it.
There are many ways to achieve what you want. Here's an RM4 version that I'd recommend. It'll check for active motion at sunset and, if the motion sensor is active at 11:00, keep the lights on until inactive after 11:00.
Triggers:
Motion Sensor *changed*
Time = Sunset
Time = 11:00 PM
Actions:
IF (NOT Time between Sunset and 11:01 PM EDT) Exit Rule
IF (Time between Sunset and 11:00 PM) THEN
IF (Motion active) THEN
Cancel Delayed Actions
On: Lamp 1, Lamp 2
ELSE
Off: Lamp 1, Lamp 2 --> delayed: 0:10:00 (cancel)
END-IF
ELSE-IF (Time is 11:00) THEN
Cancel Delayed Actions
Wait for condition: Motion inactive
Off: Lamp 1, Lamp 2
END-IF
Why are you triggering at Sunset and 11pm. He said he wants the lights on from Sunrise to 9am. But that is still only by motion. There is no need to trigger the rule based on the time of day unless he wants the lights to turn off at night even if there is motion.
@basic261, I would recommend only putting a condition of time on the lights turning on, not on turning off. That way, if the motion begins at say 8:55, they still turn off at 9:05. If you have the time be a condition of turning on AND off, they would not turn off. This is what I would recommend.
Triggers: Motion Changing
Action:
If Motion is Active
cancel delayed actions
If ( time is between sunset and 11pm OR the time is between surise and 9AM ) AND
lights are off
Turn Lights On
End-If
Else If Motion is Inactive
Delay actions for 10 minutes subject to cancel
Turn the lights off.
End-If
Action
IF (Mode in Evening, Morning(F) [FALSE]) THEN
IF (Kitchen Motion active(F) [FALSE]) THEN
Cancel Delayed Actions
On: Kitchen Light, Kitchen Bar
ELSE
Off: Kitchen Light, Kitchen Bar --> delayed: 0:01:00 (cancel)
END-IF
ELSE-IF (Mode in Away, Day, Night(T) [TRUE]) THEN
Cancel Delayed Actions
Wait for condition: Kitchen Motion inactive TRUE
Off: Kitchen Light, Kitchen Bar
END-IF
No, that isn't going to give you the results you want. Why did you break it up into two IF statements? And you are triggering off the motion changing so there is no need for a wait action at all. If you're doing the time of day by modes, you can modify my previous example like this:
Triggers: Motion Changing
Action:
If Motion is Active
cancel delayed actions
If Mode if Morning or Evening AND
lights are off
Turn Lights On
End-If
Else If Motion is Inactive
Delay actions for 10 minutes subject to cancel
Turn the lights off.
End-If
IF (Kitchen Motion active(F) [FALSE]) THEN
Cancel Delayed Actions
IF (Mode in Evening, Morning(F) AND
Kitchen Light, Kitchen Bar(off, off) any is off(T) [FALSE]) THEN
On: Living Lamp 2, Living Lamp 1
END-IF
ELSE-IF (Kitchen Motion inactive(T) [TRUE]) THEN
Delay 0:01:00 (cancel)
Off: Living Lamp 2, Living Lamp 1
END-IF
If motion is active before sunset and remains active past sunset the light won't go on until motion goes inactive then active again. To make sure the rule executes for this condition the motion sensor changed isn't sufficient and you need the sunset trigger. I checked one of my motion sensors and quickly found a case where it was active for 41 minutes. If you don't have a sunset trigger this case would result in the light coming on at sunset + 40 minutes.
The rule has a restriction that causes it to exit. If motion is active before 11:00 and continues to be active after 11:01, the rule will exit before the off action is sent. The 11:00 trigger ensure the off command will be sent.
The OP stated, "If motion is active, and time is Sunset to 11:00pm ..." If someone chooses use this rule surely they could make a second rule and change sunset to sunrise and 11:00 PM to 9:00 AM.
Why are you allowing inactive motion to turn off the lights at any time? If the lights are turned on outside the time windows of interest, your rule will turn them off (after the 10 minute delay) with motion going inactive.
The rule won't do that. The 11:00 trigger sets - Wait for condition: Motion inactive. The light will only go off at 11:00 if there isn't active motion. If motion is active then the lights stay on until motion is inactive.