Changing the static IP of a device

Hi,

I’ve following block of code that is used by all ESPHome flashed devices:

wifi:
  ssid: !secret ssid
  password: !secret ssid_password
  fast_connect: True
  reboot_timeout: $wifi_reboot_wait_time
  manual_ip:
    static_ip: $ip_address
    gateway: !secret gateway_ip
    subnet: !secret netmask
    dns1: !secret gateway_ip

So my question is that if for a given device which currently has 192.168.1.10 assigned in the secret file, if I edit this value to 192.168.1.11. Will the update work over the air and would the device upon reboot be recognized automatically by HA without needing changes to existing automatons?

Have a read of the linked topic in the docs:

1 Like

Thanks so seems like I’ll need to follow these steps:

  1. Update the new IP address in the secret file
  2. Add the “use_address” in the existing configuration
  3. Flash the firmware
  4. Delete the “use_address” line from the configuration

This could take a while as I’ve ~50 ESPHome devices!! I will update once I’ve gone through the motions and thanks for the pointers!

You can also update your device config to what you want, but for each flash command specify the original/previous IP to connect to. This works from the command line.

It’s the --device option.

@zoogara & @parautenbach

How about another approach that seems less error prone to me. How about I just do following steps:

  1. Change the ESPHome configuration and remove static IP assignment and flash the device. Upon reboot the ESPHome devices will now revert to DHCP mode but should get the same old IP address as all these devices are also assigned static IP address on the DHCP server within OPNSense.

  2. Change the DHCP assignment on OPNSense

  3. Reboot the device

It is easier to swap IP address on the DHCP service and there are fewer steps involved.

Can you foresee any problems with this approach?

Yes, I think DHCP reservations are the more manageable approach.

Personally I use DHCP without reservations just fine. I know some people have reported issues with that, but it’s been working fine for me — even on my old scrappy network, which I have since revamped.

My approach to keep apart from micro-management.
No need in static IP or DHCP reservations - just administrative overhead and nothing else.
DHCP + mDNS make it working in easy way.
IMHO.

1 Like

Certainly sounds simpler in the long run.