2 rule machine rules vs 1 room lighting rule?


I have been fiddling with room lighting for a while. It’s good, but it’s missing some features I’d consider nice to haves. Is there any noticeable impact (both in performance and system resources) in doing 2 rule machine rules vs 1 room lighting rule? (I rule machine rule for on, the other for off)

Thanks for your help.

I guess I should mention, if anyone can help me condense it into one room lighting rule I am all ears.

The reason I think I need 2 rules is because 1) I want room lighting NOT to adjust the brightness if the lights are already on, even if room lighting thinks it should be different. As far as I can tell, this is possible by limiting and/or disabling room lighting from triggering if the lights are already on. However, limiting and/or disabling room lighting from triggering ALSO prevents them from turning off when motion is no longer detected, which I want to stay on.

My theorized solution is one that turns the light on (and only runs if the light is off before hand) and then one that turns the lights off after no motion for x minutes.

Help condensing it into one Room Lighting automation would be appreciated, and then obviously if that's not possible, how much of a hit having 2 rule machine rules will have over 1 room lighting rule


It sounds like Room Lighting should already do this if you don't have the "Activate even if already partially Activated" option turned on. I believe it is off by default. It is available under Means to Activate Lights > Activate Lights Options > Additional Options. If you have it checked/enabled, that would explain your behavior (well, that or maybe your lights don't report their states back to the hub, which is a different problem but would probably be a problem no matter how you set up this automation if their state matters).

That being said, to directly answer your question, there is probably minimal difference (especially in real-world use) between the two approaches, so I'd do whatever actually meets your needs and that you are able to set up as desired.

I actually deleted the rule (my motion sensors haven't arrived, I was using a door sensor as a pseudo test to see how it worked) but I am pretty positive "Activate even if already partially activated" was turned off, and I do know the lights report their states to the hub nearly instantaneously.... I will have to rebuild it and re-test I guess.

Thank you for the insight though!

I have confirmed "activate even if already partially activated" is turned off, AND that the lights were showing correct status in hubitat. Room Lighting still adjusted the brightness of the lights. I wonder if it's because the lights are a Phillips hue group instead of individual light bulbs? I may do some troubleshooting, but if you think there is minimal difference between the 2 approaches in terms of hub resources, I will likely just do 2 rule machine rules unless I can figure out why it isn't behaving as expected.

I've been playing around with Room Lighting but I haven't had enough success with it that I'd feel comfortable giving you advice there.

But, if I understand what you are trying to do, I think you could do this as one RM rule. Something like:

Trigger Event: Motion active

IF light is off
    Turn on light
Wait for event: Motion inactive and stays that way for x minutes
Turn off light

I don't know if that would work.... It would if I am just turning on or off the light, but I am turning on the light to different brightnesses per mode.

Can you do an "if" inside of an "if" ?

If so I may try

  • IF light is off
    - IF mode is x
    -- Turn on light to x%
    -- Wait for event: motion inactive for x minutes
    -- Turn off light
    • If mode is y (repeat above with different values for multiple modes)
  • End-If
  • Wait for event: motion inactive for z minutes
  • Turn off light

Maybe that will work? I am too tired to try tonight, I will have to experiment in the morning to see if I can do multiple layers of IF commands

Why not both? You can use room lighting to setup your desired brightness settings for each mode. Create an activator device. Use RM to turn the activator device on with motion and off after xx minutes depending on the mode.

My noob status may start to show here, but I don’t understand how that would be different that just using motion to trigger room lighting, or how it would get past my issue. It feels to me like an extra step for no reason. Can you please explain how that would help? Thank you

It just simplifies the rule. Ultimately, you just need it setup in a way that you understand since you'll have to maintain it, just giving an available option.

I do something similar with the water closet in my master bath. I have varying methods to turn off the light depending on whether or not the fan is on.

Here's my bedroom lights RM rule.

If it's bright in the bedroom, I don't need any lights on. The lights are turned off and the rule exits.

Assuming it's not too bright, the lights are turned on in various combinations and at various levels based on mode. If I want, I can manually turn on lights that are not specified for each mode. For example, in the evening I can turn on the ceiling light manually if I need more light than the two side lamps provide.

Then the rule waits until no motion for 5 minutes.

The lights are turned off based on mode. If mode is Asleep, it means I might be in bed reading, so I don't want the lamp I use for reading in bed to be turned off. I turn if off manually. Otherwise, all of the lights are turned off, whether they were on or not. This covers having manually turned on a light.

Oh so you use cancellable delays. I haven’t touched those. I see how that works. Okay, that may be what I was looking for. Gives me another option to consider at the very least. Thank you!

In RM there is also a options for set level or colour them and level per mode. So rather than a on with a condition that does the same thing but a bit cleaner.

Yeah, that is my plan in rule machine. I just did a test and I can't tell if its just placebo but it seems adding 8 or 9 "if" statements does slow down the Rule machine rule a little bit (especially if the command you want to run is near the end) but its so close that I may just be imaging it. I think RM is the way to go for me

lets see the rule, there is normally a lot you can do to make complicated rules much more efficient. once you have them working then you can set about optimising.

1 Like

I literally built the rule to test it and deleted it - my motion sensors aren't here yet so I can't build a real one yet. But it was something like this:

Trigger: Motion detected (it was a contact sensor for the test, but long term it will be motion)

  • If lights off
    • If "headache" is on
      -- Set lights to 25%
      -- Wait for event: No motion for 1 minute
      -- Turn off lights
    • Else-If "work" is on
      -- set lights to 100%, cool white
      -- Wait for event: No motion for 10 minute
      -- Turn off lights
    • Else-If Mode is "night"
      -- Set lights to 1%
      -- Wait for event: No motion for 1 minute
      -- Turn off lights
    • Else-If mode is "Mornings"
      -- Set lights to 50%
      -- Wait for event: No motion for 5 minute
    • Else-If mode is "Home"
      -- Set lights to 100%
      -- Wait for event: No motion for 5 minute
      -- Turn off lights
    • Else-If mode is "evening"
      -- Wait for event: No motion for 1 minute
      -- Turn off lights
      --set lights to 70%
    • End-IF
  • End-IF
  • Wait for event: motion sensor detects no motion for 5 minutes
  • Turn off the lights

(Wait times will be adjusted, they aren't really important here, just made up numbers for the test, but that is the idea)

I think this is what you actually want

Your off would be per mode.

Almost, but I also have some virtual switches that change things up instead of just modes (I.e. headache virtual switch for when I have a headache turns the lights lower, and work virtual switch for my work office changes colour tempature)

But it is VERY close to what I want. I can probably work with that.

I guess I could do that in the “else” though.

Maybe that is what I want.

I would need to modify it slightly. I would need an IF that prevents the lights from turning off altogether (I.e. monitor plug is drawing power and I’m therefore at my desk, even if relatively still) and I’d need an IF for my work office that has a longer delay to turn off lights before going to modes - BUT I think I can add those relatively easily as far as I can tell. This is probably exactly what I want. Thank you for your help!

(There are still so many things I’m leaning about rule machine, I’m so used to doing things one way but that’s clearly not the most efficient)

1 Like

yes i have included those (just picked random switches of mine). if they are active it goes down different path. you had it activating twice.