Changed integration: lost all energy data

I had to switch from QCell integration to Solax via LAN leveraging the integration.

I added the new entities from the Solax integration and, after a while to confirm data was properly flowing, I removed the old entities from the energy configuration as they have been disabled or are not working anymore.

The outcome is that I have no energy data for any previous period than today: not for the last month, not for the year, nothing!

Should I have kept the previous entities around just to keep the data?
Given the high chance of changes to integrations, inverter etc. hardware and services, I fail to see why a change of integration should wipe out older data, regardless of how the statistics works, linked to the entity_id.

What is the alternative? Create long-lasting set of intermediate template sensors and integration helpers to protect statistics from changes?
Anyone addressed it?

Yes.

The data is probably still in your database. Can you add the entities back?

Or you could try renaming the new entity ids to match the old ones (exactly). That used to work. Not so sure nowadays.

Thanks @tom_l.
I still have the integrals for my previous QCell integration that I can add, while the source sensors are not working anymore.

Energy stats are related to the HA installation in the long term, far more than to the specific integration: why is it not a practices to keep intermediate template sensors and integration helpers to separate statistics from changes? Far more complex that it looks?

That’s exactly what I’m doing to avoid losing history when I change a device: separate actual device from usage through templates.

I would definitely love that HA would implement that natively. It’s quite a burden to maintain…

For me personally, I just don’t care that much about historical data.

If I need to for some reason then I have 2 years in InfluxDB. Home assistant sensors can come and go but I can graph the full two years tracking a measurement in Grafana. It’s easy to include past and present sensors in that.

1 Like