I have two rules to operate a light based on a motion sensor and time conditions. I have one rule which is active 24/7 and another rule which does things a little differently which I'd like to prioritise during a certain period of time.
Whats the cleanest way to restrict the 24/7 rule from running while the other rule is active for an hour? The hourly rule may not happen every day so I need an overlap.
I'm expecting a stupidly simple answer on this one....
Without seeing the rules, that will be tough to help you with because the short answer is, you can't force one to overlap the other. The only thing you could do is delay one of them to give the other time to set its Private boolean or a global variable to prevent it from running.
RuleA with triggers and logic to run RuleB or RuleC depending on whatever criteria you have for rule priority
RuleB with 24/7 logic
RuleC with with your "for an hour" logic.
Another option with two Rules is going down the path Ryan780 suggested. Whatever criteria should enable the "sometimes" rule sets the Private Boolean on the "always" rule and you add a restriction on the "always" rule to only run if the PB isn't set.
Like Ryan780 said, sharing the triggers for each rule and how you determine priority would help a lot in getting some good options
I thought I'd try combining the rules together. Now I'm just unsure how to make them work independently.. (face slap!!)
Any advice would be much appreciated.
Here is my scenario...
On workdays only I have my ensuite lights triggered to turn on during the time I'll be using the ensuite.
Dim at first then brightens after two mins.
I wish the light to remain on at bright level 40 till I leave the house.
I have a Front door contact which turns off all my lights including Ensuite as I leave the house (plus I'll now include resetting the PB of that rule back to True with door contact)
At all other times I'd like the lighting to operate On/Off as per my Mode settings.
The reason I'd like there to be an overlap is because at some stage I wish to introduce days off into my normal workday schedule which would then treat my rule like its normal mode light if triggered between 06am and 0715, Mon - Fri
The problem I have now:
After the Ensuite light has turned on and brightened up to 40 it turns off at the 5 minute mark (I'm assuming this is based on the 5 min delay - > off, in my ELSE set of rules)
Fun fact: Showering in the dark is kinda creepy and Motion sensors don't trigger through shower screens.... Who knew!!
Edit: The last 'Set PB to True' was in there for testing purposes. The final rule will have it removed.
If you're a programmer you may recognize thread safety using a lock variable.
Maybe you can use a boolean global variable in a similar way. Rule is triggered, check lock bool if false, first action is setting the lock bool to true, last action is setting lock variable to false.