ESPHome "didn't respond to ping request in time. Disconnecting..."

I have an Olimex ESP32-PoE that I’ve setup on wired ethernet without Wifi. It works fine with ESPHome dashboard and in home assistant the sensor appears and works. However, it is disconnecting every couple minutes because it doesn’t receive a response to the ping request from Home Assistant. In the ESPHome device’s logs I see the following relevant lines:

[12:29:06][W][api.connection:117]: Home Assistant 2023.8.4 (10.1.111.20) didn't respond to ping request in time. Disconnecting...
[12:29:06][D][api:102]: Accepted 10.1.111.20
[12:29:06][W][component:204]: Component api took a long time for an operation (0.06 s).
[12:29:06][W][component:205]: Components should block for at most 20-30ms.
[12:29:06][D][api.connection:1031]: Home Assistant 2023.8.4 (10.1.111.20): Connected successfully
[12:31:36][W][api.connection:117]: Home Assistant 2023.8.4 (10.1.111.20) didn't respond to ping request in time. Disconnecting...
[12:31:36][D][api:102]: Accepted 10.1.111.20
[12:31:36][W][component:204]: Component api took a long time for an operation (0.05 s).
[12:31:36][W][component:205]: Components should block for at most 20-30ms.
[12:31:36][D][api.connection:1031]: Home Assistant 2023.8.4 (10.1.111.20): Connected successfully
[12:34:06][W][api.connection:117]: Home Assistant 2023.8.4 (10.1.111.20) didn't respond to ping request in time. Disconnecting...
[12:34:06][D][api:102]: Accepted 10.1.111.20
[12:34:06][W][component:204]: Component api took a long time for an operation (0.06 s).
[12:34:06][W][component:205]: Components should block for at most 20-30ms.
[12:34:06][D][api.connection:1031]: Home Assistant 2023.8.4 (10.1.111.20): Connected successfully
...

Home Assistant’s logs only show this:

Logger: aioesphomeapi.connection
Source: runner.py:179
First occurred: August 28, 2023 at 11:26:36 AM (105 occurrences)
Last logged: 2:07:25 PM

adu @ 10.1.111.24: Connection error occurred: adu @ 10.1.111.24: EOF received
adu @ 10.1.111.24: Connection error occurred: Ping response not received after 90.0 seconds

I have found the disconnect log code coming from ESPHome’s device server code here.

So it appears Home Assistant just seems to think it disconnected. Why is Home Assistant not responding to the ping from the device?

Home Assistant Version: 2023.8.4
ESPHome Device Version: ESPHome version 2023.7.1 compiled on Aug 29 2023, 11:58:01

ESPHome Config:

esphome:
  name: adu

esp32:
  board: esp32-poe
  framework:
    #type: arduino
    type: esp-idf

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: !secret api_encryption_key

ota:
  password: !secret ota_password

ethernet:
  type: LAN8720
  mdc_pin: GPIO23
  mdio_pin: GPIO18
  clk_mode: GPIO17_OUT
  phy_addr: 0
  power_pin: GPIO12
  # without `manual_ip` it uses DHCP

# use a pin to listen to a door/window sensor:
#   see https://esphome.io/components/binary_sensor/gpio
#   and https://esphome.io/guides/configuration-types#pin-schema
binary_sensor:
  - platform: gpio
    name: "Test Window"
    pin:
      number: 2
      # for window device_class "On means open, Off means closed. Do not invert magnetic switch
      #inverted: true
      mode:
        input: true
        pullup: true

    filters:
      # the switch ocassionally becomes unavailable and turns off momentarily. lets try to absorb that with delays:
      - delayed_on_off: 200ms
    # for these Home Assistant-related variables see https://esphome.io/components/sensor/#base-sensor-configuration
    device_class: window

Any luck of you set a static_ip: both in your config and on your router? Just a stab in the dark.

Thank you for the reply. I kinda doubt that is related - as it is statically assigned address from the DHCP server but I’ll give it a go…

I tried with static_ip and still encountering the same issue. I also noticed I was on an old version of ESPhome and upgraded from 2023.7.1_1 → 2023.8.2 and still have the same issue: [10:51:21][W][api.connection:117]: Home Assistant 2023.8.4 (10.1.111.20) didn't respond to ping request in time. Disconnecting... - every couple minutes.

A full log after update:

INFO Waiting for result...
INFO OTA successful
INFO Successfully uploaded program.
INFO Starting log output from 10.1.111.24 using esphome API
INFO Successfully connected to 10.1.111.24
[10:43:53][I][app:102]: ESPHome version 2023.8.2 compiled on Aug 30 2023, 10:43:28
[10:43:53][C][logger:301]: Logger:
[10:43:53][C][logger:302]:   Level: DEBUG
[10:43:53][C][logger:303]:   Log Baud Rate: 115200
[10:43:53][C][logger:305]:   Hardware UART: UART0
[10:43:53][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Test Window'
[10:43:53][C][gpio.binary_sensor:015]:   Device Class: 'window'
[10:43:53][C][gpio.binary_sensor:016]:   Pin: GPIO2
[10:43:53][C][ethernet:221]: Ethernet:
[10:43:53][C][ethernet:363]:   IP Address: 10.1.111.24
[10:43:53][C][ethernet:364]:   Hostname: 'adu'
[10:43:53][C][ethernet:365]:   Subnet: 255.255.255.0
[10:43:53][C][ethernet:366]:   Gateway: 10.1.111.1
[10:43:53][C][ethernet:372]:   DNS1: 10.1.111.1
[10:43:53][C][ethernet:373]:   DNS2: 0.0.0.0
[10:43:53][C][ethernet:397]:   MAC Address: E0:5A:1B:65:49:0B
[10:43:53][C][ethernet:402]:   Is Full Duplex: YES
[10:43:53][C][ethernet:407]:   Link Speed: 100
[10:43:53][C][ethernet:224]:   Power Pin: 12
[10:43:53][C][ethernet:226]:   MDC Pin: 23
[10:43:53][C][ethernet:227]:   MDIO Pin: 18
[10:43:53][C][ethernet:228]:   Type: LAN8720
[10:43:53][C][ethernet:229]:   PHY addr: 0
[10:43:53][C][mdns:112]: mDNS:
[10:43:53][C][mdns:113]:   Hostname: adu
[10:43:53][C][ota:093]: Over-The-Air Updates:
[10:43:53][C][ota:094]:   Address: 10.1.111.24:3232
[10:43:53][C][ota:097]:   Using Password.
[10:43:53][C][api:138]: API Server:
[10:43:53][C][api:139]:   Address: 10.1.111.24:6053
[10:43:53][C][api:141]:   Using noise encryption: YES
[10:46:21][W][api.connection:117]: Home Assistant 2023.8.4 (10.1.111.20) didn't respond to ping request in time. Disconnecting...
[10:46:21][D][api:102]: Accepted 10.1.111.20
[10:46:21][D][api.connection:1031]: Home Assistant 2023.8.4 (10.1.111.20): Connected successfully
[10:46:22][D][binary_sensor:036]: 'Test Window': Sending state ON
[10:46:24][D][binary_sensor:036]: 'Test Window': Sending state OFF
[10:48:45][I][ota:113]: Boot seems successful, resetting boot loop counter.
[10:48:45][D][esp32.preferences:114]: Saving 1 preferences to flash...
[10:48:45][D][esp32.preferences:143]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed
[10:48:51][W][api.connection:117]: Home Assistant 2023.8.4 (10.1.111.20) didn't respond to ping request in time. Disconnecting...
[10:48:51][D][api:102]: Accepted 10.1.111.20
[10:48:51][D][api.connection:1031]: Home Assistant 2023.8.4 (10.1.111.20): Connected successfully
[10:51:21][W][api.connection:117]: Home Assistant 2023.8.4 (10.1.111.20) didn't respond to ping request in time. Disconnecting...
[10:51:21][D][api:102]: Accepted 10.1.111.20
[10:51:21][D][api.connection:1031]: Home Assistant 2023.8.4 (10.1.111.20): Connected successfully
[10:53:52][W][api.connection:117]: Home Assistant 2023.8.4 (10.1.111.20) didn't respond to ping request in time. Disconnecting...
[10:53:52][D][api:102]: Accepted 10.1.111.20
[10:53:52][D][api.connection:1031]: Home Assistant 2023.8.4 (10.1.111.20): Connected successfully
[10:56:22][W][api.connection:117]: Home Assistant 2023.8.4 (10.1.111.20) didn't respond to ping request in time. Disconnecting...
[10:56:22][D][api:102]: Accepted 10.1.111.20
[10:56:22][D][api.connection:1031]: Home Assistant 2023.8.4 (10.1.111.20): Connected successfully
[10:58:52][W][api.connection:117]: Home Assistant 2023.8.4 (10.1.111.20) didn't respond to ping request in time. Disconnecting...
[10:58:52][D][api:102]: Accepted 10.1.111.20
[10:58:52][D][api.connection:1031]: Home Assistant 2023.8.4 (10.1.111.20): Connected successfully
[11:01:22][W][api.connection:117]: Home Assistant 2023.8.4 (10.1.111.20) didn't respond to ping request in time. Disconnecting...
[11:01:22][D][api:102]: Accepted 10.1.111.20
[11:01:23][D][api.connection:1031]: Home Assistant 2023.8.4 (10.1.111.20): Connected successfully

1 Like

How about if you delete the integration and readd it?

Again just another random generic debugging step you could try. I have no clue about root cause.

@Mahko_Mahko Thanks again for your attempt to help :slight_smile: I did try removing and adding the integration within home assistant, but the problem persists.

Anyone else have this working? Anyone else maybe know what I might be missing to cause these disconnects?

@activescott I have QUINLED ESP32 Ethernet. Just sharing my setup… rock solid and churning out sensor readings every second… I notice the only difference is your power_pin. Looking at ESP32 pin out I am not sure GPIO12 would be ideal at boot …double check… also change ethernet cable or test with ethernet tester… change socket on switch/ router… check settings if you have smart network switch… thats it from my knowledge…

esphome:
  name: weather
  friendly_name: Weather
  platform: ESP32
  board: mhetesp32minikit

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "donaldduck"

ota:
#  password: "mickymouse"

ethernet:
  type: LAN8720
  mdc_pin: GPIO23
  mdio_pin: GPIO18
  clk_mode: GPIO17_OUT
  phy_addr: 0
  power_pin: GPIO5

  # Optional manual IP
  manual_ip:
    static_ip: 192.168.1.30
    gateway: 192.168.1.1
    subnet: 255.255.255.0
1 Like

Thanks @JulianDH - so good to know others have it working reliably! I double checked the ethernet setup and found an example at https://github.com/esphome/bluetooth-proxies/blob/30614bb25f5cc6445675b17ca7db4b00a247ba79/olimex-esp32-poe-iso.yaml and the schematic from olimex that seem to jive. Also, I used the Esphome SDK and wrote a simple python script to monitor the board and don’t have any disconnect problem. It seems the issue is my home assistant’s ESPHome integration rather than the board.

What version of Home Assistant are you using?

HA 2023.8.4
ESPHome 2023.8.2

I have very itchy fingers.

I have over the last 18 months reinstalled both add-on and had to reinstall the dashboard(and delete all the files/ folders). Every node integration has also been deleted and reinstalled! I have been fiddling too much.

And the ESP32E has only just been installed (to replace earlier non-ESP32 node). Good to hear that you have it working. Even if not clear why?

1 Like

Sorry I wasn’t that clear - still not working. Same issue. I just confirmed that the ESPHome SDK client works with the device. Home Assistant still won’t stay connected.

Has anyone else come up with a solution? I also have this issue and updated to 2023.9 HA to try to fix. I also updated the pip to the latest 17.0.0 package and still not working with my esp device.

2 Likes

I had a recent problem with the esphome devices, they went offline, I realized it was because I asked my provider to add an extra point, they did it the wrong way and messed everything up. For the ESPxxxx to work I had to activate “Use ping for status” in addons > Esphome > Settings, they worked and started to disconnect the ESP01, the effect of installing the router wrongly duplicated the devices in the lan list. I asked them to remove it, I bought the right router to activate Mesh, I did it the right way, the devices became more stable and finally I unchecked “Use ping for status” and a nodemcu off appeared, I redid its wifi programming according to the other stable nodemcu, esp01 came back online correctly. The good thing about this whole mess was that I standardized the way of connecting the esp01 and nodemcu and both now work very well, I hope this report can help.

I’m from Brazil, I used Google Translate, HA installed on a Vitual Box VM, Ubuntu 22 operating system, duo core hardware, j1800 board, 8 ram, HD 512, Home Assistant 2023.9.3, Supervisor, 2023.09.2, Operating System 10.5, Frontend: 20230911.0 - latest

If anyone else is stuck and needs a solution, I ended up using mqtt instead of the api solution. I wouldn’t say its better than the api solution but it does work fast enough. I barely notice the usage of a broker as the speeds are really fast regardless. I do hope someone figures this api issue out though because that would be the route I would prefer to use.

1 Like

Nice, I hadn’t even considered using mqtt with esphome. I kinda gave up for a while on this as I shifted to another project, but when I get back to it I’ll give that a go.
Still convinced the problem is something with my main home assistant rather than ESPHome/devices, but I can’t figure out what it would be and I’m loathe to nuke HA and reconfigure it.

I have same issue:

Any fix for this ?

20:17:02 [D] [api:102] Accepted 192.168.8.102
20:17:02 [W] [component:214] Component api took a long time for an operation (0.29 s).
20:17:02 [W] [component:215] Components should block for at most 20-30ms.
20:17:03 [D] [api.connection:1032] Home Assistant 2023.10.3 (192.168.8.102): Connected successfully
20:17:03 [D] [api.connection:171] Home Assistant 2023.10.3 (192.168.8.102) requested disconnected
20:17:09 [D] [api:102]Accepted 192.168.8.102
20:17:09 [W] [component:214]Component api took a long time for an operation (0.29 s).
20:17:09 [W] [component:215] Components should block for at most 20-30ms.
20:17:10 [D] [api.connection:1032]Home Assistant 2023.10.3 (192.168.8.102): Connected successfully
20:17:10 [D] [api.connection:171]Home Assistant 2023.10.3 (192.168.8.102) requested disconnected
20:17:17 [D] [api:102]Accepted 192.168.8.102
20:17:17 [W] [component:214]Component api took a long time for an operation (0.29 s).
20:17:17 [W] [component:215]Components should block for at most 20-30ms.
20:17:18 [D] [api.connection:1032]Home Assistant 2023.10.3 (192.168.8.102): Connected successfully
20:17:18 [D] [api.connection:171]Home Assistant 2023.10.3 (192.168.8.102) requested disconnected
20:17:25 [D] [api:102]Accepted 192.168.8.102
20:17:25 [W] [component:214]Component api took a long time for an operation (0.29 s).
20:17:25 [W] [component:215]Components should block for at most 20-30ms.
20:17:26 [D] [api.connection:1032]Home Assistant 2023.10.3 (192.168.8.102): Connected successfully
20:17:26 [D] [api.connection:171]Home Assistant 2023.10.3 (192.168.8.102) requested disconnected
20:17:32 [D] [api:102]Accepted 192.168.8.102
20:17:32 [W] [component:214]Component api took a long time for an operation (0.29 s).
20:17:32 [W] [component:215]Components should block for at most 20-30ms.
20:17:34 [D] [api.connection:1032]Home Assistant 2023.10.3 (192.168.8.102): Connected successfully
20:17:34 [D] [api.connection:171]Home Assistant 2023.10.3 (192.168.8.102) request

My config is:

esphome:
  name: generator
  friendly_name: Generator
  platform: ESP8266
  board: esp12e

#status_led:
 # pin:
 #   number: GPIO5
  #  inverted: True
  
# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
     key: "####EDITED#####"
ota:
  password: "####EDITED#####"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  manual_ip:
    static_ip: 192.168.8.5
    gateway: 192.168.8.1
    subnet: 255.255.255.0

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

web_server:
  port: 80
  auth:
    username: admin
    password: ####EDITED#####

captive_portal:

switch:
  - platform: gpio
    pin: GPIO13
    name: "0 Solar to Gen Bat"
    id: r1

 # GENERATOR   

  - platform: gpio
    pin: GPIO12
    name: "1 Contact"
    id: r2
    on_turn_on:
    - switch.turn_off: r1  # Opreste incarcarea bateriei generatorului
    - switch.turn_on: r3   # Porneste electromotorul
    - delay: 2.5s          # Asteapta pana porneste generatorul  
    - switch.turn_off: r3  # Opreste electromotorul


  - platform: gpio
    pin: GPIO14
    name: "2 Starter"
    id: r3
  - platform: gpio
    pin: GPIO16
    name: "3 Bujii"
    id: r4

Hi @tziku . Did you try using mqtt instead of the “native API”? I haven’t yet tried it, but @TheAznShumai said it worked and I am optimistic, since the problem I went through was clearly related to that native API client on the HA side. I also used mqtt in the past with z-wave and it was always perfectly fine.

Let us know what you fine!

Please open an issue at GitHub - esphome/issues: Issue Tracker for ESPHome with logs from the ESP device as well as debug logs from HA for aioesphomeapi

You should be able to see if its a bug in the library (ie ping response not sent) since aioesphomeapi logs all data is sending

Or if the ping response is getting and the ESP is not able to process it.

I fount problem.
I look in logs and i have mac conflict , was registred with different mac.

2023-10-31 17:33:42.375 ERROR (MainThread) [homeassistant.components.esphome.manager] Unexpected device found at 192.168.8.5; expected generator with mac address 8c:aa:b5:c5:e7:1a, found generator with mac address c8:2b:96:1f:76:1e

SOLUTION: Settings → Devices & Services → ESPHome → Delete Device with problem
then add again and work with no problem.

3 Likes