Update a device IP address from the UI

Hello,

It would be nice to be able to update the configuration a device/integration from the UI, especially changing its IP address (Wifi lights bulbs, Android TVs, etc.). I moved twice last year and used two new different routers, so I had to reconfigure a lot of integrations because of the new assigned IP addresses.
Unfortunately, in the Device and Services menu, the Configure option of integration doesn’t allow me to update the IP address. There are only two solutions I am aware of:

  • Delete and re-setup the integration.
  • Update the config files in the hidden .storage directory, but it’s not user-friendly and not all users are aware of this trick.

There should be a better and easier way to do it from the UI. It would make sense in the context of the streamlining motto, and I am sure other users would benefit from it.

Thanks!

There is. DHCP.

I have 80 or so devices on my WiFi network, and none of them have a static IP. My servers are the only devices with a static IP and they are hardwired (Ethernet).

yes, but regardless of DHCP, my devices didn’t have their IP addresses updated in HA.
The devices were not controllable until I updated my HA config.

Many integrations will update the IP address from discovery, or simply setting them back up again will update the existing config entry (and abort with a message that it’s already setup).

Every integration has to implement that though so which ones do is not obvious or consistent.

I suggest opening a separate feature request thread for each integration that you confirm doesn’t implement either update from discovery or update from reconfiguration as it’s likely the codeowners of many of these integrations aren’t aware of these options.

Why aren’t you using the hostname of the devices? If you must hard-code IP addresses you can change them en blanc using grep and sed.

grep -rl $oldstring /path/to/folder | xargs sed -i s@$oldstring@$newstring@g

Note- I am not a linux expert, but I once used grep/sed.

I have this issue with Shelly integration (HA 2023.10.5)
I’ve updated the configuration of my network (I’ve set static IP’s on my router).
On my router, I see the device with an address that ends with 122, I can access Shelly device (4 PM - Gen 2) with that IP, but in Home Assistant I still have an old IP address (that ends with 140). I restarted Home Assistant and my router, but only manually editing core.config_entries fixed the address and my entities are visible again. I think I have the device configured properly (websockets and static IP address))
@Bieniu sorry for mentioning you directly, but before I create an issue I’d like to be sure that Shelly supports this feature (change the IP address from discovery).
I’ve fixed the issue by manually editing the mentioned file, but I think that would be a useful feature.

Shelly integration will update your device’s IP address when it changes. Of course, the device must be configured via discovery. If you have configured your device by providing an IP address, you will need to unconfigure and configure your device again. Manually editing registry files is not recommended.

Thank you for the reply.
I know manually editing the config file isn’t recommended, but this was easier than editing all automation and UI.
I’ve added all Shelly devices (Gen 1 and Gen 2) via discovery. I have around 30 devices installed.
I’ll do another test in the evening by changing the IP on the router (MAC to IP address assignment).
If everything works, then in HA the device should update.
Should I restart all the devices (Shelly, Router, and HA)? Is the order important?

When the device gets a new IP address, it should send information about it and then it is necessary to restart the HA.

OK, I’ve done some tests.
I’ve changed the static IP on my Shelly 4PM from 192.168.0.122 to 192.168.0.240.
Then on my router, I changed that device’s static IP address to 192.168.0.240.
After saving the changes on my router I could access 4PM web interface via the new address (192.168.0.240) and the entity became unavailable in Home Assistant, after a restart the IP address was updated.
On the second try (I changed the device IP back to 122) Home Assistant changed the IP address instantly (without a restart).

Generally, everything works after a restart, but the behavior is inconsistent, but it works. Not sure why it didn’t work before.

At the end of the year, I plan to change all network equipment in my house and also change the addresses of all devices, so then I’ll test all my integrations.

1 Like

Another way to deal with problem is to use local domain names. In my local network, each device receives from DHCP an address from the bieniu.lan domain, e.g. shelly1.bieniu.lan. This is the address I use to configure the device in HA. Even if I change the IP address for this device in the future, the address in the local domain will remain unchanged, so communication between HA and the device will work.

not sure if my old Huawei B535-333 has such functionality (local domain names), but thank you for the tip :wink:
BTW can Shelly integration use domain addresses instead of IP addresses?

Of course, most integrations can (ESPHome is an exception here).

1 Like