Issue:
After a inconsistent amount of time (1-2 days) the ESPHome devices become unavailable in HA, but devices are still reachable via direct URL
Background:
I have a few Sonoff S26 (UK plugs) that have been flashed with ESPHome.
Just before xmas I moved to a new ISP (BT > Sky) which is where my problems started. At one point I thought this might be a mDNS issue so updated the devices to use static addressing but didn’t fix it. Strangely another day I changed the DNS lease length from 2 days to 1 hour (as per my BT Hub) and immediately the ESP devices came back in HA (but issue returned soon). Restarting the Sky router fixes the issue for a while, but it comes back…
When this happens I can reach the devices via its IP in a browser, so its still connected to the network ok, its just unavailable in HA.
An example of the log (via IP) is as follows:-
16:39:55 [D] [api:103] Accepted 192.168.0.63
16:39:55 [W] [component:237] Component api took a long time for an operation (290 ms).
16:39:55 [W] [component:238] Components should block for at most 30 ms.
16:40:53 [W] [api.connection:130] didn't respond to ping request in time. Disconnecting...
I’m not sure how the HA integration works, the above logs implies the HA integration maybe polls the device but I don’t know which part is not responding - Is it the server to the device or other way around?
If I ping the ESPHome device from HA docker, it responds, implying there aren’t any obvious networks issues between the devices.
But additionally when using the ESPHome docker to access the devices (although they show as online) i get the following:-
INFO ESPHome 2024.12.2
INFO Reading configuration /config/sonoffplug1.yaml...
INFO Starting log output from 192.168.0.121 using esphome API
INFO Successfully connected to sonoffplug1 @ 192.168.0.121 in 0.003s
WARNING Can't connect to ESPHome API for sonoffplug1 @ 192.168.0.121: Handshake timed out after 30.0s (TimeoutAPIError)
INFO Trying to connect to sonoffplug1 @ 192.168.0.121 in the background
WARNING sonoffplug1 @ 192.168.0.121: Connection error occurred: sonoffplug1 @ 192.168.0.121: Connection lost
INFO Successfully connected to sonoffplug1 @ 192.168.0.121 in 0.003s
Any help or suggestions would be appreciated.
Setup:
Unraid Server
Home Assistant Core Docker (host)
ESPHome Docker (host)