Hello everyone,
I’m using a esp32dev based “smart” doorbell system. It works mostly as intended, but I’m having an issue where, if the doorbell is turned off, and someone hits the doorbell button, it activates the relay (essentially ringing the doorbell) and doesn’t deactivate unless the doorbell is turned back on, and the doorbell button is pressed again. Any ideas?
Here’s what I got:
#Based on https://github.com/zuidwijk/esphome-doorbell
esphome:
name: doorbell
friendly_name: Doorbell
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "##REDACTED##"
ota:
- platform: esphome
password: "##REDACTED##"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Doorbell Fallback Hotspot"
password: "##REDACTED##"
captive_portal:
improv_serial:
#esp32_improv:
# authorizer: none
#bluetooth_proxy:
# active: false
web_server:
port: 80
time:
- platform: homeassistant
id: homeassistant_time
text_sensor:
- platform: version
name: Doorbell ESPHome Version
- platform: wifi_info
ip_address:
name: Doorbell IP
ssid:
name: Doorbell SSID
bssid:
name: Doorbell BSSID
sensor:
- platform: uptime
name: Doorbell Uptime
- platform: wifi_signal
name: Doorbell WiFi Signal
update_interval: 60s
globals:
- id: chime
type: bool
restore_value: true
initial_value: 'true'
switch:
- platform: gpio
pin:
number: GPIO5
inverted: false
name: "Doorbell Relay"
id: relay
internal: true
icon: mdi:alarm-bell
- platform: restart
name: "Doorbell Restart"
- platform: template
name: Doorbell Chime Active
id: chime_active
restore_mode: disabled
turn_on_action:
- globals.set:
id: chime
value: 'true'
turn_off_action:
- globals.set:
id: chime
value: 'false'
lambda: |-
return id(chime);
binary_sensor:
- platform: gpio
pin:
number: GPIO4
mode: INPUT_PULLUP
inverted: false
name: "Doorbell"
filters:
# Small filter, to debounce the button press.
- delayed_on: 25ms
- delayed_off: 25ms
on_press:
# Only turn on the chime when it is active.
then:
if:
condition:
- switch.is_on: chime_active
then:
- switch.turn_on: relay
on_release:
# On release, turn of the chime.
- switch.turn_off: relay
- platform: status
name: "Status Doorbell"