I have 10+ ESPHome devices (and growing!) that communicate with HA. I’ve heard folks recommend setting a static IP for the devices instead of relying on the routers DHCP to assign.
It seems though that ESPHome/HA is using mDNS to find the device, i.e. device_name.local - If that’s the case then it doesn’t really matter what IP is assigned to it?
Thanks! I’m familiar with how to set a static IP. I’m just curious if there is any use-case that I’m not seeing since everything seems to be using multicast DNS to connect with the device?
Edit:
Ok, I see. That doc does a good job explaining exactly what I’m asking about
If you’re having problems with your node not connecting to WiFi or the connection process taking a long time, it can be a good idea to assign a static IP address to the ESP. This way, the ESP doesn’t need to go through the slow DHCP process.
After putting a manual IP in your configuration, the ESP will no longer need to negotiate a dynamic IP address with the router, thus improving the time until connection.
Additionally, this can help with Over-The-Air updates if for example the home network doesn’t allow for .local addresses. When a manual IP is in your configuration, the OTA process will automatically choose that as the target for the upload.
It still matters as these names are handled by your router so if it has a problem or settings changed it’s as unreliable that fixed IP done by DHCP so best option is always fixed IP (side note it obliges you to get a IP adresses organisation and helps keep better in good conditions
This is incorrect. mDNS isn’t handled by your router. What your router is most likely capable of is DNS (mostly forwarding request actually beside having a local cache).
And this is The best way for sure is to never fixed IP’s. You not only save a lot’s of time (by not wasting it for manual IP management) but you actually give yourself a easy route to recover network devices because they will work with any network as long a DHCP server is present.
No person involved in computer and networks for the last 20 years would suggest a static IP management.
Guess it’s more like people having problems and don’t know what it is and some one starts to scream “static IP”
That’s the case. But even if it (mDNS) wouldn’t be present there is no reason to waste time with IP assignments - just let your DHCP server do it’s work
Which is why fixed IP address is always better as you don’t rely on an other equipment that can fail ! If your DHCP server is down or has a problem of configuration all your devices are lost !
Equals that my network is down (maybe a energy outage? ). But mDNS doesn’t even rely on a central server…
But anyways… people suggestion to always use static ip’s in 2021 probably lived under a stone the last two decades or simply deny to adapt to best practices or to use state of the art technology. They can continue doing this but should really stop wasting others people time by suggesting to use static ip’s without any founded basis.
The only suggestion here which is right about static IPs was from @zoogara and is about energy saving (mostly for battery powered devices)
Yeah so far I’ve had no issues letting my devices use DHCP, however I’m about to setup 20 ESP’s for a project I have and wanted to get some input. I thought maybe I hadn’t spent enough time with HA to regret using DHCP.
I agree that static IP for battery saving devices makes sense, but other than that I haven’t had issues with letting devices connect via DHCP.
For some reason I’ve heard folks suggesting static-ip’s, so I wanted to get the scoop. I think I’m going to let DHCP do its job and give myself a break on assigning manual IPs!
I would say very old folks who didn’t adapt to the present millennium yet or people with limited knowledge of networks on the other hand. But guess what… they will continue screaming for the use of static ip’s for another decade or two… that’s for sure
I have been having issues with 2 ESPhome devices for a year, a smart doorbell and slimmelezer (smart electricity meter reader), multiple dropouts per day, sometimes even for 30+ minutes. I stumbled upon making it’s IP fixed, and it’s been steady for days, 0 drop outs. Static IP ftw for my ESPhome devices!
-edit: After 4 day stable, multiple dropouts lasting seconds to minutes, during the day.
Start the device let it get assigned an ip, lock it at the router and in the device. It’s not that complicated
but you actually give yourself a easy route to recover network devices because they will work with any network as long a DHCP server is present.
What does this even mean? Are you picking up your house and moving to a new network? Or do you just have random DHCP servers that come live inside your home? And are you just connecting to open wifi, every connection needs credentials. When logging into a new network, a new connection is made and defaults to DHCP.
Not even necessary. When only using hostnames you can stop wasting time with manual IP management completely.
And for the only valid reason (save battery) your idea of fixing the dhcp lease is not even helpful because it drains the same amount of energy on the esp as it would get a random IP assigned.
That only means that I’m happy that most humans are smart (or lazy?) enough to keep the default setting (dhcp) on their networkable things.
Meaning if (once again) another internet of sh!t (or any other) connected thing ends up on my desk it will be easily accessible without debugging it before because someone wasted his (and now my) time setting up a manual IP and effectingly disabling network functionality with it.
You don’t need to buy anything. Managing networks with dhcp is best practices since decades now and rock solid.
Some (maybe older?) people stick with manual IP management because this is how they learned it 30 years ago and they didn’t yet “update” (and probably never will) to state of the art/best practice techniques.
That’s all good and if they have the time to do it manually that’s great for them! But people should really stop giving the (stupid) advise to use manual ip’s without any valid reason (like conserving energy on battery powered devices )
The m(ulticast)DNS you mention is a completely other story btw. and does not have anything to do with DHCP/DNS