How to keep old energy statistics history when changing the main meter sensor?

Hi. I’m a new user of HA, for about 1 year, with some skills in computing, but some :slight_smile:

Yesterday I made successfully the change of 1 device that measure energy for another new, both brand Shelly, and then reuse the first (old) in other stuff inside HA too.

The changes in my house were: disconnect the shelly PM plus (red) keeping the energy and power consumption data, for connecting the new Shelly “energy monitor” (white, with not relay inside) for a split HVAC device), and then reuse the PM plus (red) for another new resistive heater in the bathroom.

The process was easy:

  1. Connect and power-on my new energy monitor device (shelly white). No more action needed.

  2. Take note of the entity (or entities) that I want to conserve his history (the old device’s entity) and taking note of the full “entity ID” (not the fantasy name).

  3. Physically unplug the old device.

  4. Now, in HA, go to the Shelly devices, delete the device listed in red (for “no connection”). This step makes the trick.

  5. Now, in HA too, if you check the entity that report, for example, “energy data”, you will see an empty history record. That’s no problem, because in this step, you need to go to that entity, click on the gear associated to that entity, and paste the entity ID used for the old device.

  6. Instantly you will see the full history data, with a gap in the time between de disconnection of the old device and the connection of the new, but that is a short lost of data.

  7. Now you can connect the old device, and HA will integrate with a new entity ID. Your transplant is done.

Regards from Chile.

2 Likes