I have been unsuccessful in creating a simple occupancy rule in RM 5.1 to turn off lights after a set period of time once motion stops. The issue is that it works for a short while, but soon, it'll turn off the lights almost immediately after I turn the light on. The rule stops following the delay rule.
The rule is just:
Predicate - Light Switch is on
Trigger - Motion sensor is inactive
Action - Turn off light switch after 20 minute delay and it is cancellable.
If this is incorrect, or there is a better way, I would appreciate suggestions.
Also, can I use the Motion app to define this rule? It seems like the Motion App requires a Light On action for Motion Active. I only want to define a rule to turn off a light that's been manually turned on after no activity in the room.
What does the log show is happening? Do you have a cancel delayed actions in your rule? As mentioned a cancellable delay is only canceled if you have a Cancel delayed actions in your rule. The wait mentioned above will cancel anytime the rule triggers.
Also keep in mind that once your predicate goes true the rule will not trigger again, but if it is already running the rule the predicate won't stop it. It just won't trigger again.
The behavior in the log shows that the delay ended and the light is turned off. If I turn on the light again, it immediately says delay over and turns off the light again. So this tells me that after the action is completed, if I turn on the light again, the delay timer is not reset and instead the state remains as if the action should run. This clears if I go into the rule and re-save the rule.
Wait for event has a similar behavior. After the first trigger of the wait, it no longer waits, so the light stays on.
I'm thinking there's a bug in RM where the delay/wait actions do not reset on trigger.