I recently built a new ESPhome device. After performing the initial flash via USB, it showed up fine in ESPHome Builder, but I ran into an issue trying to flash my new config:
INFO Successfully compiled program.
ERROR Error resolving IP address of ['foo.local']. Is it connected to WiFi?
ERROR (If this error persists, please set a static IP address: https://esphome.io/components/wifi.html#manual-ips)
ERROR Timeout resolving IP address: Timeout while resolving IP address for ['foo.local']
WARNING Failed to upload to ['foo.local']
I haven’t had this issue with other ESPHome devices I’ve built (mainly re-flashed Emporia smart plugs).
If I add the assigned IP to wifi: config
use_address: 192.168.1.123
it works, but I don’t want this to have a static IP.
I don’t think this is an mDNS issue as nothing else is broken, but I’m honestly at a loss here.
It’s not a static IP address, it just tells the compiler to upload the file to this device instead of looking it up.
As long as everything is working now, I honestly wouldn’t worry about it. Comment out the use_address part and add a note about why and when you originally used it for your future self. Very occasionally I’ll have an ESPHome device that for whatever reason has temporary mdns issues when updating and I’ll do just this.
In my cases, it’s usually just random and transitory; I use DHCP for all my ESPHome devices and I assume an address happened to change recently and there’s a cache issue somewhere in the chain.
Mine seems to be constant, for this device at least. I feel better knowing that the specified address is just for the upload, but I’m still curious what is causing it with this particular config. my suspicion is that it’s related to a web_server component, but that’s only a guess.
I’m not 100% sure what’s happening here, but somehow the actual mDNS of the device and what the uploader thinks the mDNS of the device should be are out of sync.
The uploader is trying to resolve radgdo1.local, while the actual mDNS is ratgdo1-123456.local (whatever my last 3 MAC bytes are).
I was able to fix it by setting that to false, re-uploading with the IP specified, and then removing the IP. Subsequent uploads without the specified IP worked fine as mDNS resolved.
I managed to get it to use the MAC suffix mDNS name once as well, but I have since changed it back in an effort to understand this and have not gotten it to work again.
So to summarize, my device had the name “ratgdo1-123456”, and if I browse to ratgdo1-123456.local it loads the webserver I expect, but even though
name_add_mac_suffix: True
is in my config, it still tries to resolve “ratgdo1.local” when uploading, throwing this error:
INFO Successfully compiled program.
ERROR Error resolving IP address of ['ratgdo1.local']. Is it connected to WiFi?