Can't Get RM 4.0 to Turn off Light After Motion Inactivity

I'm unable to get this rule working in Rule Machine 4.0. It worked fine in 2.0.

Basically I want a light to turn on when motion is detected and then turn off after 1 minute of motion inactivity.

I tried copying the example from the RM 4.0 documentation and even that does not work.

Here is a example.

Thanks for the example. I'm trying to get it to cancel the delay off if the motion sensor becomes active again. I've been at this for a while and just came up with this. It isn't pretty, but I think it works.

1 Like

With all due respect to the poster who helped, that really isn't the best rule to use--as the OP says, that will not get "reset" if motion becomes active again. It will schedule the next action, the "off," every time the motion sensor becomes inactive. The revised "not pretty" rule above actually would work, though it's a bit of an unusual way to write it.

There is a basic motion lighting example in the Rule 4.0 docs that is exactly what you want. I would read those before you get too deep into RM--it would have saved you this trouble already. :slight_smile: Second, if that's all you're doing in the rule, I wouldn't use RM at all. The built-in Motion Lighting app is a lot easier to set up and can handle both this situation and more complex ones with ease.

1 Like

You could do this in simple lighting. I have my laundry room on it and it seems to manage to stay on when we're in there without a lot of complication. But, here's a rule like the one you're looking for. It has a few more restrictions, but pay attention to the cancel rule. You need to place that before your turn off section.
[EDIT]
You don't HAVE to split this into two rule sets. You can use an else if where the end-if is located and I think it'll still work. Just keep in mind though that KISS is the best method. (Keep It Simple Stupid). Rules are easier to figure out when you edit them.

All of my light controlling rules are built around this logic. One rule with no if-then conditions. This rule is only called on motion being active so it will run half as often as a rule where the motion is changed.

It still wakes back up when the "inactive" condition is met :wink: (and then for the delay). Most examples from staff use IF THEN, not Wait, so I've always suggested that paradigm to others. If correctly written, either would work.