Here is my rule that turns on my lights either at a certain time or when the light level gets below a certain threshold. One issue I noticed is if I manually turn the light off, it will just get kicked back on the next time the rule is checked. Anyway I can incorporate a simple override, for example if I am watching TV and want the lights off?
One thing you could do is set the rule's Private Boolean to True when you want to "override" the automation. If you're not familiar, Private Boolean is a "free" (no need to manually create it) built-in variable that every rule has. It's sort of a private variable, but you can change it from other rules, so it's semi-public, which is one advantage it has in this case over a local variable (which you could also use if you wanted, but I think that complicates things).
My suggestion would be to create a second rule, one which sets the Private Boolean on this rule to True or False depending on whatever other criteria you have. For example, you could create a virtual "Watching TV" switch and have a rule that sets this rule's PB to True when that gets turned on and False when it gets turned off. (You could also use this switch to trigger other automations and enable it with your voice: "Alexa, turn on 'Watching TV' switch.") The tricky part might be remembering to turn it off when you're done unless you trust yourself to do that. Otherwise perhaps you want another trigger to turn it off, like a certain time or a mode change (Night/Sleep-type mode?).
Then you could modify this rule. Wrapping the whole thing in an IF (Private Boolean is False) THEN
followed by all your existing actions and then an END-IF
would be the simplest way, which would "freeze" your lights as-is any time the switch is on (or PB is True). If you only wanted to prevent them from turning on but don't care if this rule turns them off in this case, you could just wrap your "On" action with the same IF
... END-IF
.
Alternatively, you could find some other way to tell if you're watching TV. For example, I put a pressure mat under my couch hooked up to a contact sensor. If the contact sensor is "closed," then I'm on the couch and probably watching TV, so I have some automations that are modified based on that (in my case, just keeping the lights on since there's less likely to be movement in the room that my other sensors would see, but you could easily use this as a condition to not turn lights on--instead of the PB or virtual switch).
Just a couple ideas! Other people might have more suggestions.
That's a great idea! being new to Hubitat and RM, how can I wrap the existing rule in an "If- then" statement?
Use "Insert Action Before," then find the IF THEN option under the Conditional Actions menu, to get one at the beginning. Then insert an END-IF using the a regular insert (which always puts the new action at the end). I can show screenshots when I'm on a regular computer again if needed, but hopefully this helps!
This helps, I’ll give it a shot later today. Thanks again
Here is what I have now, I'd love some feedback;
Then I created a new vswitch and the following app.
Edit - This switch was a one time action, how can I set to toggle the Boolean between true/false?
Change your trigger from "Pause Family Room Light turns off" to "Pause Family Room Light *changed*", then modify your rule actions to something like :
IF (Pause Family Room Light is on) THEN
Rule Bolean True: Family Room Light 3.0
ELSE
Rule Boolean False: Family Room Light 3.0
END-IF
(or I guess create a separate rule with an "on" trigger, but this is less cluttered and one of few instances where I'd say it's better to keep things in one rule )
No, sorry, I didn't meant to combine both of these rules into one, just to keep the one that set the private boolean on this (original) rule as one rule, despite the fact that two (three total) would also work. I'd still suggest two total rules, modifying your latest as I suggested above.
Your PB true/false is indeed opposite of what I have above, but there's no reason it won't work that way. The only thing to keep in mind is that PB is false by default, so I'd just toggle your virtual switch once after you have both rules set up the way you want so it gets "initialized" with what I assume is your desired value (True
).
My guess if we posed this same question you your spouse we would get a different response.
Here's my rule for night or during the day when the LUX is low. I several of these rules for different sections of the house. The day_mode_lights variable is just a variable that I set so the lights don't come on early in the morning. Currently the day_mode_lights go "on" at 8:00 AM. It's not critical, just a way so I didn't have to change the between X:XX and Sunset time on all the rules if I wanted the start time different.
I cleaned up the order, and still have it in one rule (preferred if it works), but I still seem to have an issue with the private boolean.
Here you can see my virtual switch is on, which should set the private boolean to "true", but in the following IF statement the boolean is showing as "false". Is my logic incorrect?
I would still split this rule up into two separate rules as I suggested above: one with "Pause Family Room light *changed*" as a trigger with everything between your first IF...END-IF as the actions, and the second exactly how you have it now without that part (i.e., keep your triggers the same and get rid of everything before IF (Private Boolean is True)
).
The issue right now is that nothing toggles the Private Boolean when your "Pause Family Room Light" switch changes. Adding it as a trigger to this rule would make it incredibly messy (you really want two completely different sets of actions to run when this virtual switch is changed versus when your "real" lighting automation runs, so it doesn't make sense to combine them and there's no good way to distinguish that I can see if you mix triggers).
I don't fully understand, but then again I am new to this. Based on your advice I now have two rules:
rule 1:
rule 2:
So this should work?
Looks almost right! However, I'd switch around one of your True
and False
settings/comparisons. Right now, you're turning on/off the lights only when the PB is True, but you're setting the PB to be True when your virtual "pause" switch is on--likely the opposite of what you want. The solution I'd recommend is to change your second rule (Family Room Light 3.0) to check for IF (Private Boolean is false)
on the first line (so check for "false" instead of "true"), though technically switching around your other rule would work too.
Yup, I caught that right after my post, Thanks again for all of your help on this!
One more issue I noticed. With this rule in place I have manually turned off the light and did not enable the “pause” switch, and the light will not come back on automatically like it used to or like I’d expect it too. It’s dark here so the illuminance trigger should kick off. If I go to the rule and click “run action” the light turns on. It’s like the rule is being checked.
For your actions to run, either the time will have to become sunset-30 or your lux sensor will have to report a reading below 1100 (contrary to what the wording might make you think, that trigger actually fires every time it reports such a value, not just the first). Have you verified that one of those events happened? The lux sensor, I'd assume, is far more likely to set off your actions, but it it's late and it happens to settle into some unchanging value for the night like 0 or 10, you'll never get a trigger. Looking at your device history may help.
The Lux sensor is at 5 right now which is the lowest it will go. So basically unless that number changes the rule will not trigger?
Yes, the rule actions run only when a trigger fires. No event means no trigger. There are some workarounds you could use here, like adding a trigger for when your virtual switch turns off (but make sure the conditionals only turn on the light when you want to then--they'll have to do some of the work "weeding out" what your triggers alone are doing right now).