Smart Home Assistant

Home Assistant: Turn Off Heating When a Window Is Open (UK)

SepehrBy Sepehr· 5 November 2026· Updated 5 November 2026· 7 min read
✓ Independent — no paid placements✓ UK-tested in real homes✓ Cited sources
Open white sash window on a stone terraced house in Stroud, Gloucestershire, seen from the street

Key takeaways

  • Trigger on a window sensor staying open for about three minutes, so quick airings never switch your heating off.
  • Save the thermostat first with scene.create, then restore that scene when the window has been closed for 30 seconds.
  • A group helper set to any lets one automation handle a room with several windows.
  • Scenes made with scene.create are temporary, so add a start-up fallback that returns heating to heat.
  • In winter, drop the open-window target to a frost-safe 7 to 10°C instead of switching fully off.
On this page[tap to expand]

A Home Assistant turn off heating when window open automation watches a window contact sensor, switches the room's thermostat off after a short delay, then restores its previous mode when the window shuts. It takes about 20 minutes with any sensor and thermostat or radiator valve Home Assistant can control.

The two details that decide whether this is useful or irritating are the delay and the restore. Trigger instantly and every quick airing cycles your heating off and on; forget the restore and you come home to a cold house with the heating still off. This guide builds both halves properly, for one window or a whole room, using only built-in Home Assistant features.

What do you need before you start?

  • A window or door contact sensor that already appears in Home Assistant. Zigbee, Z-Wave, Thread and Bluetooth contact sensors all work. If you have not bought one yet, our best smart window sensors for the UK roundup compares the options.
  • A controllable heating entity in the same room: a climate entity such as a smart radiator valve, a room thermostat or a zone from a system like Tado. Our radiator valve guide and heating control guide cover getting one working.
  • A recent Home Assistant release. The YAML below uses the current triggers: and actions: syntax with a plain state trigger, so it works on any recent install.
  • A phone with the companion app, only if you want a "heating paused" notification. See our notifications guide.

Why turn the heating off for an open window at all?

A room with an open window keeps asking its thermostat for heat that immediately escapes outside, so the boiler or heat pump works hard for no benefit. Pausing the heating for that one room while the window is open stops it wasting energy, and puts it back automatically afterwards.

Some smart heating systems and valves already do a version of this on their own, so check before you build anything. Home Assistant is still worth using when you want one consistent rule across mixed brands, a delay you control, or a window sensor from a different manufacturer from your radiator valve. The popular Better Thermostat custom integration lists "let your windows disable your heating" as one of its core features, which shows how common the need is.

Step 1: Check the sensor reports "window" correctly

Home Assistant treats a binary sensor with the window device class as open when it is on and closed when it is off. Many contact sensors arrive with the generic "door" class, which works but will give you the wrong triggers in the automation editor.

Open Settings > Devices & services > Entities, select the sensor, open its settings cog and change Show as to Window. Then check Settings > Developer tools > States while you open and close the window: the state should flip between on (open) and off (closed). Rename the entity to something plain such as binary_sensor.lounge_window so the YAML below is easy to read.

Step 2: Combine several windows into one room sensor

If the room has more than one opening, create a single sensor that reports "open" when any of them is open, so one automation handles the room. Go to Settings > Devices & services > Helpers > Create helper > Group > Binary sensor group, pick the room's window sensors, and set it to be on when any member is on. Give it the window device class and call it binary_sensor.lounge_windows.

Skip this step if the room has one window. Our groups guide and helpers guide explain the helper types if you want more detail.

Step 3: Build the "window open" automation

This automation waits for the window to stay open for three minutes, saves the thermostat's current state, then turns the heating off. The wait is what stops a quick airing from switching your heating off and on.

alias: Lounge heating off when window open
mode: single
triggers:
  - trigger: state
    entity_id: binary_sensor.lounge_windows
    to: "on"
    for: "00:03:00"
actions:
  - action: scene.create
    data:
      scene_id: lounge_before_window
      snapshot_entities:
        - climate.lounge_radiator
  - action: climate.set_hvac_mode
    target:
      entity_id: climate.lounge_radiator
    data:
      hvac_mode: "off"

The for option means the sensor has to stay open for the whole three minutes, and the timer starts again if the window closes and reopens. The scene.create action records the thermostat's mode and target temperature in a temporary scene, which is how Home Assistant's own documentation handles an open-window example. Some devices have no "off" mode, in which case use climate.set_temperature to drop the target to a frost-safe 7 to 10°C instead, and read the scenes guide for how snapshots behave.

Step 4: Build the "window closed" automation that restores heating

Closing the window should bring the heating back exactly as it was. Create a second automation that reactivates the saved scene a short moment after the sensor goes back to closed.

alias: Lounge heating back on when window closed
mode: single
triggers:
  - trigger: state
    entity_id: binary_sensor.lounge_windows
    to: "off"
    for: "00:00:30"
conditions:
  - condition: state
    entity_id: climate.lounge_radiator
    state: "off"
actions:
  - action: scene.turn_on
    target:
      entity_id: scene.lounge_before_window

The condition is a safety net: it only restores the scene if the thermostat is currently off, so it will not overwrite a setting you changed by hand while the window was open. The 30-second delay avoids reacting to a sensor that briefly flickers.

Does the restore survive a Home Assistant restart?

Not reliably. A scene made with scene.create is temporary, and Home Assistant's scene documentation says that reloading scenes removes the ones created this way. Treat a restart in the middle of an open window the same way. If it happens, the restore automation will find no scene, so add a fallback.

The simplest fallback is a third automation with a Home Assistant start trigger that checks whether the room window is closed and the thermostat is off, and if so calls climate.set_hvac_mode with heat. For a house on a simple weekly schedule that is usually all you need, because the schedule resumes control. For deeper control of how the schedule and automations interact, see the heating control guide.

Step 5: Test it end to end

Do not wait for a cold morning to find out it is broken. Temporarily change both for values to ten seconds and walk through a real test:

  1. Open the window and wait ten seconds. The thermostat should switch to off.
  2. Open Settings > Automations & scenes, select the automation, and open its Traces tab to confirm it ran and which step it reached.
  3. Close the window, wait, and confirm the thermostat returns to its earlier mode and target.
  4. Open and close the window inside the delay, and confirm nothing happened.

Set the delays back to three minutes and 30 seconds when you are done.

Step 6: Add a notification and a frost guard

Two small additions make the automation safer. First, add a notification action after the heating switches off, so you know when it fires: a message like "Lounge heating paused: window open" sent through the companion app. If the window is still open an hour later, send a reminder. This also catches a window left open overnight.

Second, protect against cold snaps. A thermostat switched fully off in a freezing room is a risk for pipes, so either set the open-window target to a frost-safe temperature rather than off, or add a condition that skips the automation when the outside temperature is below about 2°C. Our frost alert guide shows how to work with the same forecast and temperature data.

Common problems and fixes: why isn't my open-window automation working?

It never triggers: check the sensor state in Developer tools. Some sensors report on when closed. If yours is inverted, flip the logic or fix it at the device.

It triggers instantly or too often: the for option is missing or sits on the wrong trigger. It must be on the same trigger that checks for on.

The heating never comes back: the scene probably does not exist, because scenes created this way are lost on a reload. Look in Developer tools > States for scene.lounge_before_window, and use the start-up fallback in the restart section.

The thermostat ignores the command: some devices reject off and only support heat and auto. Lower the target temperature instead of switching it off.

Sensors drop offline: a battery sensor that goes unavailable never reports closed. The restore automation will not fire, so add a catch-all that restores heating if the sensor becomes unavailable for ten minutes. The state trigger documentation explains how unavailable and unknown states behave in triggers.

What should you build next?

Once the pattern works for one room, copy it for the rest of the house, using a blueprint or a single automation with several triggers and a room variable. Combine it with presence detection to drop the temperature when nobody is home, and use the same window sensors for security alerts, as covered in the window sensor roundup. Per-room control is where a Home Assistant heating setup pulls ahead of a single wall thermostat.

Buy the picks in this guide

Recommended for Smart Heating

See all devices →
Shop these picks on our Amazon storefront →

Frequently asked questions

How do I turn off heating when a window is open in Home Assistant?
Create an automation with a state trigger on your window contact sensor, set to fire when it has been open for about three minutes, then have it call climate.set_hvac_mode with the mode set to off on that room's thermostat or radiator valve. Before switching it off, save its state with scene.create so a second automation can restore it when the window closes. The delay matters because it stops quick airings from cycling the heating. The caveat is that scenes created this way are temporary, so add a start-up fallback that returns the heating to heat if Home Assistant restarts while the window is open. Test with short delays first, then reset them.
How long should the delay be before the heating switches off?
Three to five minutes is a sensible starting point for most UK homes. That is long enough that briefly opening a window to let steam out or take a parcel does not touch your heating, but short enough that a window left open for a proper airing is caught quickly. Shorten it for a bedroom you air for a few minutes each morning, and lengthen it in a kitchen where doors and windows open constantly. Home Assistant's for option on the trigger restarts if the window closes and reopens, so no counter logic is needed. The delay is your judgement rather than an official figure, so adjust it after a week of watching the automation traces.
Will this work with Tado, Hive or smart radiator valves?
It works with any heating device that Home Assistant exposes as a climate entity, which includes Tado zones, many smart radiator valves and several Hive and Zigbee thermostats. The automation does not care about the brand, only that you can call climate.set_hvac_mode or climate.set_temperature on it. Check what modes your device supports in Developer tools under States, because some valves have no off mode and need a low target temperature instead. Some systems also offer their own open-window detection, so you may not need Home Assistant to do it at all. If you mix brands in the same house, Home Assistant gives you one consistent rule for all of them.
Is it safe to switch heating fully off when a window is open?
Usually yes in mild weather, but not during a freeze. A room with the heating off and a window open can get cold quickly, and if the window is left open overnight in winter that raises the risk to pipes and to a cold house. Instead of off, many people set the open-window target to a frost-safe temperature between 7 and 10 degrees Celsius, or add a condition that stops the automation running when the outside temperature is near freezing. Adding a notification after about an hour of an open window also catches forgotten windows. Treat the numbers as a starting point and tune them to your home, because they are not an official standard.

Sources

Sources verified 2026-11-05

  1. Home Assistant — Scenes integration (scene.create and snapshot_entities)
  2. Home Assistant — State changed trigger (For at least)
  3. Home Assistant — Binary sensor device classes (Window)
  4. Home Assistant — Climate integration actions
  5. Home Assistant — Durations in automations and scripts
  6. GitHub — Better Thermostat README (window handling feature)
  7. Wikimedia Commons — Stroud George Street open sash window by Acabashi, CC BY-SA 4.0
›How we researched this

Claims in this article are checked against primary sources — manufacturer specifications, official documentation, Which? research, Ofgem guidance, or gov.uk — rather than forum threads or video reviews. Where the author has direct hands-on experience with a product (most Home Assistant, Zigbee, and home-networking gear is running in his own homelab), that is stated explicitly in the text.

For categories outside that personal setup — such as boilers, heat pumps, and other areas that are traditionally a heating engineer's domain — verdicts are built from cross-referenced manufacturer data, published lab results, and vetted expert and owner reviews rather than a claim of personal hands-on testing. See the editorial policy for the full methodology.

Sepehr

Written by

Sepehr

10+ years hands-on with Home Assistant & networking · Research-backed elsewhere · No brand deals

Smart home specialist with 10+ years running a self-hosted Home Assistant setup — Zigbee2MQTT, Frigate NVR, and local-first automations. Independent coverage for UK homes, no brand deals.

LinkedIn →

Citing this page? Please use a dofollow link back to the original article — it helps us keep the data on this page accurate and up to date.

Related reading