ESPHome device added, shows green in the dashboard, but devices now show unavailable

follow this procedure I posted above.

Still doesnā€™t say why it happens.
I have a device, a solar temperature sensor running ESPHome. I havenā€™t touched the code for weeks, but suddenly, yesterday, one of the entities was ā€œunavailableā€. I found that the entity was now _2. It only took me 30 seconds to edit the /config/ui-lovelace.yaml file and update the entity name.

It would be nice if we could force the entity name in the ESPHome code.

Guess which side of the ESP API acts as the server?

Iā€™ll give you a hint. Itā€™s not Home Assistant.

Smart-aleck. You know what I mean. NAS, Plex, MQTT Broker. Those have a permanent IP lease.

Iā€™m serious. Each ESPHome device acts like the server end of the API connection and benefits from having a static IP address just the same way larger servers do. In this case the Home Assistant ESPHome integration is the client.

Any chance you can explain why HA would be using (likely) the discovered IP, rather than the IP that MDNS resolves to?

That workedā€¦ but now they are unavailable again. I have to be doing something wrong. That seems crazy that I would have to set a static IP for all my ESPHome devices. FWIW, I have two others and they work fine.

Idk what to tell you it shows up 2x on the wifi configuration page, maybe just set static IPs.

1 Like

What worked? Either say who you are replying to or quote something.

Mike-
ā€œDramaticallyā€ is a relative term. It only takes a couple of ms to look up the IP over MDNS. I wouldnā€™t call that ā€œdramaticā€.

As I said, I have dozens of ESP devices, mostly Sonoff running Tasmota, and a few that I have converted to ESPHome. None of them have a static IP.

Do you want a prize or something? This is written in the official docs from esphome. If you know better than the maintainers, maybe you should contribute to the project.

To be honest, Iā€™ve never actually quoted on Discourse. I didnā€™t really realize it was an option and usually just reply.

Either way, you can click the link of the person I was replying to and it will show you the post.

"Generally speaking, disabling mDNS without setting a static IP address (or a static DHCP lease) is bound to cause problems. This is due to the fact that mDNS is used to find the IP address of each ESPHome nodes."

So, I read the docs that indicates that the developers expect the devices to use dynamic IP addresses.

Under ā€œTroubleshootingā€:
ā€œGive your ESP a static IP.ā€ is found right after ā€œWe are working on possible workarounds for the issue,ā€

I bet that Iā€™ve found my issue. Iā€™m guessing that HA Discovery grabs the IP address of the ESPHome node, and likely has no idea about its mDNS name. I deleted the device from the integration and manually added it using the mDNS name.

Does it seem that this could really be my issue?

In other words use a static IP for now if you have connection problems.

@flyize idk all my nodes have been static from day one.

From the docs:

ā€œOnline status detection in ESPHomeā€™s dashboard by default uses mDNSā€¦ā€

Well shit. There goes that idea.

edit: Wait, that says in ESPHomeā€™s dashboard. Iā€™m talking about HA Discovery when it finds a new device.