How to move an esp node to a different esp32 board?

Hi, I want to upgrade one of my esphome devices from a devkit1 to a quinled board, and thought I could just upgrade the yaml to the new board type and new pin numbers, while keeping the esphome name and therefore also the entities, statistics etc in home assistant.

So basically from

esphome:
  name: epaper

esp32:
  board: esp32doit-devkit-v1
  framework:
    type: arduino

to

esphome:
  name: epaper

esp32:
  board: mhetesp32minikit
  framework:
    type: arduino

Unfortunately this results in HA detecting the node as new device, while showing the old one as offline. Both names are identical.
Is there no way to upgrade the esp32 board of an esphome node without starting from scratch when it comes to statistics, automations, etcetc?

Any help welcome, thanks a lot in advance :slight_smile:

The process is this:

Delete the ESPHome integration for the device from HA.
Power down the existing device.
Upload to the new device.
Add the discovered device to HA.
If you did not change anything in the device config except the board type then all new entities will match all old entities and states and LTS will continue from the old device.

Because you did not delete the old device first you should now:

Leave the new device powered up.
Delete both the old and new ESPHome devices from home assistant (Settings → Devices & Services).
Restart home assistant.
Add the discovered device to home assistant. If it does not show up just power cycle the new device.
Its history data should continue on from the old device data.

4 Likes

Thanks a lot, that worked :slight_smile: One exception though: the entities used in automations needed to be reassigned. Example: the statistics for the co2 meter etc are still connected to the statistics from before, but the pushbuttons (gpio binary sensors) need to be reassigned. But that’s minor cleanup.

They should no have to. Are they appended with _2 ?

Nope. This is how they look in the device view now…

grafik

…and this is an example for an automation where the buttons used to be connected to:

the headlines of the individual entries still have the old names, but I need to re-assign the devices.

In YAML a snippet looks like this:

trigger:
  - type: turned_on
    platform: device
    device_id: 5543653bfa0087365e14c6beebeb3db4
    entity_id: binary_sensor.button5
    domain: binary_sensor
condition: []

I guess the device_id changed, which would make sense. The statistics only work on entity level (I guess) and don’t “care” about the underlying device.

Ah! Yeah. The entity ids are the same but the device ids are not. You should use this as a learning exercise:

1 Like