Changed the energy entity. All history gone

Last week Tibber pulse stopped working. So this weekend i removed the integration and installed it again whit no issue expect the annoyance that all entities had slightly changed their names.
Today when I looked at the energy dashboard the consumption was missing. Easy enough I changed the entity used for tracking this but found that all historical data is gone.

Note: I tried to edit the existing entity in the dashboard but kept getting some error message so I removed it and added it again.

So I managed get the old data back to the energy dashboard.
The solution is to name the new sensor exactly as the old one.
Now I lost the info from the last three days instead of the last three years.

Here is where I found the answer