Zigbee Window Sensors That Pause the Heat in Home AssistantHome Automation

Zigbee Window Sensors That Pause the Heat in Home Assistant

by Joule P. Kraft · November 27, 2026

As an Amazon Associate, and through other affiliate programs (including SONOFF), I earn from qualifying purchases. No affiliate relationship influences my recommendations.

The first cold week of the year, I walked into my daughter’s room at bedtime and it was 58°F. The window was cracked two inches. The heat had been fighting it all afternoon, running flat out to warm the backyard.

Nobody did anything wrong. Kids open windows. Somebody showers and the bathroom window goes up. The kitchen window opens when the oven smokes. What is wrong is a heating system that has no idea any of it is happening.

The fix is a cheap idea wrapped in a small sensor: a Zigbee contact sensor on the window, and one Home Assistant automation that pauses the heat for that room when the window has been open a few minutes, then puts everything back exactly how it was when the window closes. This is how I built mine, the mistakes I made first, and the sensors I would buy again.

Why a contact sensor beats “open window detection”

Plenty of thermostats and radiator valves already advertise open window detection. I tried it before buying anything. It works by watching for a sudden temperature drop at the device, then assuming a window opened.

In practice that has three problems:

  • It is slow. The air near the thermostat or valve has to cool enough to cross a threshold. In my house that took six to twelve minutes, and by then the boiler or heat pump had already burned through a full cycle.
  • It guesses wrong. The front door opening on a windy day trips it. So does a kid parking a cold backpack against the valve. Meanwhile a window open a crack on a mild day never trips it at all.
  • It cannot restore cleanly. Once it decides the window closed, it goes back to whatever it thinks the setpoint is, which is not always what the schedule says it should be now.

A magnetic contact sensor has none of those problems. The reed switch reports open or closed within a second, it does not care about temperature, and Home Assistant knows the exact moment the state changed. I still leave the built in detection enabled on my valves as a safety net, but the contact sensor is what drives the automation.

Which sensors I put on windows

I have three brands of contact sensor on my mesh. All of them work. They differ in size, battery, and how fussy they are about the rest of your network.

SONOFF SNZB-04P (code JPK, or on Amazon). This is my default, and most of my windows have one. It pairs cleanly with both ZHA and Zigbee2MQTT, reports in well under a second, and has a tamper switch if you care about that. The CR2477 coin cell is large, so battery life is long. I wrote a full SNZB-04P review if you want the details. Buy the multi pack; you will run out of sensors before you run out of windows.

Aqara door and window sensor. The slimmest of the three, which matters on old double hung sashes where the gap between sash and casing is tiny. The catch is the old Aqara habit: some models only stay connected through certain routers. If your mesh is mostly IKEA or Aqara gear they are fine. On a mixed mesh I have had two fall off and need a re pair.

Third Reality Zigbee contact sensor. Bigger, and it runs on AAA batteries you can buy at any grocery store. I use these on the basement windows where nobody cares about looks and I would rather swap a battery than hunt for a coin cell.

Whatever you pick, put the magnet on the moving sash and the sensor body on the fixed frame. On casement windows, mount on the latch side, not the hinge side, or a window open six inches can still read closed.

If you have never set up a Zigbee network, start with my best Zigbee devices for Home Assistant guide for the coordinator and router backbone. Contact sensors are sleepy end devices, and they are only as reliable as the powered routers around them.

The automation: one per room, three rules

My first version was two automations per window: one for open, one for close. With nine windows that became eighteen automations, and they drifted out of sync the first time I edited one. The version I run now is a single automation per room, with three rules baked in:

  1. Wait before pausing. The window has to stay open for a set time. Airing out a bathroom for thirty seconds should not touch the heat.
  2. Remember what you changed. Before pausing, snapshot the climate entity into a scene so the restore puts back the real mode and setpoint, not a guess.
  3. Wait before restoring. The window has to be closed for a minute. Kids open and shut windows repeatedly, and every off and on cycle is wear on a compressor or boiler.

Here is the bedroom version. The entity names are examples; swap in your own binary_sensor and climate entities.

alias: Bedroom window pauses heat
mode: restart
triggers:
  - trigger: state
    entity_id: binary_sensor.bedroom_window_contact
    to: "on"
    for: "00:02:00"
    id: opened
  - trigger: state
    entity_id: binary_sensor.bedroom_window_contact
    to: "off"
    for: "00:01:00"
    id: closed
actions:
  - choose:
      - conditions:
          - condition: trigger
            id: opened
          - condition: not
            conditions:
              - condition: state
                entity_id: climate.bedroom
                state: "off"
        sequence:
          - action: scene.create
            data:
              scene_id: bedroom_heat_before_window
              snapshot_entities:
                - climate.bedroom
          - action: climate.set_hvac_mode
            target:
              entity_id: climate.bedroom
            data:
              hvac_mode: "off"
      - conditions:
          - condition: trigger
            id: closed
          - condition: template
            value_template: "{{ 'scene.bedroom_heat_before_window' in states.scene | map(attribute='entity_id') | list }}"
        sequence:
          - action: scene.turn_on
            target:
              entity_id: scene.bedroom_heat_before_window
          - action: scene.delete
            target:
              entity_id: scene.bedroom_heat_before_window

A few things in there earned their place the hard way.

The for: on both triggers is the whole debounce. Home Assistant only fires the trigger if the state holds for that long, so a window that opens and shuts inside two minutes never pauses anything.

The “not already off” check stops the automation from snapshotting a climate entity that was already off. Without it, a window opened on a mild day would save “off,” and the restore could later switch off heat someone turned on in the meantime.

The scene existence check matters because a freshly created scene reports its state as unknown until it has been activated once, so testing the state would block every restore. Checking that the entity exists is what you actually want: no scene means the automation never paused anything, so there is nothing to put back.

scene.create with snapshot_entities captures the real HVAC mode, target temperature, and fan mode at that moment. That is what makes the restore correct even if your schedule changed the setpoint an hour ago. Deleting the scene afterward means a stray close event later cannot restore stale settings.

mode: restart handles the messy case where the window bounces open and closed while a delay is running. Each new trigger cancels the old run.

Rooms with more than one window

The living room has three windows and one thermostat. I did not want three automations fighting over it, so I made a group helper. In Settings, Helpers, add a Binary sensor group, pick all three contact sensors, and leave “All entities” off. The group is on if any window is open and only goes off when every window is shut.

Point the automation at the group instead of a single sensor and everything above works unchanged. This is also the right way to handle a room with a window and an exterior door, like a mudroom: add the door sensor to the same group, but give the room a longer open delay so a kid hauling in groceries does not pause anything.

For whole house systems, the logic is the same at a bigger scale. If you have one central thermostat, make a group of every window in the house and use a longer delay, around five minutes. One open window in a far bedroom should not shut off heat for the entire house during a quick airing, but a window left open all afternoon should.

Heat pumps, radiators, and thermostats behave differently

The automation is the same for every climate entity, but what “pause” should mean is not.

Mini splits and heat pumps. I turn these fully off. Dropping the setpoint to 50°F sounds gentler, but several units I have tested ramp the compressor hard when the setpoint jumps back up twenty degrees, which is exactly the inefficient behavior a heat pump is supposed to avoid. Off, then restore to the old setpoint, gives a calmer recovery.

Radiator valves. On Zigbee radiator valves I set a low setpoint instead of off. Some valves treat off as fully closed with no frost protection, and a bedroom with a window open all night in January next to a closed radiator is how pipes freeze. A 45°F to 50°F floor is safer.

Central thermostats. Ecobee, Nest, and Honeywell thermostats through their Home Assistant integrations accept hvac_mode: "off" fine. The one catch is cloud integrations that rate limit; if your thermostat only talks through a cloud API, keep the delays long so you are not sending a burst of commands.

Testing it without freezing the family

I test every new room with the heat already off for the season, or on a mild afternoon:

  1. Open the Developer Tools, States page and watch the contact sensor and the climate entity side by side.
  2. Open the window and start a timer. At two minutes, the climate entity should switch to off, and a new scene. entity should appear.
  3. Close the window. One minute later the climate entity should return to its previous mode and setpoint, and the scene should disappear.
  4. Open the automation trace (the three dot menu, Traces). It shows which branch ran and why, which is the fastest way to spot a typo in an entity id.

If the sensor never changes state, the problem is the mesh, not the automation. Sleepy sensors on a weak mesh can miss reports entirely. My Zigbee battery sensor reliability guide covers the usual culprits, and a Zigbee plug acting as a router near the problem window fixes most of them.

What it saved me

I cannot give you a precise number, because the winter weather is never the same twice. What I can say is that the bedroom that read 58°F at bedtime no longer does, and Home Assistant’s logbook shows the heat paused in that room 41 times over the first six weeks, mostly for between five and forty minutes. Those were all hours the heat would otherwise have spent warming the yard. The kids have not noticed anything, which is the point.

It also pairs well with a sensor in every room. If you already have temperature sensors in each room, you can add a notification when a window has been open for thirty minutes and the room has dropped below 60°F, which catches the window someone forgot before bed.

The Bottom Line

Open window detection built into thermostats is a guess. A Zigbee contact sensor is a fact. Put a SONOFF SNZB-04P (code JPK, or on Amazon) on the windows people actually open, write one automation per room with a debounce on both sides and a scene snapshot in the middle, and use a binary sensor group for rooms with several windows. It costs a few sensors and an hour, it runs entirely locally, and it is the cheapest heating upgrade I have made this year.

Frequently Asked Questions

How do I turn off the heat when a window is open in Home Assistant?+
Put a Zigbee contact sensor on the window, then write one automation that triggers when the sensor has been open for a few minutes. Save the thermostat's current mode and setpoint to a scene, set the climate entity to off, and restore the scene when the window has been closed for a minute. The delay is what keeps a quick airing out from cycling your heating.
Should I use the thermostat's built in open window detection instead?+
Use it as a backup, not the main signal. Valves and some thermostats guess a window is open from a sudden temperature drop, which takes minutes and misfires near drafty doors. A contact sensor reports the actual window state within a second and never guesses.
How long should the open delay be before heating pauses?+
I use two minutes for bedrooms and five minutes for the kitchen, where someone opens a window for steam and closes it again. Under a minute causes needless cycling, and over ten minutes wastes most of the heat you were trying to save.
Does this work with mini splits and heat pumps, not just radiators?+
Yes. Anything Home Assistant exposes as a climate entity works the same way, including Mitsubishi and other mini splits, Ecobee or Nest thermostats, and Zigbee radiator valves. For heat pumps I prefer turning the unit off rather than dropping the setpoint, because some units ramp hard when the setpoint jumps back up.
Which Zigbee contact sensor is best for windows?+
The SONOFF SNZB-04P is my default: small, cheap in multi packs, solid on both ZHA and Zigbee2MQTT. Aqara sensors are slimmer for tight sashes but can be picky about routers. Third Reality is a good choice if you want an easy to replace AAA battery.