Smart Home Assistant

Home Assistant CO2 Ventilation: Automate Fans and Alerts (UK)

SepehrBy Sepehr· 23 November 2026· Updated 23 November 2026· 7 min read
✓ Independent — no paid placements✓ UK-tested in real homes✓ Cited sources
Stylised red line graph climbing over dark navy panels with circles representing air

Key takeaways

  • A CO2 ventilation automation needs one sensor, two thresholds and about 30 minutes, with a nudge near 1,000 ppm and a fan above 1,500 ppm.
  • Switch the fan on above 1,500 ppm and off below 900 ppm so the wide gap stops it flapping on and off.
  • The HSE treats CO2 consistently above 1,500 ppm in an occupied room as a sign of poor ventilation, though not as a safety limit.
  • Keep the sensor over 50 cm from people, because exhaled breath next to it gives misleadingly high readings.
  • A numeric state trigger fires only when crossing the threshold, so it will not repeat while CO2 stays high.
On this page[tap to expand]

A Home Assistant CO2 ventilation automation reads a CO2 sensor and acts when the air gets stale: a phone nudge to open a window at moderate levels, and an extractor fan or ventilation unit switched on when levels stay high. It takes about 30 minutes and one sensor.

The common mistake is wiring the fan straight to a single threshold, which makes it flap on and off every few minutes. This guide uses two thresholds, a delay and a gap between on and off, so the automation behaves like a thermostat rather than a strobe light.

What do you need before you start?

  • A CO2 sensor in Home Assistant: any NDIR sensor that reports parts per million (ppm) as a numeric sensor entity, such as an Aranet4, Airthings, Qingping or an ESPHome build with an SCD40. Our guide to the best indoor air quality monitors covers which ones suit Home Assistant.
  • Something to act on: a smart plug or relay on an extractor fan, a smart-controlled ventilation unit, or simply your phone with the Companion app for notifications.
  • Home Assistant 2024.10 or later for the current triggers: and actions: YAML syntax used below.
  • Your entity IDs: find them in Settings, Devices & services, Entities. The examples use sensor.living_room_co2 and switch.living_room_fan; swap in your own.

What CO2 level should trigger ventilation?

For most UK homes, treat readings under about 800 ppm as good, 800 to 1,500 ppm as stale, and above 1,500 ppm as poorly ventilated. The 1,500 ppm line comes from the HSE's CO2 monitor guidance, which says consistently higher readings in an occupied room point to poor ventilation. The 800 ppm band is used in UK Government and Welsh Government guidance for schools.

These numbers are a broad guide to ventilation, not a safety limit, and the HSE says as much. If a sensor never drops much below 800 ppm even after the windows have been open for 20 minutes, it is more likely out of calibration than your house being unusually airtight.

Three panels showing CO2 bands: under 800 ppm good, 800 to 1,500 stale, over 1,500 poor ventilation
The three bands this guide builds on, and the action attached to each.

Step 1: Check the sensor is reporting properly

Open Developer tools, States, and search for your CO2 entity. The state should be a plain number and the unit should be ppm. If the state is unavailable or unknown after a restart, fix that first, because a numeric trigger cannot fire on a non-number.

Place the sensor where people actually breathe: at head height in a bedroom or living room, away from windows and, per HSE advice, more than 50 cm from anyone, since exhaled breath next to the sensor inflates the reading. Let it run for a day before trusting the pattern, as many sensors self-calibrate over the first few days.

Step 2: Create a helper to switch the automation on and off

Go to Settings, Devices & services, Helpers, Create helper, Toggle, and name it CO2 ventilation enabled. This gives you a dashboard switch to pause the automation, for example when you are cooking with the windows already open or running a deliberate overnight setback.

It is optional, but it is far easier than editing YAML to disable the automation, and it will show as input_boolean.co2_ventilation_enabled.

Step 3: Build the notification automation (800 ppm)

The gentle tier tells you to open a window once the room has been stale for a while. Use a numeric state trigger with a for duration so a brief spike, such as someone walking in, does not send a message.

alias: CO2 stale air nudge
description: Notify when living room CO2 stays above 1,000 ppm
mode: single
triggers:
  - trigger: numeric_state
    entity_id: sensor.living_room_co2
    above: 1000
    for: "00:10:00"
conditions:
  - condition: state
    entity_id: input_boolean.co2_ventilation_enabled
    state: "on"
actions:
  - action: notify.mobile_app_your_phone
    data:
      title: "Stale air in the living room"
      message: "CO2 has been above 1,000 ppm for 10 minutes. Open a window for a few minutes."

The trigger fires once when the value crosses 1,000 ppm and has stayed there for ten minutes. It does not repeat while the level remains high; it only fires again after the reading has dropped below the threshold and crossed it again. Replace notify.mobile_app_your_phone with your own service name, which you can find under Developer tools, Actions. Our notifications guide covers actionable and critical notifications if you want a button on the alert.

I used 1,000 ppm rather than 800 here deliberately. Many homes sit between 800 and 1,000 for hours when occupied with the windows shut, and an alert at 800 trains you to ignore it. Start at 1,000 and lower it if you want a more insistent system.

Step 4: Build the fan automation with a gap between on and off

The firm tier switches a fan or ventilation unit on at 1,500 ppm and off again once the air has genuinely cleared. Two separate triggers with different thresholds provide the gap, which is called hysteresis, and stop the fan chattering around a single value.

alias: CO2 ventilation fan
description: Fan on above 1,500 ppm, off below 900 ppm
mode: single
triggers:
  - trigger: numeric_state
    entity_id: sensor.living_room_co2
    above: 1500
    for: "00:03:00"
    id: "high"
  - trigger: numeric_state
    entity_id: sensor.living_room_co2
    below: 900
    for: "00:05:00"
    id: "clear"
conditions:
  - condition: state
    entity_id: input_boolean.co2_ventilation_enabled
    state: "on"
actions:
  - choose:
      - conditions:
          - condition: trigger
            id: "high"
        sequence:
          - action: switch.turn_on
            target:
              entity_id: switch.living_room_fan
      - conditions:
          - condition: trigger
            id: "clear"
        sequence:
          - action: switch.turn_off
            target:
              entity_id: switch.living_room_fan

The 600 ppm gap between 1,500 and 900 matters more than the exact numbers. If your fan can only pull the room down to 1,100 ppm, the "clear" trigger will never fire, so check how low your setup actually gets and set the lower threshold a little above that floor.

If the fan is a bathroom or kitchen extractor on a fused spur, do not switch it with a cheap smart plug. Use a properly rated relay or a ventilation unit with its own smart control, and read the load rating first. Our extractor fan automation guide covers humidity-based control for the same kind of hardware.

Step 5: Add a night rule so the fan does not wake you

A fan that roars at 03:00 defeats the point of ventilating a bedroom. Add a time condition to the fan automation so it only runs at night if you want it to, or switch to a quieter alternative by sending a notification instead.

conditions:
  - condition: state
    entity_id: input_boolean.co2_ventilation_enabled
    state: "on"
  - condition: time
    after: "07:00:00"
    before: "22:30:00"

Bedrooms are where this matters most, because CO2 climbs steadily overnight with the door and window shut. If you have a low-speed or trickle mode on your ventilation unit, use that overnight rather than disabling the automation entirely. A cracked window or a trickle vent is usually the cheapest fix and needs no automation at all.

Step 6: Pause when a window is already open

If a window sensor reports open, the fan is fighting the draught and the alert is redundant. Add a condition so the automation stands down.

  - condition: state
    entity_id: binary_sensor.living_room_window
    state: "off"

This relies on a contact sensor reporting off when closed, which is the usual convention in Home Assistant. If you have not set up window sensors yet, see our window open rain alert guide for the same sensor pattern.

Step 7: Test it without waiting for the air to go stale

Open Developer tools, States, pick your CO2 sensor and edit the state to 1600, then press Set state. This only changes the value inside Home Assistant until the sensor next reports, so it is a safe way to test. Wait out the for delay and confirm the fan switches on, then set it to 800 and confirm it switches off.

Afterwards, open the automation and check its Traces tab. Each run shows which trigger fired, which conditions passed and which action ran, which is the quickest way to find out why something did or did not happen.

Why isn't my CO2 automation firing?

The sensor state is not a number: a state of unavailable or unknown never crosses a threshold. Check the device is online and the entity is not disabled.

It only fires once: a numeric state trigger fires on crossing the threshold, not while the value stays above it. If the level is already above 1,500 when you save the automation, nothing happens until it falls below and rises again.

The fan flaps on and off: your on and off thresholds are too close together, or the for delay is too short. Widen the gap and lengthen the delay.

It runs but the room never clears: the fan is too weak or recirculating air. CO2 only drops when fresh air comes in, so an extractor with no air inlet (a trickle vent or an ajar window) will struggle.

The numbers look wrong: low-cost sensors drift. Take the sensor outside for 20 minutes and run the manufacturer's calibration routine if the reading looks far too high.

What should you build next?

Once CO2 control works, pair it with humidity: a damp, stuffy room is the combination that feeds mould. Our mould risk alert and dehumidifier automation guides build on the same sensor-and-threshold approach, and you can combine all three into a single "air quality" dashboard card.

Buy the picks in this guide

Recommended for Home Automation

See all devices →

Frequently asked questions

What CO2 level should I ventilate at in a UK home?
Ventilate when CO2 stays above roughly 1,000 ppm, and act firmly above 1,500 ppm. The HSE says CO2 levels consistently higher than 1,500 ppm in an occupied room indicate poor ventilation and that action should be taken, while UK Government and Welsh Government school guidance treats readings under 800 ppm as good and 800 to 1,500 ppm as a prompt to open windows. These figures are a broad guide to how well a room is ventilated rather than a safety limit, so use them to decide when to open a window or run a fan, not as a health threshold. A sensor in a bedroom will typically climb overnight with the door and window closed, so expect higher peaks there than in a living room, and tune your alert threshold to what is normal for each space.
Can Home Assistant turn a fan on automatically when CO2 is high?
Yes. Home Assistant can switch a fan on automatically using a numeric state trigger on your CO2 sensor, then switch it off with a second trigger at a lower value. Using two different thresholds, such as on above 1,500 ppm and off below 900 ppm, stops the fan flapping on and off around a single number. Add a short for delay of a few minutes so brief spikes are ignored. The fan needs to be controllable, so use a properly rated smart relay, a ventilation unit with smart control, or a smart plug only where the fan's load is within the plug's rating. A fan hard-wired to a fused spur should not be switched with a cheap plug, and the fan only helps if fresh air can actually enter the room.
Why does my CO2 automation only fire once?
A numeric state trigger fires when the value crosses the threshold, not continuously while it stays above it. That means the automation runs once as the reading rises past, say, 1,500 ppm and will not run again until the reading has dropped back below that number and crossed it again. If CO2 is already above the threshold when you save the automation, nothing happens at all until the next crossing. This is usually what you want, because it avoids repeated notifications, but if you need reminders while the air stays stale, add a second automation using a time pattern trigger with a condition that the sensor is still above the threshold. You can check what happened under the automation's Traces tab.

Sources

Sources verified 2026-11-23

  1. HSE — Using CO2 monitors
  2. UK Government — CO2 monitoring factsheet
  3. Welsh Government — Carbon dioxide monitors in education settings
  4. Home Assistant — Numeric state trigger
  5. Home Assistant — Automation conditions
›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