Some hardware links on this page are affiliate links. As an Amazon Associate I earn from qualifying purchases. We may earn a commission if you buy through them, at no extra cost to you. See the affiliate disclosure.
An open window plus a running heat pump is a good way to condition the outdoors. This workflow waits until a contact has been open long enough to mean it, stores the current HVAC mode and setpoint in helpers, and turns climate off. When the contact has been closed long enough to mean it, it restores what it saved. A reboot in the middle does not forget the snapshot.
Entity ids are blueprint inputs. Do not copy a live thermostat name into a published automation.
What problem it solves
You want heat or cool to pause while a door or window is actually left open — without killing climate on a two-second latch rattle, and without leaving the system off after you close it because Home Assistant restarted.
How it works
- Open debounce — contact goes
onand staysonfor the open delay (default about a minute). A slam-and-shut does nothing. - Snapshot — write current
hvac_modeand temperature setpoint intoinput_text/input_numberhelpers, then set a booleanpaused_by_window. Helpers survive a restart; await_for_triggervariable does not. - Climate off —
climate.turn_off(orhvac_mode: off) on the thermostat you picked. - Close debounce — contact goes
offand staysofffor the close delay so a bouncing reed does not restore mid-swing. - Restore — if
paused_by_windowis still on, set the saved mode and setpoint, then clear the boolean. If HA restarted while the window was open, the boolean is still on and a later close still restores. If HA restarted while already restored, the boolean is off and nothing is applied.
Optional: a notify when pause or restore fires, using the same helper so you do not get a page on every bounce.
Hardware notes
- Contact. Any binary sensor that is
onwhen the opening is open. Multiple windows can feed a group binary sensor; the blueprint still takes one entity. - Climate. A single HA
climateentity with a mode and a setpoint. If heat and cool use different setpoints, the pack stores both numbers. - No extra hub. If you already have contacts and a thermostat in HA, this is YAML and helpers only.
Snippet
The pack ships a blueprint. Inputs replace real entity ids:
trigger:
- platform: state
entity_id: !input window_contact
to: "on"
for:
seconds: !input open_debounce
id: opened
- platform: state
entity_id: !input window_contact
to: "off"
for:
seconds: !input close_debounce
id: closed
action:
- choose:
- conditions:
- condition: trigger
id: opened
sequence:
- service: input_text.set_value
target:
entity_id: !input saved_hvac_mode
data:
value: "{{ states(window_climate) }}"
- service: climate.turn_off
target:
entity_id: !input climate_entity
- service: input_boolean.turn_on
target:
entity_id: !input paused_helper
- conditions:
- condition: trigger
id: closed
- condition: state
entity_id: !input paused_helper
state: "on"
sequence:
- service: climate.set_hvac_mode
target:
entity_id: !input climate_entity
data:
hvac_mode: "{{ states(saved_mode) }}"
# setpoint restore + clear helper: full blueprint in the pack
Setup outline
- Pick the contact (or group) and the climate entity.
- Create the three helpers (saved mode, saved setpoint, paused boolean) or let the pack’s helpers do it.
- Import the blueprint, fill the
!inputslots, set open/close debounce. - Test: open the window, wait the delay → climate off and helpers filled; restart HA while still open → helpers unchanged; close and wait → mode and setpoint return; close without a prior pause → no change.
Troubleshooting
- Climate dies on a quick open. Open debounce is too short. Raise it; a minute is a better default than five seconds.
- Never restores.
paused_by_windownever turned on (open debounce not met) or the restore action is writing a mode the thermostat rejects (heat_coolvsheat). Check the saved text helper after a pause. - Restores the wrong setpoint after a reboot. You snapshotted into automation variables instead of helpers. Use the pack helpers; they are the restart-safe part.
- Two windows, one thermostat. OR them in a group. Pause while any is open; restore only when the group is closed for the debounce.
Credits
Based on the community blueprint Window open → climate off, window closed (stable) → restore. This write-up is an original overview of the helper-backed, restart-safe pattern.