#Migrate Energy Consumption
1 messages · Page 1 of 1 (latest)
The key here is that statistics follows the entity id, unless the new entity id already has statistics, in which case statistics stay with the old id.
So if you add a new entity and you want it to start recording new history on top of the old, you just change the new device's entity id to match the old entity id.
@olive rose thanks for your reply. The new entity is not included anywhere in the statistics. But It has a value a total kWh for some period. The old entity id has a different value. But how do I change the entity_id is there a specific order in doing that? So now for the sake of discussion I have the old entity id named old_entity and the new named new_entity. What are the exact steps I need to follow in order to do what you have described?
You would to first delete your old entity, then rename the new entity id from new_entity -> old_entity
There may be a one time discontinuity at the changeover point (can be fixed in developer-tools/statistics), but it should start adding to the old sum after that.
Clear. So the old_entity should not be removed from the grid consumption? Because in order to delete the old_entity I will have to restart Home Assistant
I think you can leave that setting alone
The other easier solution is just add both entities as grid consumption entities
But then I will have duplicate entries unless I zeroed the value of the old entity and then I will have in energy a zeroed value entity
Another think. You have mentioned that I might need to fix something from the statistics this is because the values of the two entities are different?
It was easier than I thought. Thanks @olive rose