Hi,
I have an ESP, that mostly is in deep sleep, since the beginning I had a problem, that I did not give a real look on it, as I assumed it only was interesting for debugging, but it is also importand for OTA Updates. Here is the behaviour, that I struggle with:
If the ESP goes online thru "GPIO wakeup button press" or after a new compile via USB, and I immediately during this boot I go to Logs-> wirelessly, I see the following
INFO Trying to connect to s03 @ 172.16.121.178 in the background
INFO Successfully connected to s03 @ 172.16.121.178 in 0.549s
INFO Successful handshake with s03 @ 172.16.121.178 in 0.074s
So it directly connects to the IP. The logs are showing up as expected.
If I than close the WLAN Log in ESPHome and try to open again, it than tries to do:
INFO Starting log output from s03.local using esphome API
which does not work in my environment, as s03.local is not resolved. I have absolutely no chance in the environment I am working to change the behaviour in DNS/Router/whatever network solution outside ESPHome.
Does anyone know why this behavious is like this?
Can it eventually changed somewhere?
I also compiled the ESP with
mdns:
disabled: false
which did what I expected, but also had other side effect, I cannot use. The ESP get's his IP "dynamically"; but "always the same". So if there is any chance to "tell" ESPHome or the ESP "somehow" that he has the fixed IP "172.16.121.178" this iMHO would help in my situation, as far as I understand it.
manual_ip makes the ESP always claim the same IP on your network, and use_address tells the ESPHome dashboard/CLI to connect directly to that IP instead of trying <name>.local via mDNS (which doesn't work in your network).
Hi,
I am in an environment, where I cannot "claim" an IP. I do need to get an IP via DHCP. The DHCP server is configures the way, that already known devices get the same IP, if the re-connect. So practically it is "static", but the first time the ESP gets it. So if I compile, it won't work.
First flash via USB (without use_address, or with .local) — the device boots, gets its DHCP-assigned IP
Check your DHCP server / router to see which IP it got (e.g. 172.16.121.178)
Add use_address: 172.16.121.178 to the yaml and flash once more via USB or OTA
From then on, the dashboard will always connect directly via that IP — no mDNS needed. Since your DHCP always gives the same device the same IP, this will keep working across reboots and deep sleep cycles.
For existing devices it's even simpler — you already know the IP. Just:
Check the current IP (from your DHCP server, router, or the ESPHome dashboard which already shows it)
Add use_address: <that-ip> to the yaml
Flash once (OTA works fine for this, since the device is currently reachable)
After that flash, the dashboard will use the IP directly for all future log/OTA connections, so the .local fallback issue is gone.
It is not static in your setup. The DHCP pool have just not been depleted for unused IPs and the server have not been rebooted yet.
Once one of these events occur your IP address will change.
You do not have a static or reserved IP, so you need a way to discover the dynamic IP address assignment and HA use mDNS for that.
That's a fair point — if the DHCP server doesn't have a true reservation (MAC → IP mapping) and is just giving the same IP because the lease is still valid or the pool isn't exhausted, the IP could indeed change at some point. Worth checking the router settings for your network whether your device actually has a reservation or just a sticky lease.
That said, use_address is still the right solution for your immediate problem — it lets you bypass mDNS entirely, which is what's failing in your network. As long as the IP stays stable (which it has so far), it will work.
Hi,
my DHCP Server has a mapping from the MAC Address to the IP of the device in my environment. We do not use DNS here for "reasons". So even after every reboot I get the same IP. But I do not have a s03.local resolving or something similar.
? The MAC address of the device always gets the same IP address from the DHCP server. This is IMHO the point. The device has a name which can be used, for whatever it makes sense, but still every "connect" to the ESP should always be done with the IP. The first time I boot, the LOG of the ESPHome is looking for [email protected]
after "some time" it decides, that it should search for s03.local which is not working. It should always search the log over wireless at IP address only, and API as well.
I'll give the use_address a try. Problem is, that I than have fixed IPs in my ESPs YAML, where I do not want to have them, because I develop at home, and have to deplay elsewhere with different IPs. And it is 7 Devices at the moment. Any idea for an
INFO Successfully resolved s03 @ 172.16.121.178 in 0.000s
this should be done my ESPHome everytime I want to see the LOG over wireless, and not
INFO Starting log output from s03.local using esphome API
it does after a while.
I have given two networks in the YAML for home and remote, but use_address is not WLAN dependent, but "general" for network.
Hi.
I am using a OPNsense firewall, where I can "nail" a MAC Address to a specific IP. Which works always after reboots, and I am using this in my IOT network, because I do want to know exaxtly what is happening in a network, I can barely control all devices, on/off time, etc. pp.. So I do have "fixed" IPs, that are dynamically given to the ESPs each time it boots. It "dynamically" always gets the same IP The hardware is happy, and I am happy
Hi,
as far as I can judge it, use_address: my.fix.ed.ip makes ESPHome always use the IP address for OTA connect, which is nice. What I would really need is: use_address: last -> tries last working IP use_address: 172.168.2.4 always fixed use_address: never -> uses s03.local always
Am I really the first person in the worl with this, or how is this solved somewhere else?
If you set the DHCP range to 192.168.1.1 to 192.168.1.150 you will then have 192.168.1.151 to 192.168.1.254 to set manually in you esp devices.
If you just try setting the IP in esphome without fixing the same address in your DHCP, if you reboot your router it may assign the esp's address to another device, then the OTA will not be able to find the esp's adress because it has been assigned to another device.
If the address is outside the DHCP range it will not be assigned to something else.
Likely because mDNS is not working in your environment.
Since your device is using an unusual (for a home network) IP address, I assume this must be some commercial environment which likely has multiple sub-networks and likely also has VLANs to limit what traverses the network.
Since you said you have no control of that, you are probably stuck using something like this: