Summary: Failed smart socket (power monitoring, Tasmota). How to replace with a new one, maintaining the power monitoring data for energy graphs
I have reviewed documentation, but it seems geared towards initial setup and then everything working happily forever . I’m more than happy to be shown to right docs or even to write them up if I understand it well enough after we’ve solved this.
Detail:
One of my power monitoring, switched, smart sockets has died and I want to replace it with the least disruption to my Home Assistant setup. Especially as I expect to have to do this a few times a year as these devices age out and fail.
Updating the automations and groups is fairly trivial, but it’s the energy graphs I’m concerned about.
I want the new device to be recognised as the old device or at least for it to be transparent to the UI as a continuation of the old device’s data. This is mainly so that I can continue to seamlessly compare the energy usage of (in this case) the dishwasher over time.
I just noticed something else about your setup. last_reset is deprecated. I don’t believe that is actually and issue but you should know This approach has been deprecated and will be interpreted as a total_increasing state class instead with an automatic last reset.
Thanks for the guidance @giqcass, this worked quite well.
Shutdown Home Assistant
“core stop” from console (connected via Synology VM manager)
For the old device:
a. I deleted the old device’s entries in core.entity_registry and core.device_registry.
b. Noted the entity_ids of each
For the new device:
a. Updated all the core.entity_registry and core.device_registry entries editing the entity_id property to that of the device/ entity each was replacing
Started Home Assistant
a. “core start” from console (connected via Synology VM manager)
What I didn’t mention is that I was re-purposing another smart plug which had already been used. Unfortunately it was reading 40kWh and has over reported this to HA Energy. No big deal, but worth mentioning in case anyone else reads this who needs to do the same.
I suspect that I might have been able to avoid this with some manipulation of other properties or a DB change, but I would advise others to reset the counts on the smart plug device manually to avoid this issue
For anyone who stumbles across this today in 2024, this is something which you can now do in Home Assistant. The step by step details are here (the very first Q&A at the top of the page explains how to do it). Ignore the note below step 7 about the new entity ID not being able to have statistics associated with it already - my new energy monitoring entity had some new data (about 30 mins worth) and it seems to have transferred all the historic data across from the previous device with no issues. It’s essential you copy-paste the OLD entity IDs into a notepad or similar, though, and DO create a backup of HA before deleting the old entities, because if you don’t, and you forget what the old entity IDs were, you’re screwed.