Rule caught between Mode changes

Got a strange one here. I have a rule that turns on lights for the stairs only when the mode is Evening or Night. Noticed this AM that the rule triggered while the Mode was night but before the motion sensors went inactive the mode changed to Morning. Therefore the rule exited and never turned off the lights. Any suggestions on how to modify for this potential glitch?

I always set up my turn off rules not restricted to modes. That way they always at least turn off if they get tripped on for some reason. Limit your mode restriction to the turn on part of the rule and let the lights turn off in any mode. IMHO

2 Likes

Would this work?

IF (NOT Mode in Evening, Night) THEN
     IF (Stairs Light Dimmer is ON) THEN
         Off: Stairs Light Dimmer
     END-IF
     Exit Rule
ELSE-IF (Motion Sensor active) THEN
     Dim: Stairs Light Dimmer
     Cancel Delayed Actions
ELSE
     Off: Stairs Light Dimmer --> delayed: 0:00:30  (cancel)
END-IF

BTW, why not put both those motion sensors into a single mZone?

Wouldn't this also automatically turn off the dimmer anytime it is physically turned on outside Evening & Night?

Yes, it would. And I think so would the suggestion from @april.brandt. But you can fix that with a Private Boolean, as shown below.

 IF (NOT Mode in Evening, Night) THEN
     IF (Private Boolean is TRUE) THEN
         Off: Stairs Light Dimmer
         Set Private Boolean False
     END-IF
     Exit Rule
ELSE-IF (Motion Sensor active) THEN
     Dim: Stairs Light Dimmer
     Set Private Boolean True
     Cancel Delayed Actions
ELSE
     Off: Stairs Light Dimmer --> delayed: 0:00:30  (cancel)
     Set Private Boolean False
END-IF

Here is what I changed the rule to. Thanks for the reminder on mZones! Forgot about that!! Decided to actually add a few more modes as well! Will test it out tonight. Thanks for all the feedback. This Forum is great.
image

I think this rule would also turn it off in "Day Mode" if the light was turned on manually. I think the Private Boolean approach indicated above will work.

An alternative would be to use the Motion Lighting App - I find it works really well for situations like this.

I know I probably spend to much time trying to optimize the rules to put the least amount of activity on the hub! I have always used the approach that the sooner a rule can qualify to run the better so it doesn't sit there waiting.

I guess I'm confused. Why you wouldn't want it to cycle off in any mode if inactive? I'm truly curious. Did I miss something? I'm always looking to learn. Please explain.

I think this is what @greg.cole wants:

Motion lighting to work for those lights in the Modes called "Dawn, Evening, Night, and Sleep". During those modes, whether the light is turned on manually, or by motion, he wants the rule to turn it off if there's no motion for 30 seconds.

Let's say he has another mode called "Day". He wants to be able to control the light manually in that mode and I think he doesn't want the absence of motion to turn it off in "Day" mode. Not 100% sure about this part.

Oh. Thanks for clarifying. Couldn't you just set a trigger to turn off the light if mode changes to day delay 30 seconds to cover that span? I never got the whole mode with time of day concept, so it seems a lot of work to add more modes and adjust a bunch of rules whenever you account for something else unforseen. I'm not hatin' on it. Just seems a lot of work.

1 Like

No worries! I'm always learning better ways to implement rules! So here is my rationale on modes. I have a lot of Hue lights along with dimmers on just about every non hue light. I have lots of rules that set the lighting (color, level) based on the time of day. I'm in Dallas and the daylight window here varies almost 5 hours between winter and summer. So after 1 season of having to adjust the time on all those rules, I went to modes that mirror sunrise and sunset. So now all those rules adjust accordingly.

In this example I do want the ability to manually turn on the stairs lights during the day if it happens to be darker than normal out. Could play around with Lux settings somewhere in the house but I bought a boatload of the Iris motion sensors off ebay and have them in every bathroom and hallway in the house!

I'm still open to other suggestions!!

Here's how I would modify your rule. I'd make a local Boolean variable (LBV) and use that to keep the rule active when the motion spans the modes.

IF (NOT Mode in Evening, Night AND Variable LBV = true) THEN
    Exit Rule
END-IF
IF (Motion Sensor active) THEN
    Set LBV to false
    Cancel Delayed Actions
    Dim: Stairs Light Dimmer
ELSE
    Off: Stairs Light Dimmer --> delayed: 0:00:30  (cancel)
    Set LBV to true
END-IF

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