Keep history when changing a device|entity name

I’m very new to home assistant and my setup hasn’t really ‘settled’. Yesterday I decided to change the name of a device which had a very unfriendly name. I also checked the “rename entities” option.
Things didn’t break but I was surprised when I went to the history of the device and realized I had lost all historic data on such device!
Digging a bit into solutions I ended up updating the states table in the sqlite database and that fixed it. It was just a couple of updates.
Why doesnt HA does this OOTB? seems like an easy operation to do. does it has some problems I’m not aware of?

It can be option during doing device rename, as well during entity rename.
Cause sometimes no need to make changes in states table.
But sometimes would be nice to transfer history to new entity name, but not always.

2023.4.x

3 Likes

OMG thank you so much!

Hello, Adding to this, would it be possible to “transfer” history data to a newly created template sensor? (Copy/paste).
I created a new template sensor to monitor average temperature, and filter out NaN values, causing spikes (source unavailable) whenever i restart my instance.
I could not really find an answer, so forgive me if i’m in the wrong place, but it seems a handy option to add.

Please avoid necroposting, and create a new thread in which you can reference this one. :slight_smile:

1 Like