ESPHome based doorbell is in the store!

After some testing, making the code ready and taking some photo’s, it’s finally in my store.

Finally the doorbell is ready! After version 1.0, 1.1 and 1.2, finally version 1.3 is ready for large usage. I’ve designed the doorbell primarily for my own usage. Yet after talking to some people within the Home Assistant and ESPHome community, I noticed that there are some different doorbell systems. One uses AC, other DC. Some works on 8 volts and some on 24 volts. The buck converter can handle up to max 50 volts, and the capacitors on the power input are max 50 volt. Therefor I rate the maximum input at 30~40 volt.

How does it work?

It’s quite simple how a doorbell works. The doorbell is connected to the doorbell-transformer. One wire goes through the doorbell push button. This breaks the circuit and will only ring when the push button is pressed, that makes the circuit.

When using the ESPHome Doorbell, this is the same. Only this time the relay controls the circuit for the doorbell, and the doorbell push button controls the Wemos D1 ESP.

The onboard buck converter provides 5 volt for the Wemos D1, so no external power supply is needed.

Old/normal doorbell setup

I’m not a genius in drawing on the computer, sorry 😂

New setup with ESPHome Doorbell

I’m not a genius in drawing on the computer, sorry 😂

The ESPHome code

I’ve made two versions of code, one default and one made for a ding-dong bell, which I use. The reason for a ding-dong version I use is that I can make it ding-dong 3-times when pressed. The default version is simple on when pressed and off when released.

Default ESPHome YAML code

esphome:
  name: doorbell
  platform: ESP8266
  board: d1_mini

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password


# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

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: D1
      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_state: false
    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: D5
      mode: INPUT_PULLUP
      inverted: true
    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"

DingDong ESPHome YAML code

esphome:
  name: doorbell
  platform: ESP8266
  board: d1_mini

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password


# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

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: D1
      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_state: false
    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: D5
      mode: INPUT_PULLUP
      inverted: true
    name: "Doorbell"
    filters:
      - delayed_on: 50ms
      - delayed_off: 3000ms # prevents from re-ringing within 3 seconds
    on_press:
      then:
        if:
          condition:
            - switch.is_on: chime_active
          then:
            - switch.turn_on: relay
            - delay: 400ms
            - switch.turn_off: relay
            - delay: 400ms
            - switch.turn_on: relay
            - delay: 400ms
            - switch.turn_off: relay
            - delay: 400ms
            - switch.turn_on: relay
            - delay: 400ms
            - switch.turn_off: relay            

  - platform: status
    name: "Status Doorbell"

Precompiled version of ESPHome Doorbell

8 comments

  1. Igor

    Hi,

    Thinking about buying the doorbell. What time do you expect to have them ready if I order today?

    Thanks!
    Igor

    1. Marcel

      All orders are shipped same day if possible, otherwise next business day.

      Yet I didn’t expected to sell that much on one day, so I’m out of relays. I expect them within about 10 days. When I get them, I can send them immediately.

      So depending on your country within about two weeks (for now).

      1. Igor

        Cool, just wanted to make sure you will get them for sure (you never know with China orders…could take months)?

        1. Marcel

          Nah, most components I get from Farnell, only some I get from Ali (10 days shipping). And If I’m running out of stock, and I know it takes months to resupply, I won’t let people order them (no backorder possible 😉 )

      2. Igor

        Another quick question…I’m on a roll 😀
        I’m measuring around 3V on the doorbell itself when the button is not pressed obviously.
        Is that enough power to power up the ESP?

    1. Marcel

      Yes and no… The Wemos is needed. If the Wemos dies, the doorbell won’t work. If the network of home-assistant goes down, than it still works. I hope that answers your question?

      I still use the same Wemos since the very first model in February 2019, so over 2 years now. Those things won’t break quickly, as long they used properly 😉

Leave a Reply

Your email address will not be published. Required fields are marked *