RM "Restrictions" best practices

I have several RM rules that are based on different modes. I have set it up to use restrictions so that the rule only runs based on current mode, but have discovered a flaw in my logic.

Example:

Lights set level of 10% if motion sensor active
Lights set level of 0% if no motion sensor active with 30 second delay.
Restricted to sleep mode

What I'm finding is that if the mode changes before the time-out occurs then the light stays on due to the rule being disabled by the restriction.

This doesn't occur very often, but it's annoying when it does.

Would I be better off using the "mode" as part of the conditions as opposed to a restriction so that the rule becomes false and turns the light off after the time-out regardless of the mode change?

I hope I explained correctly

1 Like

This “logic flaw” occurs elsewhere too. If “Sunrise/Sunset” occurs in the middle, etc. “if 10pm…” occurs in the middle. Anywhere there’s a lengthy event and the conditions of the event change before the end.

example: “turn on light by motion between sunset and sunrise - turn off 15 mins after motion stops [cancel]” <-- walk into the room 8 mins before sunrise and the light will never turn off.

Perhaps, the solution would be:

Rule 1:

If motion is active and mode is sleep then dim light to 10%

Rule 2:

If motion is inactive dim light to 0% after 30 sec time-out

That way the light turns off after time-out regardless of mode change?

Rather than a lights off based on the rule becoming false?

Here's what I have been using for my hallway motion sensor and light that I prefer to be active 30 min before sunset, and to stop reacting af 1 am. I used to do this with ST and Stringify. Most of the time it worked, but it was sometimes a bit slow to react, if and when everything cloud and internet was working.

This turns on my hall light 30 min before sunset for 4 min if motion does not continue. It also turns off the light after 10 min if it is manually activated by the nearby Lutron Connected Bulb remote. This was a compromise I made, since Hubitat cannot know the state of the button, only the state of the bulb. So this limits the annoyance of the light turning off in
4 min when someone has intentionally turned it on via the switch, but is not in range of the motion sensor or they have not moved for longer than 4 min.

Might be some unnecessary settings in this Rule, as I'm still learning the ropes, but it's working exactly as expected and reaction time is finally instant on a consistent basis!

1 Like

Yes, splitting into many Rules help. In my example case, I want the light on at “night” so that should be it. No OFF in that Rule, have another Rule that watches for no motion and turns the light off.

updated example: Rule1 “turn on light by motion between sunset and sunrise" Rule2 "turn off 15 mins after motion stops [cancel]”

This is the way around the restriction problem. There really is no way for restrictions on mode to mix nice with things that turn off after some amount of time. By definition, the restriction applies to the actions of the rule, and you wouldn’t want it any other way.

If you look at Motion Lighting as an example, it separates the options about when to turn something on from the options of when to turn something off. Ultimately, this is the way you have to think about this type of lighting automation --> and was one of the reasons Motion Lighting came into existence.

Thanks for your input, that’s exactly what I was thinking. Should be an easy fix for my rules.

Adding a separate “off” rule to my RM automations has solved my issue with restrictions causing lights to stay on when I didn’t want them to. Thanks again.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.