I tried making a rule to turn off my HVAC when I open a window, but ONLY if the HVAC was set to on before. When I created the rule my HVAC was OFF and a window was OPEN. I closed the window. At that point, the rule executed and turned on my HVAC. Why? I thought it only evaluated rules if the rule's truthyness changed. It didn't because the HVAC was NOT set to auto. Can someone explain to me why it executed and how I can do what I'm trying?
Did any of your windows open?
If so, the rule will be evaluated.
As the HVAC was off the rule will be false and your false actions will run. It will turn on the HVAC.
This is a fundamental problem with how you have the rule at the moment.
The "mode of auto" in your rule will immediately evaluate to false when the rule runs and changes your HVAC to off.
Generally you don't want the thing you are changing to be part of the rule level conditions. You can use it in action level conditions to decide if you want to change something or not.
I literally just did almost the exact same thing a few minutes ago, except mine was shutting off my HVAC when there is a smoke alarm. In order to restore the system to the previous state, store that state in a variable. Then use conditional actions comparing to that variable to restore the HVAC to that state.
So basically it's checking for a change in the CONDITIONS to decide which action to run, not a change in the rule? Meaning, I thought it only even did anything if the rule had a new value. Are you saying it is actually if one of the conditions has a new value?
Have an example of conditional actions? Haven't done that yet
All I'm saying is that if one of your windows open that condition will become true. The rule will then be evaluated and as your HVAC is off the rule will be evaluated as false.
The rule is re-evaluated if any of the device attributes in the conditions list change. It then decides to do the true or false step based on that output.
Your logic is:
if (any thing is open) AND (hvac is auto) then
So you open a window and now your two tests evaluate to
true AND true so you set a 5 minute timer to turn HVAC to off.
HVAC turns to off and now your two tests evaluate to
true AND false so you turn HVAC back to auto. That then triggers the rule to run again and your rule is now 'true AND true` and now you're stuck in a loop.
Here's my rule for managing my HVAC when HSM alerts smoke. Now, what I would do is divide this up in a regular rule with the top actions (above the wait) in True for window open and the bottom actions (below the wait) in the false actions for window closed.
And don't use the wait.
@dman2306, on your rule, if I don't want my HVAC turn On when I closed the windows, I delete Actions for False ( let it blank ).
I created another conditions rule :
- All windows are closed And
- Thermostats : Mode Off
Actions for True : Delay " X " minutes / Thermostats --> Mode: Auto
It work well with me.