Help needed with Smoke detector to ESP home

I’ve together a very basic Home Assistant smoke alarm from an old 9v one and a D1 mini but I’m having trouble with the yaml.

I’ve simply connected a wire from the red wire on the piezo alarm through a 100k resistor to the centre pin on a 2N3904 transistor. The other 2 legs go to D5 and GND on the D1 Mini.

Everything works, and I get an alert when it goes off (with an automation in Home Assistant) but I get continuous alerts as each beep is sending another alert to home assistant. I’m sure there’s an easy way to get the ESP home to send one alert until the beeping pulses end. I just don’t know how. Can anyone please assist?

Here is my yaml.

  name: "smoke-alarm"
  friendly_name: Smoke Alarm

  name: ${name}
  friendly_name: ${friendly_name}
  name_add_mac_suffix: false
    name: esphome.web
    version: '1.0'

  board: esp01_1m

# Enable logging

# Enable Home Assistant API

# Allow Over-The-Air updates

# Allow provisioning Wi-Fi via serial

  # Set up a wifi access point
  ap: {}

# In combination with the `ap` this allows the user
# to provision wifi credentials to the device via WiFi AP.

  - platform: gpio
    name: “Studio Smoke Alarm"
    id: studio_smoke_alarm
    device_class: power
      number: GPIO14
      inverted: true
        input: true
        pullup: True
      - delayed_on: 10ms
      - delayed_off: 1000ms

1 Like

You just need to increase your delayed_off time to be slightly greater then the gap between the beeps.


Please be careful and thoughtful about safety for your use case.

Also change your smoke detectors regularly as the detection mechanism degrades over time - specially in dusty environments (e.g. workshops) the devices hardly work the advertised 10 years…

Very nice! How do you power the setup?

1 Like

At the moment a USB fits in the back of the detector. I’m considering a 12v supply with a couple of these to power both the D1 and the alarm so as to avoid flat battery pips coming as an alert and sending me into a panic.

1 Like