Migrate Utility Meters & Sensor Templates from YAML to UI without loosing history?

Hi all,

After reading The Future of YAML post, I was looking to migrate my Utility Meter and custom Sensor Template definitions from YAML to the UI.

However while testing this with a first Utility Meter, I noticed that even when reusing the same entity_id the history of the YAML entity was not “transferred” to the UI entity.
I presume it is because YAML entities don’t have a permanent unique Id, as UI entities have, making HA consider them as 2 different things.

So I was wondering if there was any way to migrate seamlessly the YAML entities to UI entities without loosing the history (by manually editing the .storage/core.config_entries file that contains the UI definitions ?), or to transfer the history from the old entity to the new one.

This would be especially useful as I have a lot of utility meters & sensor templates involved in long period queries via InfluxDB/Grafana dashboards, which would not correctly sum values if the history is “broken” at some point in time.

Thank you.

There is no UI for template sensors and I’d leave your utility meters as yaml if I were you. The UI version has issues.