Making my doorbell smart

For a while I was playing with the idea to be able to mute the doorbell, and receive a notification on my phone when somebody is at the door. I have this old fashioned doorbell that’s ringing very loud:

Old school doorbell

So I ordered some extra Wemos D1 mini ESP’s and a relay shield and started coding. Since I’ve discovered ESPHome, I intended to use this as number 1 choice before coding manually 🙂

Wemos D1 mini, headers and a relay shield

For the test setup I used a breadboard to figure out which pins to use and how the code response to it.

Test setup: a wire for input and a led for the output

I’m using esphome for communication between the doorbell and homeassistant. In my design I wanted the doorbell to be able to work without interaction with homeassistant. Therefore I used the homeassistant sensor to be able to mute the doorbell. As long as this boolean is not true, the doorbell will ring. So no message to homeassistant and a message back to the doorbell, no extra delay 😉

  name: deurbel
  platform: ESP8266
  board: d1_mini

  ssid: "<SSID>"
  password: "<PASSWORD>"

# Enable logging

# Enable Home Assistant API


  - platform: gpio
    name: "Deurbel Relay"
    id: relay
    internal: true
    icon: mdi:alarm-bell
      number: D1
      inverted: false
  - platform: gpio
    pin: D2
    name: "Deurbel"
    #device_class: window
#      - delayed_on: 50ms   # THIS DOES THE DEBOUNCE
      - delayed_off: 5000ms # THIS PREVENTS FROM MULTIPLE RANGS
        - if:
              binary_sensor.is_off: mute # IF MUTE DONT RING
              - switch.turn_on: relay
              - delay: 250ms
              - switch.turn_off: relay
  - platform: homeassistant
    name: "Input Boolean From Home Assistant"
    entity_id: input_boolean.mute_doorbell
    id: mute
  - platform: status
    name: "Status deurbel"

It works! Next step: assembling the Wemos and the Relay shield. The relay on the shield is connected to the D1, so that remains the same in my code. For the trigger I used the 3.3v on the D2. D2 is shorted to the ground via a resistor, and is high when pressed on the doorbell. This resister is needed to make sure that the input is only high when doorbell is pressed and is low on release.

5 antwoorden op “Making my doorbell smart”

  1. I don’t see this Relay in Hassio, is it supposed to show up as a switch I don’t see the entity id in my states. Please let me know as I want to hook this up to a camera with button so I can get image sent to my phone. Thanks for the esphome yaml I tried a lot of things on the web but yours was the only one that worked. great work!!!!

    Stan Boyd
    – platform: gpio
    name: “Deurbel Relay”
    id: relay
    internal: true
    icon: mdi:alarm-bell
    number: D1
    inverted: false

    1. Hey Stan,

      If you look at the code, you’ll see the option “internal: true”. That makes the switch an internal component. Internal components will not be exposed to the frontend (like Home Assistant). Only specifying an id without a name will implicitly set this to true. I made that choice on purpose. There is for me no need to make the doorbell accessible via Home Assistant. If you do want to make the doorbell make sound for your purpose, then you can remove that line (or make it false, yet I haven’t played with that option myself).

      I’m glad I could help you out with my yaml code 🙂


  2. Do you have any wiring schematics for this? Would like to use this for my doorbell, I’m just a noob starting using ESP’s do schematics that show how to integrate this in my doorbell system would really help me.

    1. Ok, I didn’t manage to draw a sketch, I’ll will draw one and mail it to you. Yet the schematic is quite easy. It’s a Wemos D1 mini (any esp will do) and a relay shield. Note that if you use another esp, you need to find a relay fitting on that specific esp.

      There is one resistor between the sensor/doorbell-switch pin and ground (to keep it pulled to the ground). Then the 3v3 goes via the doorbell switch to this pin. If the doorbell is pressed, it pulls the pin high, otherwise it stays/goes low.

      The relay is the replacement switch for the doorbell. One wire from the doorbell transformer goes to the doorbell, the other via the relay to the doorbell.

      That’s basically it, nothing more, nothing less…

Geef een reactie

Het e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *