TL;DR

Moving ESP32 boards (running ESPHome) between wifi networks is not difficult, but it requires 2 steps and use_address yaml command.

Context: HomeAssistant + ESPHome integration, updating directly from ESPHome.

The issue

I wanted to move all my IOT junk that runs ESPHome to a separate wifi network. I achieved that by following 2 steps:

1. update ESPHome’s board yaml configuration and flash it

I added the following command to the board’s yaml:

wifi:
....
use_address: "insert current existing IP address here"

This command tells which IP ESPHome dev environment in Home Assistant should use when flashing the board.

esphome's screenshot with use_address field

Then I changed the board’s IP address, gateway and wifi credentials to new ones:

substitutions:
  ip_address: 192.168.1.116 #new ip
  ip_gw: 192.168.1.1 #new gateway

...

wifi:
  ssid: !secret wifi_iot_ssid #change this to your secrets file
  password: !secret wifi_iot_password #change this to your secrets file
  manual_ip:
    
    static_ip: ${ip_address} #uses ip from substitutions above
    gateway: ${ip_gw} #uses gateway from substitutions above
...

Save, Install.

After installing, ESPHome won’t be able to access the board, but the board works ok. Proceed to step 2:

2. remove or comment #use_address in yaml’s wifi block and flash the board once more

That’s it. Done. The ESP board now resides in a new wifi network.