[Blueprint] Window open → Climate OFF, Window closed (stable) → Restore

[Blueprint] Window open → Climate OFF, Window closed (stable) → Restore

Restart-safe, debounce-based, no false restores

I’d like to share a window-based climate control blueprint that I created after repeatedly running into reliability issues with existing solutions.

This blueprint has now been running for some time in my setup and works consistently without the common problems I experienced before.


Why another window/climate blueprint?

Many existing window-based climate automations work most of the time, but I repeatedly hit these issues:

  • Sometimes the window is closed, but the heating does not turn back on
  • Sometimes the heating turns back on while the window is still open
  • After a Home Assistant restart, the climate state is lost or restored incorrectly
  • Quick open/close events or sensor flapping cause unreliable behavior

These issues usually come from:

  • Single-trigger automations trying to “remember” state
  • No debounce on window close
  • Using local variables that don’t survive restarts
  • Restore logic tied to the same execution that performed the shutdown

This blueprint was designed specifically to avoid all of those pitfalls.


Key design principles

1. Two independent triggers (open → off, close → restore)

Instead of one automation flow trying to handle everything, this blueprint uses:

  • One trigger for window opened → turn climate off
  • One trigger for window closed and stable → restore climate

This means:

  • A Home Assistant restart does not break the restore logic
  • The restore does not depend on a previous execution still being in memory

2. Debounce on both open and close

You can configure:

  • How long the window must stay open before climate is turned off
  • How long the window must stay closed before climate is restored

This prevents:

  • False restores from brief sensor glitches
  • Heating turning back on while the window is still physically open

3. Optional persistent state storage (restart-safe)

The original HVAC mode is optionally stored in an input_text helper as JSON.

Benefits:

  • Climate restore still works after HA restart or automation reload
  • No reliance on runtime variables that disappear on restart
  • Clean removal of stored state after successful restore (no stale data)

If you don’t want persistence, you can leave the helper empty and run purely in-memory.


4. Explicit mode restore (not guessing)

The blueprint restores the exact original HVAC mode:

  • No assumptions
  • No “turn heat on” guesswork
  • Restores only if the mode is still supported by the device

5. mode: restart for correctness

If the window state changes again while waiting for debounce:

  • The automation restarts cleanly
  • Pending restore/off actions are canceled safely
  • No race conditions

What this blueprint avoids

  • No false “heating ON” while the window is open
  • No missed restore after closing the window
  • No broken behavior after HA restart
  • No need for complicated helper automations or scripts

In my experience, this directly fixes the classic problems people report with window-based heating automations.


Typical use cases

  • Radiator thermostats
  • Floor heating
  • Heat pumps
  • Any climate.* entity where opening a window should reliably disable heating

Import the Blueprint

Open in Home Assistant


Final note

This blueprint exists because reliability matters more than simplicity here.
If your current solution mostly works but occasionally does something wrong, this approach is designed to be boringly predictable.

1 Like

I’m currently struggling to make my heating automation work. For whatever reason it seems to be unreliable.
I would suggest you add two more things: people tracking (if all people are away - turn off heating) and outside temperature (if temperature above 10-15 °C - turn hearing off).