Change of Energy Dashboard entities - how to not loose the history data?

For my Energy Dashboard I use the Toon Smartmeter integration.
I have the following entities:

sensor.toon_p1_power_use_cnt_high
sensor.toon_p1_power_prod_cnt_high
sensor.toon_p1_power_solar_cnt
sensor.toon_gas_used_cnt
sensor.toon_p1_waterquantity

In about a month my meter will be replaced by a digital meter. My Toon Smartmeter integration will not work anymore and I will buy a P1 Smart meter from SmartGateWays. I will have all new entities and will use the new for my energy Dashboard.

The Toon Smartmeter integration will be removed.

But if I do like this my history in the Energy Dashboard from the last 3 years will be removed.
How can a keep the history of the 5 original entities?
If found some topics with instructions, but then there was a breaking change. And it’s not clear anymore. I don’t want to loose 3 years of data.

How can the history be preserved?

just don’t remove the integration, and leave the current entities in the energy dashboard config. I know the will show as unknown etc, but they should not be purged from LTS or energy dashboard. At least that what I did for a couple of smart plugs I replaced with smart sockets.

Unfortunately that is not really an option.
As the integration will poll the Toon Smartmeter box every 10 seconds.
But the Box will not exist anymore and this will result in an error every 10 seconds.

As an experiment disable the Toon integration and see what the energy dashboard does. If I disable my Solax integration everything still shows up in the energy dashboard.

I can’t disable the integration as it’s configured by configuration.yaml.

Not possible to add it throught the UI.

Nobody that knows how to keep the history data?

I think Home Assistant should be able to keep the data in the Energy dashboard.
If an entity is removed but is or was used in the energy dashboard you should have the option to keep the data.

Backup!
Delete your old entities.
Install your new device.
Rename the new entities with the old entity names (exactly).
Confirm that your history got picked up.

If anything goes wrong…restore.

My integration is setup via configuration.yaml.

I think I can only remove them by restarting HA, not?
And then I will loose also history of these entities. Correct?

After your backup, try commenting out your old integration in configuration.yaml and restarting.
Then check your old entities. I think your entities will still be present but you’ll see a message like:
“This entity is no longer being provided by the ??? integration. If the entity is no longer in use, delete it in settings.”
Delete it
Rename the corresponding entity from the new integration with old entity name (exactly) and see if the history gets picked up.

It would be a huge problem if home assistant dumped the history of an entity just because an integration failed to load one time.

1 Like