Resolving IP address and connection reliability

One of my 4 ESPHome devices (Wemos D1 Mini) unreliably processes firmware updates.

Here’s the error I get in ESPHome when I try to update it.

Suspecting an mDNS issue, I enabled Local DNS Record on my Ubiquiti UDM-SE router, but it doesn’t seem to help.

Also, my network will often indicate that it’s connected while ESPHome indicates it is OFFLINE.

Any ideas for me to further troubleshoot this device’s reliability?

It is probably not a connection issue, but a boot issue.
Connect a serial monitor to the UART connectors on the ESPHome device and see what happens.

I wouldn’t know where to start with that suggestion.

If your ESP devices have USB connection then try to connect that to you desktop and then run a serial monitor, like Putty on Windows.
Linux have busybix or minicom and others and MacOS for sure also have some.

If you do not have an USB connection, then your ESP device have some UART pins for RX and TX where a FTDI adapter can be connected to get the serial monitor output.

I use PuTTY as an ssh client. So, you’re saying I can also use it to connect via USB? Once connected, then what?

Press reset on the ESP device and see the output.
The output is similar to the output in the ESPHome log window, but you can also get the log output before the network connection is established.

Most likely it is an mdns problem if the device is online and working with HA as usual. In my experience, the mdns record works short after an esp reboot but the mdns entry does not persist as it should.
If you cannot get mdns to work reliably, using a static ip works best (as the error states) because then esphome knows the ip and does not need the mdns to work.

Ping the IP address to test if the device is online.
You can’t use the Unify for anything, because Ethernet device will disconnect without sending an event message, so Unify will set a device as online when it is online for real, but also if it have seen it a while back and have not received any information that it should be offline.
It is an assumed state.

Ping should give you the right picture in the moment.

There might be something not quite right with the mDNS implementation in esphome anyway.

I have two devices, ‘SlimmeLezer eth’ and a DOIT ESP32. Both have near identical configurations, except the ethernet part. The ethernet device shows up in esphome, the wifi one does not.

In home assistant however, both are working just fine, get discovered (through mDNS!!)

I’ve spend half the day to figure out why this is. First I thought it could have been an esp-idf vs arduino platform thing. Then I thought this is somehow related to avahi. But as I said, hass works fine.

One thing I ran into, is that the (neither) container could resolve the .local hostname. This could be the root cause maybe, and I’m working on integrating avahi2dns to inject these records into my DNS server, then I know for certain. It seems that home-assistant gets the information from avahi (through dbus), and then uses the IP onwards; but esphome somehow relies on mDNS resolution, which (especially in containers) is tricky at best.

Edit: I flashed a different firmware on the same device (using the same similar yaml file) and I can even get the ‘adopt’ button … I’ll adopt it, copy/paste my yaml into it and then see how it goes … hmm, after copy pasting the yaml or at least the ‘name’ part (for some reason the adoption removed 10% of the upstream yaml, but the ‘package’ node with the yaml url was still there) i now had 2 functional/online nodes. The pre-compiled binary variant and my own yaml (not supprising as they share the same IP/Mac/other config parameters), which is supprising as my node is now online, and even after putting in my yaml, stays online. Can’t view logs remotly stil; but that’s due to the .local resolving not working. Speaking of, my hostname is a dynamic one, name+mac, which is translated by esphome to just the name, so that’ll never work anyway.

Smells like a few bugs exist in this bit still.

Just upgraded to 2024.7.0 and things seem a lot better already. Could be something unrelated of course as well; but reading wireless logs now also works.

One note, I’m comparing to devices that have name_add_mac_suffix: false right now, so could be that this is also a huge part of the problem, because I saw in a lot of places that esphome uses name.local instead of name-mac.local