Repurpose esphome device keeping the old device/entities with history

I have a esphome energy plug that I have been using for 1.5 years
now I have stopped using it for metering the energy usage of my NAS. I have a new meter that measures the whole rack instead.
And want to use the old plug to measure the energy usage of my dishwasher.
The issue I have is that changing the name of the plug will make it look like I have been using the dishwasher for 1.5 years.
I want to keep the old entity in the database even thou it’s now inactive so I can see it in the energy page when viewing history data.
and then the device should get a new entity IDs with empty history to start over for the dishwasher.

In the energy page I just want to add the new entity ID to monitor.
So when going back in history I will se NAS energy usage, and looking today I will still se NAS energy but at 0 as its not being used/updated, and Dishwasher has what ever energy it has been using.

Is this even possible?

As it is ESPHome, you could probably do this by changing the ESPHome code to output at a new entity for the dishwasher with a real value and to output with the old entity with a dummy value. It does mean you will still be recording data.

Thanks for the input.

So what I wanted to do was make a device/entity more or less archived.

I made some tests and think I found a solution.
What I did was more or less just deleting the ESPHome device (the history is still saved).
Then created template helpers matching the old entities I wanted to preserve.
I checked the details of the entity I wanted to use. (go to the device, click the entity, then 3 dots, details) and copy the attributes.
So for energy data I created
Helper: Template sensor
State: 0
Unit of measurement: Wh
Device class: Energy
State class: Total increasing

I named it the same as the old ESPHome device entity its replacing.
This made all the old history load into the new helper entity.

After that I just added the ESPHome device back in,
Home assistant will generate new entity IDs for the ones in conflict with the helper IDs, the new entity IDs will have new empty history.
My old ID was plug_05_energy and the new one is now kitchen_plug_05_energy as the device is placed in the kitchen.
Then just adding the new entities into the energy page as dishwasher.

This should be usable for anyone in the same situation.
Could possible even be a feature request. A button to “archive” by creating a template helper or even better a read-only archive helper, with the same IDs and then reset the device entity ID to restart the stats.

You can even delete the template helpers now; the statistics for them will be retained.

In order to keep statistics history for an old entity separate from a new entity you just need to ensure that they get different entity IDs.

Creating template helpers was a way to guard that entity ID so that nothing else could take it. There are a few other ways to accomplish the same goal but this is actually a pretty clean and easy way to do that.

Thanks for updating the post with your solution.

As long as you don’t “FiX ISSUES” for them in Settings → Tools → Statistics.