Frencks ESPHome Doorbell Rings when power goes off/on

I’ve made this doorbell: DIY Smart Doorbell for just $2, no soldering required » Frenck.dev
And when the power goes off/on or I unplug/plug back in, the doorbell goes off. I believe it is due to the fact that the relay is inverted, but I’ve not found an easy way to fix it.
I had tried to use Tasmota initially to do the doorbell, and it worked correctly. But for some reason with ESPHome, the system sets the relay to inverted.

Edit for wrong version of the doorbell for ESP.
The relay seems to click on and off during power on. Any way to stop it?

You can invert output function of a switch (relay) by changing switch definition from “inverted: true” to “inverted: false”.
But, i think you might have a problem here: i think that you’d have to change relay module, too (or it will be constantly energized), and that can lead to prevent ESP from booting. In this design relay is intentonally set as “high when off”, since GPIO0 (used here) prevents ESP from booting if it’s pulled low at boot. Same goes for GPIO1 and 2. Since on ESP01 only GPIO pins available are 0, 1, 2 and 3 i’d rather use GPIO3 and disable logging to UART, as GPIO3 is only pin that it’s “ok” and doesn’t require to be pulled high at boot. You generally don’t need uart output anyway…

If this will prevent relay from triggering at bootup however also depends on ESP module itself, as some pins output short signal at bootup by itself, regardless of FW installed.

Yes, so with Tasmota, the relay doesn’t trigger during boot, but with ESPHome, it does. It toggles it on and off. The GPIO is pin 0. I’ve tried to use the restore_mode always off, nope.

  - platform: gpio
    id: relay
    restore_mode: ALWAYS_OFF
    inverted: true
    name: Doorbell Chime
    pin: GPIO0

Ssieb on discord pointed out that this would probably get rid of the ring at startup. It’s working for me.

  - platform: gpio
    id: relay
    name: Doorbell Chime
    pin: 
      inverted: true
      number: GPIO0
      mode: 
        output: true
        open_drain: true

@petro Thank you. A solution I forgot I was looking for!

1 Like

THANK YOU. I’m glad you resurrected this old thread. I honestly never fixed it and would have not thought to use open_drain.

I’ll mark it as a solution if it works for you. It seems to work for me.