Hi, I can’t figure out the right automation logic.
I have two automations for AC pausing:
the first pauses the AC when window (with a window sensor) opens for longer than X minutes
the second starts the AC when the window closes (for more than X minutes) .
Trouble is, this obviously starts the AC regardless if it was on or off before the window closes.
How do I set this up ONLY when AC was previously ON? And keep the previous mode (cool/auto/dry/fan). I guess there should be a time window of a couple of hours so it doesn’t restart after, say, a cold night with AC off.
Thanks for any help.
EDIT: solution is to store the current AC state into a new scene in the first automation, and then recalling that with the second. I didn’t know this was a thing. Problem solved, thanks!
@koying I think the idea is that the ac was turned off when the window opened. Wjen the window is closed the ac should only turn on if it was on before the window was opened.
My point earlier was that maybe when the window closes, turn on the ac depending on the current conditions, ie temperature, humidity and perhaps time of day.
In the “Open Window” automation, you could save the state of the AC to an input_text.
That would give you both the “old” state and the timestamp (last_updated).
Than, in your “Close Window” one, take the proper decision based on these information.
Really depends if it is a simple on/off, in which case @koying 's suggestion is great, or if it is a climate entity a scene should work better as there is more to a climate than just on/off.
@koying 's point about last_updated makes saving the time redundant.
yep it’s a climate entity (A Daikin minisplit running via the official Daikin integration). It does save/recall the mode correctly. It doesn’t recall the Boost mode but AFAIK that’s a temporary toggle anyway. The automation works as I intended.
Looks like the automation doesn’t always store the current state of the AC. For example, I have the AC on “Dry”, then open the windows, it pauses correctly but upon closing the window again, the AC restarts in “Cool” mode or otherwise.
Is there a way to check the state of the scene.hvac_pause that gets created (the scene I use to store the current state of the AC in)? I looked in “States” but that only shows “Scening”.