Frenck Doorbell - Stop Chime on Internet Connection!

Hey,

I use Frenck’s doorbell project and its brilliant. Currently, i am having network issues and only thing that is working is rebooting the router every day during the night. However, when the doorbell looses connection and gains connection again it sets off the chime

is there a way to stop that happening?

Thanks in advance

esphome:
  name: doorbell
  platform: ESP8266
  board: esp01_1m

wifi:
  ssid: "xxxxxxxxxxx"
  password: "xxxxxxxxx"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Doorbell Fallback Hotspot"
    password: "xxxxxxxxxx"

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:
  password: "xxxxxxxx"

ota:
  password: "xxxxxxxxxx"

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: 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 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 of the chime.
      - switch.turn_off: relay

Fix the issue with your rooter. Likely an issue with IP address allocation.
Rebooting your router isn’t a solution, it’s a workaround and now you’re after a workaround for the workaround.
Set static ips for everything in your router.
Check your IP pool is large enough etc.

I know its not a solution but its the only thing working at the minute.

I only have the ability to set 32 static IP’s, the pool is large enough

In that case, can you set static ips in the devices instead. The common denominator with routers locking up is devices fighting over addresses.
I’m not sure how frencks bell works, but I’m presuming that it exposes a binary sensor in ha?
Try changing the esphome code to send an event via the API instead and use this a trigger.

I would upgrade your router.

I had same problem bits dropping off not working bla bla

I found a old pc and put OPNsense on it only cause there a plugin for ha with a 120 gb ssd
With in 1st 12 hours wife made the comment the internet is faster with did u do.

All all my stuff work fast as no droping

Have you tried the DHCP add-on for Hass?

Your ESP may suffer from a bug in ESPHOME. I have a few ESP’s suffering from the same bug.

Try using a fixed IP in your config. If DHCP fails, the ESP still has a valid connection.
With a fixed IP DHCP lookup isn’t necessary so your ESP will boot significantly faster.
Replacing your router isn’t a bad idea either.
You could also try and use the restore mode on your ESP, to stop it from chiming at a reboot:

switch:
  - platform: gpio
    name: "Door Bell Relay"
    pin: D1
    id: door_bell_relay
    restore_mode: ALWAYS_OFF
1 Like

The main issue here is the use of GPIO0 to control the relay.

More explanation and a hardware solution can be found at: Change GPIO used by ESP01 relay module – Starter Kit

Basically the solution is to rewire the board to use GPIO3 (TX) to control the relay.
Other solutions to use capacitators and resistor as a workaround have not been working for me.