How to replicate this motion lighting feature in RM?

As an alternative to the above (which is a very common way of doing this and found early on in the docs, which I'd recommend reading before you dive into Rule Machine), there is a "new" paradigm staff have been suggesting for this recently. It looks like this:

Trigger: Motion active

Actions:

Turn on light
Wait for event: motion inactive
Wait for event: elapsed time --> 0:05:00
Turn off light

The outcome here would be the same as above (aside from a few extra things that rule does that this one doesn't, like possibly exiting based on a virtual switch state), but the structural difference is that you only need to trigger on "active" since your in-rule "Wait" handles the "inactive" event, and you don't need to cancel delays or mark them as such because you're using a "Wait" for time instead. All waits (not delays) are automatically cancelled any time a rule re-triggers.

5 Likes