Frequent disconnections esphome esp8266

Few times in day esp8266 becomes unavailable and reconnect between 5min-22min.

Why it gets disconnected?
Please help

Hi, maybe change “discount” in title to disconnect. No it seems like a commercial :wink:

Can you show your yaml for the device? For instance, if you use mqtt but also have api in there, the api might reboot every 15 mins because it is not connected. How stable is the wifi? That too can cause connection loss and reboots. You might also want to take a look at the logs to see if there’s anything funny going on.

1 Like

Here is my garage-switchboard.yaml for generic ESP-12E shown below
image

esphome:
  name: "garage-switchboard"
  platform: ESP8266
  board: nodemcuv2

# Enable logging
logger:

# Enable Home Assistant API
api:
  reboot_timeout: 180s
  # reboot esp if disconnected to home assistant more than 180s
  encryption:
    key: "key-of-some-kind"

web_server:
  port: 80


ota:
  - platform: esphome
    id: my_ota2
    password: "key-of-some-kind"

wifi:
  #multi-network
  networks:
  - ssid: mi-fi
    password: key-of-some-kind
  - ssid: GF
    password: key-of-some-kind
  - ssid: Home-WiFi 
    password: key-of-some-kind

  # assign manual ip
  manual_ip:
    static_ip: 192.168.29.212
    gateway: 192.168.29.1
    subnet: 255.255.255.0
    dns1: 192.168.29.1
    dns2: 8.8.8.8

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Garage-Switchboard"
    password: "key-of-some-kind"

status_led:
  pin: GPIO2

switch:
  - platform: gpio
    name: "1hp-Pump"
    pin: GPIO4
    inverted: true
  - platform: gpio
    name: "12/18/24V Adapter"
    pin: GPIO5
    inverted: true
  - platform: gpio
    name: "Auxilary Socket"
    pin: GPIO13
    inverted: true
  - platform: gpio
    name: "Staircase Light - Ground Floor"
    pin: GPIO12
    inverted: true

Here is HA logbook

Appart form these, I have 2 router haveing same wi-fi AP, called mi-fi for ground-floor and 1st-floor

Last time it was reported as wifi-strength was -40dB

after wake from limbo at 3:20am 27.10.2024 ESP log file

INFO ESPHome 2024.9.2
INFO Reading configuration /config/garage-switchboard.yaml...
INFO Starting log output from 192.168.29.212 using esphome API
INFO Successfully connected to garage-switchboard @ 192.168.29.212 in 0.007s
INFO Successful handshake with garage-switchboard @ 192.168.29.212 in 2.481s
[21:49:19][I][app:100]: ESPHome version 2024.9.2 compiled on Oct 20 2024, 20:27:38
[21:49:20][C][status_led:019]: Status LED:
[21:49:20][C][status_led:020]:   Pin: GPIO2
[21:49:20][C][wifi:600]: WiFi:
[21:49:20][C][wifi:428]:   Local MAC: xx:xx:FB:CF:yy:zz
[21:49:20][C][wifi:433]:   SSID: [redacted]
[21:49:20][C][wifi:436]:   IP Address: 192.168.29.212
[21:49:20][C][wifi:439]:   BSSID: [redacted]
[21:49:20][C][wifi:441]:   Hostname: 'garage-switchboard'
[21:49:20][C][wifi:443]:   Signal strength: -44 dB ▂▄▆█
[21:49:20][C][wifi:447]:   Channel: 11
[21:49:20][C][wifi:448]:   Subnet: 255.255.255.0
[21:49:20][C][wifi:449]:   Gateway: 192.168.29.1
[21:49:20][C][wifi:450]:   DNS1: 192.168.29.1
[21:49:20][C][wifi:451]:   DNS2: 8.8.8.8
[21:49:20][C][logger:185]: Logger:
[21:49:20][C][logger:186]:   Level: DEBUG
[21:49:20][C][logger:188]:   Log Baud Rate: 115200
[21:49:20][C][logger:189]:   Hardware UART: UART0
[21:49:20][C][switch.gpio:068]: GPIO Switch '1hp-Pump'
[21:49:20][C][switch.gpio:076]:   Inverted: YES
[21:49:20][C][switch.gpio:090]:   Restore Mode: always OFF
[21:49:20][C][switch.gpio:031]:   Pin: GPIO4
[21:49:20][C][switch.gpio:068]: GPIO Switch '12/18/24V Adapter'
[21:49:20][C][switch.gpio:076]:   Inverted: YES
[21:49:20][C][switch.gpio:090]:   Restore Mode: always OFF
[21:49:20][C][switch.gpio:031]:   Pin: GPIO5
[21:49:20][C][switch.gpio:068]: GPIO Switch 'Auxilary Socket'
[21:49:20][C][switch.gpio:076]:   Inverted: YES
[21:49:20][C][switch.gpio:090]:   Restore Mode: always OFF
[21:49:20][C][switch.gpio:031]:   Pin: GPIO13
[21:49:20][C][switch.gpio:068]: GPIO Switch 'Staircase Light - Ground Floor'
[21:49:20][C][switch.gpio:076]:   Inverted: YES
[21:49:20][C][switch.gpio:090]:   Restore Mode: always OFF
[21:49:20][C][switch.gpio:031]:   Pin: GPIO12
[21:49:20][C][web_server:145]: Web Server:
[21:49:20][C][web_server:146]:   Address: 192.168.29.212:80
[21:49:20][C][mdns:116]: mDNS:
[21:49:20][C][mdns:117]:   Hostname: garage-switchboard
[21:49:20][C][esphome.ota:073]: Over-The-Air updates:
[21:49:20][C][esphome.ota:074]:   Address: 192.168.29.212:xxxx
[21:49:20][C][esphome.ota:075]:   Version: 2
[21:49:20][C][esphome.ota:078]:   Password configured
[21:49:20][C][safe_mode:018]: Safe Mode:
[21:49:20][C][safe_mode:019]:   Boot considered successful after 60 seconds
[21:49:20][C][safe_mode:021]:   Invoke after 10 boot attempts
[21:49:20][C][safe_mode:022]:   Remain in safe mode for 300 seconds
[21:49:20][C][api:139]: API Server:
[21:49:20][C][api:140]:   Address: 192.168.29.212:6053
[21:49:20][C][api:142]:   Using noise encryption: YES
[21:49:34][I][safe_mode:041]: Boot seems successful; resetting boot loop counter

Well the log seems ok. Capturing when it disconnects would be useful.

You had 3 other devices go unavailable at around the same time based on your first screenshot.

Are you sure this is an ESP issue and not something else? Are all those other devices using WiFi?