I have a motion sensor that, when turning to active, turns my tablet display on.
A second rule turns my tablet display off after a 10 seconds delay when motion sensor turns to inactive.
Now here is my question: if within those 10 seconds my motion sensor should turn to active again I dont want that second rule (display off) to be executed. So it should be stopped from being executed.
Trigger event: motion sensor *changed*
Actions:
IF (motion sensor active) THEN
On: tablet display
Cancel delay
ELSE
Off: tablet display delayed by 00:00:10 cancel
END-IF
If turning on the tablet display when it is already on, for the case where motion happens again, is a problem for some reason, you could do this instead of the simple On: tablet display above:
You can see, you have to switch delay to on, enter the time in seconds and then also enable the cancel. That will allow this delay to be canceled by other part of the rule.
The other option would be to put in a delayed action. This delays all subsequent actions after the delay. This is useful if you have multiple actions that you want to be delayed and not just one.
Ok thanks alot. I think I got it! Just one more general question: I selected "cancel delayed actions" as an action (if motion sensor active then: display on, cancel delayed actions).
Does this cancel all delayed actions I have in rule machine or just the one in the same rule ( that is the "display off" action)?
Personal note: I do find some of the wording in the rule engine not verbose enough ..
I would have the "cancel" toggle renamed "cancellable"
and I'd have made the Cancel delay say "cancel delayed action in this rule".
basically obeying the "dont make me think" principle
I understand the need to group like actions to make the list shorter and actions easier to find.
The one I don't understand is why "Exit Rule" is under "Delay or Repeat Actions, Wait" and not under "Set Private Boolean, Run/Cancel/Pause Rules". I can never find it.
Actually, I don't understand why "Set Private Boolean" isn't under "Set Mode or Variables, Run Custom Action".
I guess I look at it this way, it's not going to change, so I can either fight it or just learn where things are and I can stop complaining about it. I chose to stop complaining. YMMV.