Lighting rule question

I've got rules setup for various rooms where lighting level is set by mode. Presence sensors fires these rules and all working fine.
But if I go in a room and then I want to change the level manually it will revert back to the rule level as soon as the presence sensor is tripped again.
What can I add to a rule that will override it's level until it's off state times out?
'

You'll need to share more more information about what kind of "rule" you've set up and how it's configured now. That will determine what you can change to get what you want.

For example, Room Lighting setup makes this fairly easy, as long as you can work within its concepts of "Activate" and "Turn off" (e.g., using the option not to activate if already partially activated, among other options that may get you there). Motion Lighting also offers options. With Rule Machine, something like this should be possible, but it depends on your existing rule. Even with Basic Rule, you can likely do this too by making simple use of Restrictions.

1 Like

My setup is...,.

In this case, I think the easiest option is to surround your "Dimmers per mode..." action lines with a conditional action:

IF (OFC Light is off) THEN
  Dimmers per mode: OFC Light
    // per mode stuff here
END-IF
Wait for event: motion inactive and stays that way for 0:10:00
Off: OFC Light

Basically, the IF THEN line and the END-IF line are the only two new things here. This assumes you still want the lights to turn off, even if this rule didn't turn them on. If you want to prevent everything in this case, you could consider another option, like using "OFC Light off" as a required expression with your existing rule (do not enable the option to cancel pending actions when it becomes false, i.e., leave it the defaults--otherwise it will never turn off!) instead of the modification I suggested above.

I'm not sure I understand how this will help me.
I walk into a room and the rule fires. My lights are on, I'm in the room. NOW, I want to change the dim level either by the switch or my dashboard. The light responds to the new level UNTIL I move in the room and the rule fires to set the dim level in the rule again.

Is there a reason why you prefer to create this automation logic manually with rule machine?

As @bertabcd1234 mentioned, Hubitat apps like room lighting or basic rules are designed to simplify the process for you.

1 Like

While I agree with moving this into an App that is designed for this situation...

I expect you are right, the condition of being off will not suit your scenario of simply changing the level of the lighting. If the manual controls you are using are all within HE, one approach I take is that when I use a manual control, like turning lights on with a Hue Dimmer, for example, you could introduce a virtual switch that is turned on when you enact a manual control, which is included in any rules such as this that are motion-based. So if you have manually adjusted the lights, the VS is turned on, and any motion-based rules would include the IF-THEN-ELSE construct @bertabcd1234 described, but look for the VS being off, i.e. in that case we want motion-based events to be responded to. If the VS is on, then the motion is not responded to by the rule. For my setup, I use the action of manually turning the lights off to signal resumption of motion-based lighting rules, but you may want something different.

1 Like

The rule you posted has no conditions on when a new motion event is detected. It just does what you told it to EVERY TIME it detects motion. If you add the condition that the lights need to be off to trigger the rule, then it will ignore any new active events unless the lights have been turned off. This motion event can trigger many times in the 10 minutes you have for the wait time. Many motion sensors are on a two minute update. So, you could (and likely DO) have a situation where you sit still for two minutes, the motion sensor goes inactive, but you move before the 10 minutes are up. In that case, a NEW motion event is triggered, thus triggering the lighting levels in the rule.

Currently, any time you move in front of the motion detector after it goes inactive, the rule triggers.

As proposed, you move in front of the sensor. If the lights are off, then the rule triggers at the values you have set. The lights stay on and you move again, the rule ignores it because of the condition. So, if you have changed the lighting level, they will stay whatever you changed them to UNTIL the motion goes inactive and stays that way turning off the lights. At that point, the lights are off and it can trigger the next time motion is detected.

2 Likes

It will cause your rule not to send a new level to the lights if they are already on. The proposed rule will turn them on once (if they are off), then not touch them again as long as they remain on, including if you send a new level to them in the meantime by some other means. This sounds like what you want, and that's why it should help. Do you have a specific concern regarding why it won't?

I think you may have the best/easiest solution. I wrap my rule in a conditional that the lights must be off first. I will add it in and see how it goes.
Thank you.

As much as I would like to take credit, it was @bertabcd1234 that provided the solution. I was just answering your question as to why it should solve your problem. All kudos and virtual donations (beer or otherwise) go to him.

Actually the easiest solution is to use another app like Room Lighting :slightly_smiling_face:.

Rule machine is great, for automation logic that can’t be accomplished with other, less flexible apps. But it’s rule machine’s flexibility and complexity that can make it a less efficient use of one’s time for simpler automations.

1 Like

Sorry for my confusion. I extend my thanks to you for the solution to this issue. I am testing it now to see how it works.

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