How to enable Home Assistant to find the IP addresses of all my things automatically, when my router is set to reboot every 24 hours?

For example? Say I have a Phillips Hue hub (which I do) and the IP address of the hub changes with every reboot. (Which it does.) How would I use my knowledge of the host name to resolve this issue?

I’m honestly not sure you can unless HA has control of your router or is your DHCP router without way more work than anyone needs to do; your router/DHCP server can do it all.

So to clarify:
1.) you want a way for HA to always be able to find your device even after reboot. Solution, make sure it always has the same IP before and after reboot. We can do that.
2.) you’re having problems with bandwidth with so many devices, maybe drops, maybe slow performance. Solution: add switches and access points to your network. We can do that, too.

The easiest way to is use your router to assign permanent IP addresses to your devices that don’t allow you to manually set their IP on them by reserving each device by MAC to a specific IP. I don’t know any router that doesn’t have the ability to reserve IP addresses. There are limits–for netgear, it’s 55 devices–but that means that those IPs are always reserved to those specific devices no matter what.

For devices that let you, you can hard code the IP address into the device directly.

The Hue Hub does let you hard code an IP into it, however. In the app:
1.) Got to Settings
2.) Click on Huge Bridges
3.) Click on ‘i’ icon by your hub
4.) Click on Network settings
5.) For DHCP, change the slider to Off and enter an IP address in your router’s range: if your router’s IP is 192.168.0.1, it controls 192.168.0.2-192.168.0.254. so you need to assign it to one of those*. THen enter netmask (255…), and the gateway (your router’s IP).
6.) click the checkmark

Setting the IP manually on a device can be done with most TVs (both my Samsung tvs can do it both on LAN and wifi), most streamers (my Shield TV and I think my FireTV are both hard coded), my networks switches, my APs, X-Box, Playstation, any Windows or Ubuntu computer (I assume Macs do but I don’t have one), and any Android (and iphone?) though I generally don’t set it on my laptops or phones. HA on a Pi can also be set to a hard IP address in the Supervisor under System/Host System/IP address. If you set a hard IP on the device, you don’t need to reserve it on the router, but you do need to do something else.

*So don’t do any of that yet.

First: hard coding the IP into your device means that you need to take that specific IP address out of the assignable range of your router so it can’t give it to anything else and it might and will at any reboot or even if your device loses connection and something else gets in before it connects again. This is pretty easy to do but comes with some restrictions.

Go to the LAN or set up LAN page on your router where it shows the assignable range; that’s generally something like 192.x.x2 to 192.x.x.254. For most consumer routers (not all), you can’t just exclude one IP or multiple IPs, or even a non-continuous range; generally, you pick a continuous range at the beginning or the end of the assignable range. (If you’re using DDWRT or any open source router, you can do it with the DNSMasque settings and none of the above need apply.)

Example: My router’s assignable range is now set to 192.x.x.200 to 192.x.x.254 only; it cannot assign anything lower than 200 to anything. Every IP from 192.x.x.2 to 192.x.x.199 is removed, so it can either be reserved by the router for a specific device, is hard coded into a device, or it might one day be reserved or hard coded into a device. It also makes it super easy to see wifi intrusion; anything above 199 means if i don’t have someone visiting me, I need to check it out. Do I have 199 devices that need an IP? No, but the way I’m going, it’s probably going to happen.

Now, wifi and problems with dropping/speed/etc.

Most routers have limits on how many devices can be connected at any one time and no, that’s sometimes not easy to find out or even know is a problem until it happens to you. I tested this a lot with several routers and right now, my router is grumpy over sixty (some routers allow more, some less, some much less, I had to google a lot).

To get around this:
1.) I bought multiple network switches and LAN’ed everything that had a port. Currently I have four switches, two 4 port, two 8 port. My Hue Hub, SmartThings Hub, Sengled Hub, and Pi are all hardlined to a switch (along with all TVs, streamers, gaming consoles, speakers, computers, server, etc that had an ethernet port). This also has the benefit of much better response time and clearing wifi bandwidth for my devices that can’t be hardlined.
2) I use one router and two or more APs, aka routers set to AP mode. I was using one nighthawk router with two routers flashed to DDWRT running in AP mode, but as I wanted to upgrade my house to wifi 6, it’s now one wifi 6 nighthawk router and two wifi 6 nighthawk routers I switched to AP mode that I bought used on Amazon. I put the APs in different parts of the apartment, ran an ethernet cable to each one, set same SSID and passwords on the router and APs for both bands, and called it a day.

Another option is switching to mesh, but my setup cost me a third of what a mesh Orbi Ultimate would have cost, is cheaper to expand, and while mesh has better roaming in theory, I still get better speed with cable. My apartment is a lot of concrete and a lot of walls and therefore mesh unfriendly.

Tell me if I wasn’t clear enough on any of this. I promise, this is very easy to do and can all be done in the router’s UI, no messing with settings or command line or whatever (though that’s fun, too).

2 Likes

I don’t know how Philips Hue is configured in HA, (I use a ConBee stick for ZigBee). But e.g. to configure my kodi players there is a field ‘host’, where you can either insert the IP or the hostname.

Dude thanks so much for such a comprehensive response. It will probably take me a day or two to absorb it. I very much appreciate it.

However, a I stated previously building a mesh network, or using Wifi extenders etc. for my tiny apartment is completely overkill and totally pointless. I have been eyeing this Ubiquiti router for a few months now, specifically due to recommendations on it’s ability to handle a large number of simultaneous 2.4 GHz connections flawlessly, but so far the cost has proved prohibitive. https://amzn.to/2WK9PpJ . But maybe later in January.

Does a Conbee stick have something to do with Philips Hue? How it was configured was that it was configured by Home Assistant on first boot. But since my most recent daily router reboot, Home Assistant has lost the IP of my Hue hub.

Easiest fix is simply using DHCP reservation for all your devices.

1 Like

Yes, I use a ConBee stick to integrate my Philips Hue devices with Home Assistant and ditched the original hub. This way I get instant feedback from the devices because events are pushed by the hub and not polled from the hub at a specific interval like with the original hub. I can also integrate countless of other zigbee devices from other manufacturers, e.g. the Xiaomi series which has some nice, inexpensive sensors.
Seems like you’ll not be able to use hostname instead of IP for the original hub, therfore I’d go with the suggestion of giving it static IP from the router if this is possible.

Well I don’t like that Philips could ditch their hub at any second, like they did with the last one. But that’s not my immediate problem. Nice to know there’s an option though.

36 isn’t really a high number. So the problem shouldn’t be caused by the hardware itself and the amount of devices. My suspicion would be, together with your statement about the apartment, that you have too much Wifi-interference with the routers around you.
Typical routers automatically switch the Wifi-channel depending on how congested the channel is. Some of the client devices may fail to follow to the new channel correctly though, especially if they are kinda dated.

My suggestion:

  1. Follow the advice of the other users about reserving IP addresses. My oldest TP-Link router is from even before 2010, and it for sure had the capability of doing that. So there is no excuse. Do this, and it will solve the primary issue of missing HA-connectivity after the router-reboot.
  2. Fix your network. This can be tricky. Even experts often have hard times getting it perfect. But there are small things you can do to improve the overall performance. First, disable the feature to automatically switch the channel if it’s congested. It might sound counter-intuitive, but in my experience a Wifi with a fixed channel is much more reliable. The reason for that is, that with f. ex. 10 routers around you, they all work on some channel, and now that someone is streaming 4K on Netflix, you router decides to switch to another channel. That in turn causes another router to switch the channel as well, and then the next, and then the next. Like the ripples you get when throwing a stone into water. And this turns into a loop, where all routers constantly switch to a better channel, but a followed by the others around, and therefore switching again and again. If instead you set a fixed channel, at least your router will stay where it is. The link quality might rise and fall in this case, but at least the devices within your network don’t have to adjust to the constantly changing environment.

To get started with the network fixing I recommend using the tool Netspot. It has a free version which should be more than enough for a single apartment. By using this you can make a map of your apartment and record the signal quality at different locations. You also get a list of routers around you, which will help you decide which fixed channel you should ideally use. The general advice is to stick to channel 1, 6 or 11. Of these 3 choose the one with the least amount of neighbouring routers.
It might also help to adjust the bandwidth of the used channels. You can typically set it to 20 or 40 MHz. 40 MHz theoretically provides more speed, but at the cost of intereference, and therefore more re-transmissions of failed packets. Think of it as reliable 10MBits being better than 20MBits that are unreliable.

1 Like

I think I’ll probably try to grab the Ubiquiti Router some time around the end of January, before I get ‘balls deep’ into all this again, so to speak, lol. Then At least nobody can say the router is at fault. I just wish home automation wasn’t such a rabbit hole of ongoing expense, lol. Hopefully after this I can just set everything up and forget it for a few years and just actually use it.

That’s not necessary. Just spend half an hour setting up addresses in your current router. That will make the most difference to you

Why does HA need to keep track of IP addresses? That is what DNS is for. You give HA the hostname and your DNS server tells it what IP address to use. Its networking 101.

I’m confused? Is this related to this issue somehow? HA does have a hostname. If my router knowing the HA Hostname will help stop my device IP addresses from changing, please explain?

Otherwise I think the most sage advice is to find the correct method in my T- link router to ensure that the same IP address is always assigned to the same device, despite not being able to specify this in the actual device itself.

Has anyone got any experience doing this on an fairly recent TP-Link router please? I believe the router page is fairly standard.

I think this is also almost the first piece of advice you were given.

It was among the first yes. But there have been several other useful points raised since then also.

Yes but that is the root cause of your problem

What’s that? If you mean not following the advice, that is inaccurate. People have been very generous with their advice and I appreciate this very much. I just haven’t had time to sit down and absorb it all yet.

Maybe a detail you are not aware of: access points arent necessarily routers. If you buy a Ubiquiti Access Point, you’ll still need a device that’s assigning the IP addresses and does the routing. The simple scenario would be, that you keep the TP-Link router and disable its integrated Wifi, and hook up the Ubiquiti Access Point to it.

Every device on your network has a hostname. Use it instead of the ip address.

That is something worth considering, thanks. Any examples?