I do something similar with my lighting. See
NOTE: the behavior of this code is subtle and sensitive to timing. I’m not super happy with it but it works.
The main thing is the Weather rule. When Yahoo weather reports a condition code that indicates it is likely cloudy I turn on some lights and turn them off when the condition code indicates it may be sunny. However, if the light is triggered on or off manually I want it to stay that way until evening.
So what I do is I created some Override Switch Items to store whether or not a given light has been overridden. I like to store state in Items where possible as opposed to global vars but you can store the overrides in a global var if that is what you prefer.
I also have an Item named WhoCalled. By default, WhoCalled gets set to “Manual”. However, when a rule triggers to turn on or off the lights it changes WhoCalled to something else (e.g. “Timer”) before sending the commands to the lights and then changes it back to “Manual”. Then I have a rule called “Override Lights” which gets triggered whenever any light gets an update. This rule checks “WhoCalled” and if it is “Manual” we know that the light was manually triggered so we set the Override flag for that light to true (which disables that light in the Weather Rule).
So tl;dr of the setup is:
- have a who called Item that gets set to one thing when changing your rollershutters from a rule and something else any other time; this is how we tell the difference beteen a rule triggered change and an manual change
- have a rule that triggers for any updates to your rollershutters
- in this rule if that who called Item indicates the rollershutter was not changed by a rule, you know that it was manually triggered so set your override flags
- make sure to check for overrides in your rules
- make sure to reset your override flags for the next day