New smart energy sensor

Hi,
We got a home battery this summer, and we also installed a new smart meter. I would like to phase out the old one and use the new one, but I don’t want to lose any data. I’ve read many posts, but there doesn’t seem to be a clear solution.

Right now, I’m using an MQTT-based smart sensor that has two entities: one for export and one for import. I want to move the data from the old entities to the new ones, which also have two entities (export and import).

Is the best way to delete the old ones and rename the new ones? Or what is the best way to do this?

If the old sensors are no longer supplying data just add the new sensors to the Energy dashboard and leave the old ones in place.

Today I use my sensors (MQTT-based) for more than just the energy dashboard, and I want to keep it that way. Can I simply rename the new sensor to match the old one? Or what would be the best way?

Honestly I don’t know any more. There have been a lot of changes. But when I migrated my energy sensors a year or two ago, yes - this is what I did.

  1. Delete old sensors from home assistant.

  2. Add new sensors and edit their entity ids to exactly match the old ones.

My history was preserved.

I can not guarantee this still works. Make a backup before trying and let us know how it goes.

Okay, so I did my transfer. I had an MQTT-based energy meter. We got a smart energy meter from Huawei when we bought a home battery, and we also have solar panels. Therefore, I want to use this new energy meter, because everything will be in one integration. A big priority for me was to keep my energy data and have minimal impact on my automations and templates. Therefore, I did it like this:

  1. Deleted my MQTT energy sensors (I deleted the smart meter in the mqtt intergration)
  2. Checked that it was removed from devices.
  3. Renamed my new sensors in the Huawei integration
    (EXACTLY THE SAME NAMES AS MY OLD ONES).
  4. Done.

My old sensor had two sensors for power (positive and negative), but my new one shows both positive and negative values in a single sensor. I use this template to “recreate” the two separate sensors.

######EFFEKT IMPORT ########
    - name: lgf5e360_power_instant_active_positive
      unique_id: lgf5e360_power_instant_active_positive
      unit_of_measurement: "kW"
      device_class: power
      state_class: measurement
      state: >
          {% set val = states('sensor.power_meter_active_power') | float(0) %}
          {{ val | abs if val < 0 else 0 }}
    
######EFFEKT EXPORT###########
    - name: lgf5e360_power_instant_active_negative
      unique_id: lgf5e360_power_instant_active_negative
      unit_of_measurement: "kW"
      device_class: power
      state_class: measurement
      state: >
          {% set val = states('sensor.power_meter_active_power') | float(0) %}
          {{ val if val > 0 else 0 }}

Extra :raised_hands:
I can also confirm that the renamed sensors in the Huawei integration keep their names after I updated the Huawei integration.

This worked for me, but make a backup first. :grimacing: