Ip of internal devices change - how to avoid it


From time to time i need to restart my router and therefore the internal ips for the devices as hue lights change.

What is the best way to configure this? I have in my yaml the full url as for example:

  - platform: rest
    name: "Motion sensor javi"
    method: put
    body_on: '{"config": {"on":true}}'
    body_off: '{"config": {"on":false}}'

What is the best way to configure this? Maybe defining the ip in secrets.yaml? I dont know if i could build the url referring to a secret though


The best way? Manage your router, so the IP’s will not change. :wink:

1 Like

Your DHCP server, likely your router, needs to support static leases.

Configure it so that it gives out the same IP to the device - this is done based on the MAC address.


I’m using static IP for all my devices which are read by HA, I have router, 4 Ubiquiti AP’s and 48 ports switch for all wired connecions inc. AP’s so even if router with DHCP server is missing all devices are still working with static IP. Only mobile devices like notebook or mobile phone are connected via DHCP.
I ranged it to make it organized so DHCP is using IP .1-99, all static IP devices are >.100 including HAOS. It is a bit more to do at the time of network configuration but then everything is working.