Skip to content
← All posts

A Home Assistant Blueprint That Stops the Heat When a Window Opens

The radiator turns off when the window opens and back on when it closes, built as a reusable Blueprint so the next room takes 30 seconds.

By Rolf Szimnau · May 17, 2026 · 7 min read Updated November 8, 2026
A Home Assistant Blueprint That Stops the Heat When a Window Opens

Update, November 2026: One of the three window sensors has been offline since 3 November, and the Blueprint cannot do anything about a window it cannot see. I added an alert for that and wrote it up in a new section below. I also corrected the entity IDs and the room list: the office and the master bedroom now have their own sensors.

The radiator in my daughter's room was running at full heat with the window wide open. She's almost twenty, and keeping her window shut isn't something that happens reliably. I noticed the window had been open for an hour, heat on, outside temperature around 4°C. Not a disaster, but a predictable waste that would keep repeating.

The fix was a window sensor and one Home Assistant automation. The part I spent an extra hour on was building it as a Blueprint so when the same pattern comes up in another room, it takes 30 seconds, not another afternoon.

Hardware needed: IKEA window sensor + Mill radiator

An IKEA MYGGBETT door/window sensor on my daughter's window (binary_sensor.myggbett_door_window_sensor_door_2). The radiator is a first-generation Mill unit, climate.louise, which only supports two modes: heat and off. I have the same first-gen model in my office.

The master bedroom and kitchen run newer-gen Mill radiators with more HVAC modes. The Blueprint handles all of them. It snapshots the exact state before turning off and restores it precisely when the window closes, regardless of which mode or temperature the radiator was at.

The living room is a Daikin heat pump controlled by Tado, a different integration with its own modes. That one gets its own approach.

The Mill has a built-in open window detection feature, but it works by sensing temperature drops. It's slow to react, and it misses short openings completely. The MYGGBETT sensor is instant and precise.

IKEA MYGGBETT sensor mounted on my daughter's window

Building the Home Assistant Blueprint

Rather than hardcoding my daughter's entities, I built the logic as a Blueprint at /config/blueprints/automation/homeassistant/window_heating_control.yaml. The inputs are a window sensor, a climate entity, and a configurable delay:

blueprint:
  name: "Window → Heating off"
  domain: automation
  input:
    window_sensor:
      selector:
        entity:
          domain: binary_sensor
          device_class: window
    climate_entity:
      selector:
        entity:
          domain: climate
    delay_minutes:
      default: 1
      selector:
        number:
          min: 0
          max: 10
          unit_of_measurement: min

The automation instance for my daughter's room is three lines:

- alias: "Window → Heating: Daughter's room"
  use_blueprint:
    path: homeassistant/window_heating_control.yaml
    input:
      window_sensor: binary_sensor.myggbett_door_window_sensor_door_2
      climate_entity: climate.louise
      delay_minutes: 1

State snapshot and restore

The Blueprint doesn't just turn the radiator off. It saves the exact state first using a dynamic scene:

- action: scene.create
  data:
    scene_id: "{{ this.entity_id | replace('automation.', '') }}"
    snapshot_entities:
      - !input climate_entity
- action: climate.set_hvac_mode
  target:
    entity_id: !input climate_entity
  data:
    hvac_mode: "off"

The scene ID is derived from the automation's own entity ID: unique per instance, no manual naming needed. When the window closes, the Blueprint restores that exact scene:

- action: scene.turn_on
  target:
    entity_id: "scene.{{ this.entity_id | replace('automation.', '') }}"
  continue_on_error: true

This means it restores whatever the radiator was doing (18°C, 22°C, already off), not just a hardcoded heat mode. The continue_on_error: true handles the edge case where the window closes before the automation has ever fired (no snapshot exists yet).

The 1-minute delay

The for: minutes: !input delay_minutes on the opened trigger is what makes this practical. When the window opens, HA starts an internal countdown. If the window closes before the minute is up, the trigger is cancelled and the automation never fires. A quick airing doesn't kill the heat.

mode: restart handles the edge case where a closing trigger arrives while an opened-trigger is still counting down. The closing trigger wins immediately and turns the heat back on. No queuing, no race condition.

Notifications

When the heating switches off, two things happen: a push notification goes to all devices via notify.alle_enheder, and a voice announcement plays on the kitchen speaker:

- action: notify.alle_enheder
  data:
    title: "Window open"
    message: "Daughter's window has been open for 1 minute — heating is off"
- action: tts.cloud_say
  target:
    entity_id: media_player.hojtaler_kokken
  data:
    message: "Daughter's window is open. Heating is off."
    language: da-DK

The dashboard card

The AlertTicker card (custom:alert-ticker-card) picks up window sensors by device_class: window. No manual entity list is needed, so it covers any sensors added later:

type: custom:alert-ticker-card
show_when_clear: true
clear_message: "All windows closed — heating active"
alerts:
  - device_class: window
    state: "on"
    message: "{name} is open — heating may be off"
    theme: window
    priority: 2

When all windows are closed, the card shows a green "all clear" slide. When one is open, it switches to an animated alert with the sensor's friendly name in the message.

When a window sensor goes offline

The Blueprint only reacts when a sensor reports on. A sensor that reports nothing is invisible to it. If the battery dies or the sensor drops off the Matter network, its state becomes unavailable, and opening that window no longer switches anything off. The radiator keeps heating into the open window and nothing tells me.

That is the situation right now. One of my three sensors has been unavailable since 15:00 on 3 November. As I write this on 8 November, that is five days. The likely causes are a flat battery or a dropped Matter connection. I haven't confirmed which, and the sensor is still offline, so I can't call this fixed.

On the evening of 3 November, about two and a half hours after the sensor dropped, I wrote an automation called "Vindue: sensor offline". It lists the three sensors explicitly and sends a push notification to my phone when one has been unavailable for more than six hours. The message says the heating control in that room is blind and tells me to check the battery and re-pair the sensor. Six hours because the healthy sensors were unavailable for 16 seconds at most over the previous week, so short blips don't trigger it.

A for: hours: 6 trigger has two weak spots. A restart resets the timer, and a sensor that is already unavailable when Home Assistant starts never changes state, so the trigger never fires. This sensor was already offline when I saved the automation, so it was exactly that case. So there is a second trigger: every morning at 09:00 the automation checks all three sensors and sends a message for any that has been unavailable for six hours or more. It nags me every morning until the sensor comes back. Each sensor has its own notification tag, so a new message replaces the old one instead of stacking up.

The last run was 09:00 today. I can only see the last two runs, because the traces were cleared when Home Assistant restarted at 08:44 on 7 November. Yesterday's check looks like it did nothing: the restart had reset the sensor's "last changed" time 16 minutes earlier, so it didn't count as six hours yet. Today's check sent the message.

An alert doesn't put the heating back in control. Until I change the battery or re-pair the sensor, that room has no window control at all.

Reusing the Blueprint in other rooms

Settings → Automations → Create → From Blueprint → select "Window → Heating off" → pick the sensor and radiator → save. No new code. That's the whole point of building it as a Blueprint from the start rather than a hardcoded automation.

The office and the master bedroom have their own sensors and Blueprint automations now, with identical configuration apart from the entities. The kitchen Mill radiator will work the same way once it has a window sensor. The Daikin in the living room is a different story: Tado manages that one and will need its own logic when the time comes.

New posts in your feed reader: follow with RSS In Google Search: add szimnau.dk as a preferred source