How to restore deleted device?

Hello everyone,
I deleted a device I no longer have but I want to access the data, which is still in the database. I mistakenly deleted it instead of disabling it.
Does anybody know how I can restore it?

Thank you
Alex

I found the way!
Simply deleting the deleted device record in .storage/core.device_registry doesn’t work - HA will not start even that “Check configuration Yaml” will tell you that “Configuration will not prevent HA from starting”.
You need to edit .storage/core.device_registry, find your device in deleted_devices and change device’s Mac address and identifiers to something else.

How do you mean?
When you change the mac and identifiers, the device will be restored even if it no longer sends data?
Or do you mean that it will be restored when it sends data?
Because any deleted device will be re-added when it is rebooted. At least my tasmota and shelly devices always are.

HA does not have un-delete functionality. Once device is “deleted by config”, no matter if you reboot HA it will remain ignored and not re-added because the entry in core.device_registry tells HA to ignore device with this MAC and ID.
Simply deleting the deleted device’s record in core.device_registry under “Deleted devices” will not work and prevents HA from starting.
The only way to get it work is to change deleted device ID and MAC address to something different and restart.

Not true. At least not for e.g. tasmota devices. You can delete them but they will be re-added whn they are restarted. At least when you change any of the mqtt friendly names of the device. Have not checked yet if it also works without that change.
But the unique identifiers like mac etc. don’t change. So HA could recognize them if it wanted to.

Bit lost here. I have a deleted device that I want restored. If you can change/adjust the mac id in core.device_registrythen that’s fine. Where do I find that file and how do I get to it to make the adjustment?
Thanks

Depends on your installation method.

The file is in /config/.storage

You need to either

  • ssh to the server wirh something like Putty
    or
  • install an addon like Visual Studio Code on HA (only possible for e g. Supervisor installation)

What system are you running HA on and what kind of installation method did you use?

Thanks Alex for coming back to me on this. I have found the entry pertaining to the device in core.device_registry. Is it just a matter of changing the MAC address there or is there something else I must do? I am running supervisor on a NUC and editing the file via visual studio.

What exactly would you line to do? Keep the information and just reassign to device with different mac? Then from memory you just need to delete that mac.

But maybe backup the file befoe you do :wink:

Thanks Alex for your help. All fixed.

1 Like

yeh this messed up my home assistant. thanks for that, why is this the top google result?