Got a bit of a puzzling issue here, let me describe it:
I have a number of ESPHome devices, some ESP8266 (Sonoffs and NodeMCUs), a a couple ESP32. Every now and then Home Assistant loses connection to one of them and does not reconnect, even though the device is reachable. This is the situation I’m describing here:
A device called irrigation_pump
(a Sonoff Basic with this config) is showing unavailable for about 17h now. I’ve power-cycled it and confirmed it is accessible in the network, yet HA will not reconnect:
If I try to get the logs, you can see the device is responding just fine: (and if I run esphome dashboard .
it shows-up as online)
When I SSH into the HA SSA addon and try to ping it, you can see that the name (irrigation_pump.local
) got resolved to the right IP address and ping returns, so HA is able to “see” the device, from a networking standpoint at least:
Finally, looking at the logs in HA, the only log which has anything about this device is “Home Assistant Core”, and then only these entries:
Note the timestamps: these are from around the time the device was disconnected (yesterday), and there was none more recent, which makes me think that HA is not trying to reconnect at all.
2022-10-13 13:55:31.628 WARNING (MainThread) [aioesphomeapi.reconnect_logic] Can't connect to ESPHome API for irrigation_pump @ 192.168.6.19: Error while reading data: [Errno 104] Connection reset by peer
2022-10-13 14:02:27.265 WARNING (MainThread) [aioesphomeapi.reconnect_logic] Can't connect to ESPHome API for irrigation_pump @ 192.168.6.19: Hello timed out
2022-10-13 14:04:12.925 WARNING (MainThread) [homeassistant.components.esphome] Error getting initial data for 192.168.6.19: Connection not done for irrigation_pump @ 192.168.6.19!
2022-10-13 14:05:18.491 WARNING (MainThread) [aioesphomeapi.reconnect_logic] Can't connect to ESPHome API for irrigation_pump @ 192.168.6.19: Hello timed out
2022-10-13 14:20:10.400 WARNING (MainThread) [aioesphomeapi.reconnect_logic] Can't connect to ESPHome API for irrigation_pump @ 192.168.6.19: Hello timed out
2022-10-13 14:24:14.467 WARNING (MainThread) [aioesphomeapi.reconnect_logic] Can't connect to ESPHome API for irrigation_pump @ 192.168.6.19: Error while reading data: [Errno 104] Connection reset by peer
2022-10-13 14:25:23.058 WARNING (MainThread) [aioesphomeapi.reconnect_logic] Can't connect to ESPHome API for irrigation_pump @ 192.168.6.19: Timeout waiting for response for <class 'api_pb2.ConnectRequest'>
2022-10-13 14:25:36.889 WARNING (MainThread) [homeassistant.components.esphome] Error getting initial data for 192.168.6.19: Connection not done for irrigation_pump @ 192.168.6.19!
2022-10-13 14:26:13.622 WARNING (MainThread) [aioesphomeapi.reconnect_logic] Can't connect to ESPHome API for irrigation_pump @ 192.168.6.19: Timeout while connecting to ('192.168.6.19', 6053)
2022-10-13 14:29:18.417 WARNING (MainThread) [aioesphomeapi.reconnect_logic] Can't connect to ESPHome API for irrigation_pump @ 192.168.6.19: Hello timed out
2022-10-13 14:33:28.248 WARNING (MainThread) [aioesphomeapi.reconnect_logic] Can't connect to ESPHome API for irrigation_pump @ 192.168.6.19: Error while reading data: 0 bytes read on a total of 1 expected bytes
2022-10-13 14:33:38.889 WARNING (MainThread) [homeassistant.components.esphome] Error getting initial data for 192.168.6.19: Connection not done for irrigation_pump @ 192.168.6.19!
QUESTION: is there anything else I can do to try and understand why HA will not reconnect to this device? I can try restarting HA or removing and re-adding the device, but I rather understand what causes this issue so it can be prevented in the future.