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.
substitutions:
name: "smoke-alarm"
friendly_name: Smoke Alarm
esphome:
name: ${name}
friendly_name: ${friendly_name}
name_add_mac_suffix: false
project:
name: esphome.web
version: '1.0'
esp8266:
board: esp01_1m
# Enable logging
logger:
# Enable Home Assistant API
api:
# Allow Over-The-Air updates
ota:
# Allow provisioning Wi-Fi via serial
improv_serial:
wifi:
# 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.
captive_portal:
binary_sensor:
- platform: gpio
name: “Studio Smoke Alarm"
id: studio_smoke_alarm
device_class: power
pin:
number: GPIO14
inverted: true
mode:
input: true
pullup: True
filters:
- delayed_on: 10ms
- delayed_off: 1000ms