Rule Machine Logic question - cancel action if I return within x minutes?

Hi there @bravenel, quick question about setting up rules to turn on and off lights based on presence. I want to turn off lights but only if I’ve been gone for >5 minutes. If I come back within 5 minutes, I want the off sequence to cancel. I thought the “Update Rule” action might do this.

Can you take a look and see how to accomplish this?

https://dl.dropbox.com/u/853747/Jing/2016-02-09_1200.png

Thanks for Rule Machine, btw. ST folks need to hire you and bake this in!

You need a Rule:

Conditions: presence present
Rule: presence present
Actions for true:
Actions for false: Turn off after delay, cancellable 5 minutes

That’s it. When you leave, the rule become false and that starts the timer. If you return before 5 minutes, it becomes true, and that cancels the timer.

1 Like

So just 1 rule to do all that, or 1 rule in addition to the 2 I already have? I don’t need a trigger?

Yes, to do the action you described of turning off the light 5 minutes after you leave, but not if you come back within 5.

Ahh, wonderful thank you. So I added one rule to turn lights on when I arrive and added this one to turn them off. I was thinking I could put the “turn lights on” in the actions for “True”, but that didn’t work for me. Anyways, thanks for the assistance!

Does the pending off action always need to be in the false action? The way I built my rule (dependent on the state of another rule) I need to put the pending off in the true action, and have the timer reset when the rule is false.

I could rebuild my rules, of course… But I’m curious…

I should say… I was having problems with the timer not resetting when I was testing this last night. But that could have been ST instability, of course.

It can be in either, just depends on your logic.

Great. Thanks. I’ll do more testing after dark tonight.