I’ve now been using home assistant for several years and most of the early challenges and learning-curves have been over-come. However, there has been a long-standing issue that is a constant frustration — removing old devices doesn’t have a standard approach and in some case is impossible from the GUI. There is a way though.
Devices (and entities) can be deleted (or modified) the manual way directly from home assistant system files. Some of the files which you might need are called core.device_registry and core.config_entries core.entity_registry. These are located in \config\.storage\ whcih (as a windows user) I access via the “Samba Share” supervisor add-on. If you don’t have supervisor you may need to access these files a different way.
I used this to remove a dead Drayton Wiser TRV from HA — by deleting the whole relevant section from core.device_registry…
{
"config_entries": [
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
],
"connections": [],
"identifiers": [
[
"wiser",
"iTRV-2"
]
],
"manufacturer": "Drayton Wiser",
"model": "iTRV",
"name": "Wiser iTRV-Dead",
"sw_version": "xxxxxxxx",
"entry_type": null,
"id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"via_device_id": null,
"area_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"name_by_user": "Dead TRV",
"disabled_by": null,
"configuration_url": null
},
And also 2 sections (for the 2 associated entities) from core.entity_registry (I haven’t shown these as they should be obvious — the format is the same as above with the sections enclosed by curly-braces)
Other uses
I have also used changes to core.config_entries to change the IP address of an onvif IP camera which home assistant was refusing to connect to after the IP changed. The same is no doubt possible for other devices.
Thanks ! it works for me!
On debian, use /usr/share/hassio/homeassistant/.storage
I have succesfully delete 7 old devices kept in agentdvr intégration