Home AssistantESPHome

Smoke and gas alarm linker

Tie independent smoke, heat, and gas detectors into one emergency mode — every siren and buzzer, lights full bright and red, a critical push, and an optional exhaust fan — with door-unlock left as an explicit opt-in.

Difficulty · IntermediateSetup · 60–120 minutesHA · current stable (blueprint)ESPHome · current stable
Get the pack · from $29Have us set it up

Some hardware links on this page are affiliate links. As an Amazon Associate I earn from qualifying purchases. We may earn a commission if you buy through them, at no extra cost to you. See the affiliate disclosure.

A detector that only screams in one room is a local beep, not a house alarm. This workflow watches smoke, heat, and gas binaries — listed Zigbee / Z-Wave alarms, or an ESPHome board with MQ-2 / MQ-7 plus a buzzer — and when any of them stays on past a short debounce it sets a single emergency helper. That latch turns every linked siren and buzzer on, slams chosen lights to full bright red, sends a critical Companion push, and can start an exhaust fan on a gas/CO trigger. Clearing the helper (or a “false alarm” action after you have checked) stops the outputs.

Door unlocking is off unless you turn that input on. If you enable it, the pack still makes you confirm the warning: a tripped sensor must not become a remote unlock for the front door.

Entity ids are blueprint inputs. Do not publish which opening a lock covers.

Safety note

DIY MQ-2 / MQ-7 boards are not certified life-safety devices. They drift, they poison, they false-trigger on solvent and cooking, and they go silent when the ESP32 loses Wi-Fi. Use them only as a supplement. Keep listed, battery-backed smoke and CO alarms that work with Home Assistant offline. This pack links what HA can see; it does not replace a listed alarm, a monitored service, or a fire-department call.

What problem it solves

You want one detector in a hallway to wake the rest of the house — sirens, lights, phones — without buying a proprietary interlink hub, and without an automation that unlocks doors unless you deliberately ask for that.

How it works

  1. Any trigger — smoke, heat, or gas/CO binary goes on and stays on for the debounce (pack default a couple of seconds so a self-test blip can be filtered). The pack records a generic source label (area or friendly name you typed — not a floor plan).
  2. Emergency latch — input_boolean.emergency turns on. Helpers survive a restart; a wait_for_trigger variable does not. While the latch is on, a restart still re-applies sirens and lights.
  3. Outputs — turn on every siren / switch / ESPHome buzzer in the list; set lights to 100% and a red RGB (or just 100% for white-only bulbs); Companion critical / alarm_stream push naming the source label.
  4. Gas branch — if the triggering entity is in the gas/CO list, optionally switch.turn_on an exhaust / vent relay. The idea is the same shape as a “bad air → move air” automation: run ventilation while the hazard is present, stop it when you clear the latch. That ventilation pattern is credited below; this pack uses it for gas/CO, not as a CO₂ comfort loop.
  5. Unlock (opt-in) — default off. If you enable the unlock input, the pack runs lock.unlock on the locks you listed and writes a persistent warning card. Leave it off unless you have a documented reason; a cheap sensor plus an unlock action is an open-door bug, not a fire feature.
  6. Clear — “false alarm” notify action, dashboard button, or all trigger binaries off for the clear debounce. Latch off → sirens off, lights restored or left on (pack input), fan off, locks not re-locked automatically (you decide).

A short optional pre-alert (phone only, no sirens) can sit in front of the latch so burnt toast does not evacuate the house. It is a convenience, not a substitute for walking over.

Hardware notes

  • Listed alarms. Prefer Zigbee / Z-Wave smoke and heat units that expose device_class: smoke (or heat) and a controllable siren. They must still sound locally if HA is down.
  • ESPHome MQ board. Analog MQ-2 (smoke / LPG) and MQ-7 (CO) into ADC pins, plus a GPIO buzzer. Warm-up times are long; threshold in substitutions after you watch a clean-air baseline. Supplement only — see the safety note.
  • Lights. RGB bulbs or a group you are willing to turn red and bright. Do not point this at a fixture you cannot override from a wall switch during an evacuation.
  • Fan relay. Any HA switch on an exhaust or vent. Not a substitute for opening a door yourself if you can do that safely.
  • Locks. Only if you accept the opt-in risk. Test unlock on a bench lock, never by publishing which door it is.

Snippet

The pack ships a blueprint plus an optional ESPHome fragment. Inputs replace real entity ids:

trigger:
  - platform: state
    entity_id: !input smoke_sensors
    to: "on"
    for:
      seconds: !input trigger_debounce
    id: smoke
  - platform: state
    entity_id: !input gas_sensors
    to: "on"
    for:
      seconds: !input trigger_debounce
    id: gas
action:
  - service: input_boolean.turn_on
    target:
      entity_id: !input emergency_helper
  - service: switch.turn_on
    target:
      entity_id: !input sirens
  - service: light.turn_on
    target:
      entity_id: !input emergency_lights
    data:
      brightness_pct: 100
      rgb_color: [255, 0, 0]
  - service: notify.notify
    data:
      title: "Emergency — check the source"
      data:
        push:
          interruption-level: critical
        channel: alarm_stream
  - if:
      - condition: trigger
        id: gas
    then:
      - service: switch.turn_on
        target:
          entity_id: !input exhaust_fan
  # unlock stays behind an opt-in condition: full blueprint in the pack

Optional ESPHome buzzer node (the threshold is a substitution; Wi-Fi stays in secrets.yaml):

substitutions:
  # MQ-2 alarm voltage. Set it after you watch a clean-air baseline.
  mq2_alarm_v: "1.6"

output:
  - platform: gpio
    pin: GPIO25
    id: buzzer_out

switch:
  - platform: output
    name: Buzzer
    id: buzzer
    output: buzzer_out

sensor:
  - platform: adc
    pin: GPIO34
    name: MQ-2 voltage
    id: mq2_v
    attenuation: 12db
    update_interval: 2s
    unit_of_measurement: V

binary_sensor:
  - platform: template
    name: Gas detected
    id: gas_detected
    device_class: gas
    lambda: return id(mq2_v).state > ${mq2_alarm_v};
    filters:
      - delayed_on: 5s
      - delayed_off: 30s
    on_press:
      - switch.turn_on: buzzer
    on_release:
      - switch.turn_off: buzzer
# MQ-7 (CO) channel, Wi-Fi, and API: full YAML in the pack

Setup outline

  1. Confirm every listed alarm already sounds on its own and shows a binary in Developer Tools.
  2. Create input_boolean.emergency (and the optional source-text helper). Leave the unlock input empty / off.
  3. Import the blueprint. Fill smoke / heat / gas lists, sirens, lights, notify, optional fan. Save.
  4. Bench-test with a listed alarm’s test button or a helper you flip: latch on → sirens + red lights + one critical push; clear → outputs stop. Only then consider the fan. Do not test unlock on a real entry lock until you have read the warning and decided you want it.

Troubleshooting

  • One detector screams, the rest stay quiet. Those units expose smoke but not a siren entity, or the siren list is empty. Linking cannot invent a speaker; add a separate indoor siren switch or an ESPHome buzzer.
  • Toast sets off emergency. Debounce is too short, or an MQ board is aimed at a cooktop. Raise debounce, move the MQ board, and keep listed alarms as the authority.
  • Latch on, lights never change. The light entity rejects rgb_color. Drop color and set brightness only, or use a group that is actually RGB.
  • Fan never starts. You triggered a smoke entity, not a gas/CO entity. The exhaust branch is gas-only on purpose.
  • Door unlocked when you did not want it. The unlock input is on. Turn it off; this pack will not lock the door back for you.

Credits

Based on the community blueprint Smart Smoke System — the ultimate fire alarm linker. Optional gas/CO exhaust follows the “bad air → run ventilation” idea in Open window on high CO₂ levels. This write-up is an original overview of a latch-and-link emergency mode; it is not a copy of those posts and it is not a listed fire-alarm system.

Changelog

v1.0 · Oct 17, 2026: First publish.