I’ve got a few ESPHome devices which occasionally have flaky connectivity. It’s not a big deal, but I wish I didn’t have to guess which is which each time it happens. My HA log file tends to have a lot of:
Can’t connect to ESPHome API for None (10.0.0.103): Error connecting to (‘10.0.0.103’, 6053): [Errno 111] Connect call failed (‘10.0.0.103’, 6053)
Can’t connect to ESPHome API for None (10.0.0.116): Timeout while connecting to (‘10.0.0.116’, 6053)
Can’t connect to ESPHome API for None (10.0.0.127): Timeout while connecting to (‘10.0.0.127’, 6053)
Can’t connect to ESPHome API for None (10.0.0.127): Timeout while waiting for API response!
Every one of my yaml files has a name right at the top. The integrations page shows a list of ESPhome devices, each with their name. I also checked all the esphome.xxx files in my .storage directory, all have names.
Surprisingly, a Google search for “Can’t connect to ESPHome API for None” provides only 3 results, none helpful.
Can someone please help me understand where the None is coming from, and what I can do about it?
Thanks Tom. Yes, many have static IPs and I’m able to identify them all by looking them up in my records.
To better state my question, does anyone know where the “None” comes from and whether there’s anything I can do about it so that the entity name is shown and I won’t have to cross-check each by IP?
The neighboring log file entries read:
2021-09-03 03:02:34 INFO (MainThread) [aioesphomeapi.connection] upstairs_temp @ 10.0.0.116: Ping Failed!
2021-09-03 03:02:34 INFO (MainThread) [aioesphomeapi.connection] upstairs_temp @ 10.0.0.116: Error while reading incoming messages: Error while receiving data: 0 bytes read on a total of 1 expected bytes
2021-09-03 03:03:04 WARNING (MainThread) [homeassistant.components.esphome] Can’t connect to ESPHome API for None (10.0.0.116): Timeout while connecting to (‘10.0.0.116’, 6053)
The irony is that the Info messages have the name but don’t show up in the logs overview panel, where the warning message do show with “None”.
I think it is generated here https://github.com/home-assistant/core/blob/672a74fa371f117edfb37597ff6460edacbc208a/homeassistant/components/esphome/__init__.py
I filled in the unque_id (after looking for a way to do this via the UI or ESPhome .yaml file and not finding one) then restarted HA. Since the restart the log messages have included the name I provided as unique_id.
It’s only been a few hours but I’m calling this problem solved for now.