ESPHome - Change IP address OTA

I’m trying to work out the right way to change the Static IP address of a device OTA. So far I have had to plug them in to correct my errors which is rather irritating!

If the device is on 192.168.2.50 and I want it to move to 192.168.5.60, what is the right way to do this?

It seems I should use the use_address option (where ip_address is the new address and use_address is the old address). The problem is the Logger then tries to connect to the use_address IP and not the new ip_address so cannot see the device.

[edit]
I think the problem is that I am changing WiFi AP and Subnet at the same time and there is possibly a bug.

I’m not sure to understand your problem with the logger ./ Once done with the upload process, while confirmed it’s ok and ESP disconnects close the upload window and reopen in log mode no ?

you have to remove use_address after the upload.

In more testing, actually, you don’t. It is quite happy with the 2 settings having the same address.

So upload with different addresses (logger then cannot connect to device wirelessly). Edit file such that both addresses are the same (I’m using substitutions so this is the simplest way) and logger can now connect and (sometimes) the new upload suceeds.

What I do think the problem is, is the new AP (which is on a VLAN) - it seems to be having some issues and it is that which is stopping the upload and killing (temporarily) the device.

So not a problem with ESPHome (other than the logger cannot connect as it uses the ‘old’ use_address to connect).

No. After upload, the logger attempts to connect to the old address not the new address

Initial upload

========================= [SUCCESS] Took 12.72 seconds =========================
INFO Successfully compiled program.
INFO Connecting to 192.168.7.82
INFO Uploading /data/bme6801/.pioenvs/bme6801/firmware.bin (418080 bytes)
INFO Compressed to 290655 bytes
Uploading: [============================================================] 100% Done...

INFO Waiting for result...
INFO OTA successful
INFO Successfully uploaded program.
INFO Starting log output from 192.168.7.82 using esphome API

restart logs

INFO Reading configuration /config/esphome/bme6801.yaml...
INFO Starting log output from 192.168.7.82 using esphome API

Edit config file so use_address is the same as ip_address - successful log connection.

INFO Reading configuration /config/esphome/bme6801.yaml...
INFO Starting log output from 192.168.2.82 using esphome API
INFO Successfully connected to 192.168.2.82

That would seem to be a bug, perhaps github is the place for this.

1 Like