Repurpose esphome device keeping the old device/entities with history

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.