Door Contact Sensor Lights ON w/ Timed Off + Reset

Hey Community,

I have a simple RM rule setup that turns on the lights in my garage when I open the door. Then when the door closes the lights turn off after 5 minutes. This is great unless I'm going in and out of the garage a lot. Looking to make my rule pause/stop the 5 minute off timer whenever the contact sensor (door) opens back up, then start 5 minute delay over when sensor (door) is closed. Thanks in advanced!

1 Like

Just add cancel delayed actions to the first part of the rule in actions. Then if the door opens within that 5 minutes it will reset and not be persistent.


Well that just seems too easy lol... Haven't used a "cancel" before. Thank you!

1 Like

will you post a shot of your rule just so that I can make sure you've set it up as intended? Just really need to add it as an action in the first part of the rule to make it work.

Like this:

1 Like

confirm with a test.

To use the NEW method go with

Trigger: Door Open

Cancel delayed actions
Lights on
Wait for condition door close
Turn off lights - delay 5 min - cancelable

Thanks for that input. I don't use rule machine much any more, so I often forget that there is a new protocol recommended. Both will work. @Hasty1 's way is the recommended way to do it.

I still like the "old" method better for a lot of things myself, but thinking about things in the "new" way definitely makes some automations simpler to set up (it's still not clear to me if staff meant "simple" for us or "simple" for the hub when they began suggesting this). :slight_smile:

If you do keep the first method--the one that follows the common paradigm: "changed" trigger and an IF THEN/ELSE in the body--make sure you select "cancel?" (or "cancelable") on that delay, otherwise the "Cancel Delayed Actions" won't do anything--same as the second rule. It appears to be missing in the first.

Good luck!

1 Like

OH yes .. good call there @bertabcd1234,

Yah I'm an old dog too. So new tricks are hard to lean. Just depends on how the logic works in your head really.

Just to clarify, I was not suggesting one way was more correct or better than the other. I started the old way and switched to the new way halfway through!

I think I read wait for event is more efficient then wait for condition, wait for event door close
Mabey add a time out of 5 hours just to make sure it completes,