ESPHome smart doorbell chimes when Home Assistant unavailable

Any idea how to suppress spontaneous chimes from the doorbell when Home Assistant is down?

Several years ago I implemented Frenck’s ESPHome smart doorbell. It was exactly what I’d been hoping to do with the original wired doorbell in our home, and is simply brilliant! Love it.

I run Home Assistant on an Ubuntu server that hosts multiple services, and a couple times a month I take the server down to apply updates to everything. About a year or two ago - well after initial implementation - it became that the doorbell will spontaneously chime every 10 minutes or so during the period that Home Assistant is down. So I suspect something changed in ESPHome.

I’ve tried temporarily disabling the chime in Home Assistant, and directly in the ESPHome console on the doorbell too, but it failed to prevent the spontaneous chimes. I’ve looked through the doorbell yaml code and see nothing related to HA unavailability that I could adjust.

Next month I plan to upgrade the hardware that hosts Home Assistant, which will take it down for most of a day. A day of constant doorbell chimes.

I chose to power the doorbell’s smarts from the doorbell’s own wiring, so it’s not as simple as unplugging a repurposed phone charger – it’s either mess with the house wiring, or turn off the electrical circuit the doorbell is on, neither of which is great.

Might you have any suggestion for a change that could be made to the code, or something, to help eliminate this issue?
Or, can you point me to where I should open a ticket with ESPHome?

Thanks.

It’s probably restarting ESPHome because of HA API timeouts, then the chime triggers because of the restart.

Look at adding reboot_timeout: 0 to the api section:

Knowing some kind of details aboit your hardware, your yaml, esp logs, etc are things you need to provide. The gpio you are using for the relay is turning On and Off triggering the bell each time it restarts. Disabling the reboot_timeout doesnt actually fix anything and will cause its own problems.

Thanks for the responses, sorry for my tardy reply, I’m currently away from home (for another week yet), and have limited access.

I pretty much followed Frenck’s DIY build instructions, so used the recommended ESP-01S and relay module board hardware.

The yaml is below, barely changed from Frenck’s instructions; AFAIA the only tweaks were to:

  • provide a static IP address rather than use DHCP
  • provision api and ota passphrases
  • change the restore_state from “false” to “restore_default_off” when ‘false’ became deprecated

I don’t believe the restore_state change was coincident with when the spontaneous chimes began.

There do not seem to be any esp logs. I don’t leave the ESPHome addon running as it doesn’t seem necessary, but starting it up today returned nothing even after several minutes.

Before starting this thread, I had found the posting ESPHome Doorbell Rings when power goes off/on. Didn’t think it relevant initially, but perhaps it is related?

---
esphome:
  name: doorbell
  platform: ESP8266
  board: esp01_1m

# WiFi connection, correct these
# with values for your WiFi
wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  # Static IP
  manual_ip:
    static_ip: xx.xx.xx.xx
    gateway: xx.xx.xx.1
    subnet: 255.255.255.0
    dns1: xx.xx.xx.1

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: !secret esphome_api_key
ota:
  password: !secret esphome_ota_password

# Enable Web server
web_server:
  port: 80

# Sync time with Home Assistant
time:
  - platform: homeassistant
    id: homeassistant_time

# Text sensors with general information
text_sensor:
  # Expose ESPHome version as sensor
  - platform: version
    name: Doorbell ESPHome Version
  # Expose WiFi information as sensors
  - platform: wifi_info
    ip_address:
      name: Doorbell IP
    ssid:
      name: Doorbell SSID
    bssid:
      name: Doorbell BSSID

# Sensors with general information
sensor:
  # Uptime sensor
  - platform: uptime
    name: Doorbell Uptime

  # WiFi Signal sensor
  - platform: wifi_signal
    name: Doorbell WiFi Signal
    update_interval: 60s

# Global to store the on/off state of the chime
globals:
  - id: chime
    type: bool
    restore_value: true
    initial_value: 'true'

# Exposed switches
switch:
  # Switch to restart the doorbell
  - platform: restart
    name: Doorbell Restart

  # Switch to turn on/off the chime
  - platform: gpio
    id: relay
    inverted: true
    name: Doorbell Chime
    pin: GPIO0

  # Switch to turn on/off chime when
  # doorbell button is pushed
  #
  # It creates a "virtual" switch based
  # on a global variable
  - platform: template
    name: Doorbell Chime Active
    id: chime_active
    restore_state: restore_default_off
    turn_on_action:
      - globals.set:
          id: chime
          value: 'true'
    turn_off_action:
      - globals.set:
          id: chime
          value: 'false'
    lambda: |-
      return id(chime);

# Binary sensor representing the
# Doorbell button push
binary_sensor:
  - platform: gpio
    id: button
    name: Doorbell Button
    pin:
      # Connected to GPIO on the ESP-01S
      number: GPIO2
      mode: INPUT_PULLUP
      inverted: true
    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 off the chime
      - switch.turn_off: relay

Thanks.

Since you have the output inverted it means that relay is actively pulled (/coil energized) when esp in on.

When it loses connection to home assistant it will restart. This is some software/chip related issue that it must be restarted to reliable be able to reconnect.

Then during boot the pin state goes to default value and once esp is started the code in it will set the relay to desired state, doorbell stops chiming.

The other post had extra parameter given for the relay. I dont know if all pins support that. Test it out and check also that you are using the same pin, if it doesnt work.

Another solution would be to use change over contact so that you can keep the relay coil unenergized and just connect the chiming to normally open or closed pins how ever needed.

Edit: some pins are high and some are low during boot. And some need to be in specific state or esp might not boot.