Capture/Restore - Best Practice?

I'm wondering what others might be doing under the following circumstances which weren't a reason for concern until I started expanding the use of exterior dim-able bulbs. This could hold for anything controlled by multiple rules I guess.

Take the case of a bulb that is set to a dim level at sunset and off at sunrise-30 on a daily basis by Rule A.

Then some time later you decide to create different rules that are responding to other triggers whereby you capture the level of the bulb, bump the level to xx% for some duration, and then restore the bulb setting to whatever it was before the trigger.

This is all good and manageable for say two rules, the initial Rule A and a new Rule B. But if you happen to have multiple scenarios where that bulb is one of a few devices you set in response to various motions you may create situations where that bulb is not Captured at, or Restored to, the level you might hope/think.

I'm just now making Rule B and considering how best to manage this into the future. From a simplistic approach - "oh, you better go look when you turn on/off this bulb in the first place" and so I set Rule B to only act between Sunset+59 to Sunrise-59 to avoid the device change that Rule A does at Sunset and at Sunrise-30.

But what's the smarter way to avoid the interference one rule might cause another with respect to a specific device. This is likely somewhere in the domain of predicates, tokens, priority/precedent, or maybe a global variable that holds a default level during certain time windows.

Looking for the smartest way to approach this to make sure your new rule dove tails in without having to lift the hood on everything built prior. Thanks in advance for the education.

I haven't necessarily adopted this in the HE world, but something I did when defining rules on my Hue bridge was to store a "Current Scene", which was updated as I moved through the different modes throughout the day. So whenever I activated motion on the Hue Bridge I activated the Current Scene.

Perhaps you could do something similar. The main rule (or rules) that drive the main light settings for each mode captures (and activates) a scene you want as the default throughout a period of time, storing that in a scene, then as you add in deviations from that default, like adjustments from manual controls or ad-hoc events, you still have the base scene to revert back to when that event stops.

1 Like

if it's all for the same bulb, i would do it in one rule. use each scenario as a trigger, and use conditionals in my actions to trigger the desired result