Help with RM motion trigger rule not working

Been a while since I've set up a new system and used Rule Machine. Trying to set up a pretty simple automation but can't figure out why it's not working in the new RM 5.1.

Basically trying to have lights turn on dimly at night when motion is detected and then turn off automatically within 1 min. Pretty simple. I'm trying to get the automation to run ONLY if both of the following conditions are met:

  1. The light switch (a Caseta dimmer) is NOT already On
  2. The time of day is between sunset and sunrise (basically night time only)

Attaching a photo of the rule and the logs when triggered. Not sure why the conditions are not being used.


This one comes up a lot. You've created conditions but haven't referenced them in the rule. IE you need to add them to a conditional - IF this switch is off AND time of day between....do this (your actions)

It'll possibly be easier to use the "required expression" at the top and reference the conditions there.

Edit: Another thing to add is that this rule is going to trigger again every time motion is active. The issue there is the delayed off's are scheduled so you'll find an 'off' command will be sent 1 minute after every motion active event - not good.

Room Lighting rather than Rule Machine will handle it better. An example here shown using my Landing Lights:

3 Likes

To add on to @johnwill1's response, do you always want the light turn off after one minute or do you want to wait until the motion is inactive for one minute? For something like this, I tend to write my rules as:

Required Expression
Time between Sunset and Sunrise
Light switch is off

Trigger
Motion is active

Action
Dim light to 10 -> fade 3
Wait for Event: Motion inactive and stays for 1 minute
Turn off light

2 Likes

Firstly, thank you @johnwill1 for the example. as well as the clarification about referencing the condition in the Rule. That makes sense and I'm now remembering doing something similar in the old RM. As you mentioned, I think your Room Lighting idea is a more elegant solution. Will give that a shot.

@JB10 It's a good call-out because I think your example actually makes more practical sense. No sense in turning off the lights while there's still activity in the room. I figured that continual motion activations would solve that organically but, as @johnwill1 pointed out, i'll just be firing Off commands in between those on events anyway, which isn't cool.

Thank you both! Solution goes to @johnwill1 tho, since technically he was first. :wink:

1 Like

Another pointer is the difference between a wait and a delay. A wait gets restarted each time the rule triggers, whereas the delay is scheduled. Using wait for elapsed time rather than delay x minutes would prevent the constant off commands.

2 Likes

That makes sense. Thank you!