Here is my way to do a old dumb doorbell smart.
I tried to find if somebody had done this but none of the solutions was what I needed or wanted.
Had one Shelly 1 laying around and wanted to use that one as smart relay.
Funktions I wanted:
- Limit the time between button pushes, friends can’t irritate by pressing the button several times in a row
- No MQTT
- Notifications from Home Assistant.
- Disable chime night time
- Activate chime from phone, if I need.
I have used many guides and took inspirations from them to make my code.
My doorbell is an old one from around 1960, Friedland 752 doorbell. It is powered by a AC 230V to AVC 14V. Wanted to use all original components. Transformator, chime and button.
Parts:
Shelly 1
AC-DC Converter AC 10-28V to DC 12V, I used gyvrm a121202
Wago connectors.
OTA flashed Shelly 1 with Tasmota firmware, OTA flashed Tasmota to ESPHome, by following these guides: (Search the internet for)
Shelly 2.5: Flash ESPHome Over The Air! | Savjee.be
and
Search the internet for: GitHub - yaourdt/mgos-to-tasmota: A minimal firmware for OTA (over the air) flashing Tasmota
I like to use “substitutions:” it makes it more easy to adjust delays.
Read that shelly 2.5 needes a “Prevent short circuit with “floating” pin”, I use it for Shelly 1 too…
(Search the internet for) Shelly 2.5 + ESPHome: potential fire hazard + fix | Savjee.be
Here is my yamal code
substitutions:
friendly_name: Doorbell
chime_delay: 20s # Chime reactivation delay
notify_delay: 30s # Dummy sensor ON/OFF delay, used in automations
push_delay: 0.2s # Button push release delay
push_mobile_delay: 0.5s # Mobile push release delay
esphome:
name: doorbell
platform: ESP8266
board: esp01_1m
wifi:
ssid: !secret wifi_iot_ssid
password: !secret wifi_iot_password
ap:
ssid: $friendly_name Fallback Hotspot
password: !secret wifi_iot_password
captive_portal:
web_server:
port: 80
auth:
username: !secret iot_admin
password: !secret admin_iot_password
logger:
api:
password: !secret esphome_api_password
ota:
password: !secret esphome_api_password
text_sensor:
- platform: wifi_info
ip_address:
name: $friendly_name IP Address
sensor:
- platform: wifi_signal
name: $friendly_name WiFi Strength
update_interval: 60s
- platform: uptime
name: $friendly_name "Uptime"
globals:
- id: chime
type: bool
restore_value: true
initial_value: 'true'
switch:
- platform: restart
name: $friendly_name Restart
- platform: gpio
id: relay
inverted: false
name: $friendly_name Chime
pin: GPIO4
internal: true
- platform: template
name: $friendly_name Push Button
id: push_button
turn_on_action:
- switch.turn_on: relay
- delay: $push_mobile_delay
- switch.turn_off: relay
# Creates a "virtual" switch based on a global variable.
- platform: template
name: $friendly_name Chime Active
id: chime_active
restore_state: false
turn_on_action:
- globals.set:
id: chime
value: 'true'
turn_off_action:
- globals.set:
id: chime
value: 'false'
lambda: |-
return id(chime);
# Doorbell button push.
binary_sensor:
- platform: gpio
id: button
name: $friendly_name Button
pin: GPIO5
on_press:
# Only turn on the chime when it is active.
then:
if:
condition:
- switch.is_on: chime_active
then:
- switch.turn_on: relay
- delay: $push_delay
- switch.turn_off: relay
- switch.turn_off: chime_active
- binary_sensor.template.publish:
id: button_notify
state: ON
- delay: $chime_delay
- switch.turn_on: chime_active
- delay: $notify_delay
- binary_sensor.template.publish:
id: button_notify
state: OFF
# Dummy button for notifications/automations
- platform: template
name: $friendly_name Button Notify
id: button_notify
# Prevent short circuit with "floating" pin!
- platform: gpio
pin: GPIO16
name: "ade7953 IRQ pin"
internal: true