Delete individual device (and entity) from integration

Tags: #<Tag:0x00007f739a310de8>

Unfortunately, the following topic:‘Delete individual device from integration’ has been closed, but with a mentioned resolution that doesn’t solve the initial problem. The solution mentioned is about deleting entities, not about deleting devices.

Problem:
When I connect an MQTT device to my MQTT broker, the device shows up in my MQTT integration because of my auto-discovery, no problems there. But if I want to remove an MQTT device from this integration, that is not possible. I can delete the entities which are listed under a device, but that won’t delete the device. I can delete all the MQTT messages (also retained ones) from that device in my MQTT broker, but that won’t delete the device.

Feature request:
It would be nice to have a delete button within the device’s screen popup. The same as it’s with the entity’s. When deleting a device, all the entities of that device would be deleted automatically.

Current workaround:
I empty my MQTT broker of messages which were sent from the device, then I use the configurator plugin to edit config/.storage/core.device_registry where I carefully remove the device. After a reboot of home assistant, the devices are gone.

In the pictures below, the 3d_printer is actually a sonoff basic running ESPhome with MQTT connection, not using the API.

  1. This picture is when you click the settings icon next to the entity itself
  2. this picture is when you click the settings icon on the device itself (top right corner)

Yes it will.

  1. Delete retained discovery messages from the broker. Topic = homeassistant/[integration]/[entity_id]
  2. Delete Entities from Home assistant.
  3. Restart Home Assistant.
  4. Entities gone.

Yes, that deletes the entities. That is however not my request. I’m trying to delete the devices.

I don’t have the [integration] list in my homeassistant/[integration]/[entity_id] path btw.

mqtt

If I follow your steps, reboot home assistant, the device is still in my MQTT integration, but without entities.

I can see three in your screen shot.

sensor

binary_sensor

switch

Yes, and inside sensor, binary_sensor and switch was indeed a 3d_printer, which I removed.

so I removed homeassistant/sensor/3d_printer, homeassistant/binary_sensor/3d_printer, homeassistant/switch/3d_printer.

I actually deleted everything which said 3d_printer.

With [integration] I thought you meant MQTT.

Top right hand side of the integration view (before you click on it to view the entities) there’s a trash can for deleting the whole device:

afaik that deletes the integration, which deletes all my MQTT devices in that integration. The device 3d_printer is not the only one in there, but it is the only one I would like to remove.

That’s why I would like to see a delete button on the device itself, just as it is with the entities now.

1 Like

This issue is a generic issue and not just related to MQTT

It is the same for example in Deconz.

If I delete a smart plug from Phoscon and Deconz then the device is not deleted from Home Assistant.

I can delete the entities but that is not the same!!! Not the same!!!

There will still be a device left behind which is visible in the .storage/core.device_registry

Many will probably just ignore this. But it is wrong to leave this cruft behind. I have personally removed at least 15-20 devices that I used and then replaced by something better or more stable. I would have all these ghost devices all over the place if I just ignored it. I am sure over time they cause stability problems and for sure you get name clash issues. So they have to be removed.

There are two ways to remove these ghost devices.

  • 1 Delete the entire integration that added them. Good luck if you have many devices and have renamed many of them in Home Assistant. When you add devices in deconz not all of them can be renamed in Phoscon. There are sensors associated with the devices that cannot be renamed. It is a heck of a mess to remove the integration and add it again. And I am sure it is the same with other integrations.
  • 2 Hack the .storage files. I advice to remove the entities using the user interface and only remove the devices. Make a backup first!!! Then stop home assistant. And then you edit the .storage/core.device_registry. Make sure not to goof the JSON. Pay attention to the commas. Especially if you delete the last device in the list. No comma allowed after the last device. Then restart Home Assistant again

Horrible! Just horrible.
What we need is simply a delete button when you look at the device in the integration, or when you look at the list of Devices. Just like it has been implemented for integrations.

16 Likes

Not only in .storage/core.device_registry, but also in the GUI.

I’m seeing something similar. I’ve got a ghost device named Unknown Node 12 that has empty device info (see pics below). I have no idea what this device is, nor is there a way to delete it in the entities screen (it doesn’t show up there). At the moment, it’s more annoying than critical, but it would be nice to be able to clean it up.

1 Like

Yeah it’s the same problem. Don’t forget to use the upvote button on top of the page :slight_smile:

1 Like

Yeah same problem here with Deconz integration. I remove my old devices in the core.device_registry in .storage folder.

Hope this will get solved soon. Only thing missing prior to 1.0 release from my point of view. :slight_smile:

I ran into problems when I tried to remove a deconz device and later add it again with the same name.
Had to remove it manually from .storage/core.device_registry

1 Like

I have the same problem. I’m thinking of making an Hassio addon to cleanup zombie devices in .storage/core.device_registry :confused:

4 Likes

I just noticed this message in my log’s, awesome it’s notifying me of this. But there is no way to actually delete the duplicate device.

I somehow manage to get orphan devices, I mean, does it make sense to have a device with ‘No integration’?
I have lots, some of them of UPNP I guess, others ESPHome and some old iPhone too, not sure if Mobile App or older, I also have some duplicate devices.

I even have some decies with two same integragion, “ESPHome, ESPHome” listed in the integration column

Now that HA is more device-centric (automations e.g. which is good) this should be more self-curated

I’m running into the same problem as well, mainly with ghost ZWave devices. I removed the related entities but I cannot remove the devices themselves. There is no way for me to remove the entire integration (it has been too pain in the a** to get it working again after the upgrade to 0.107.X).

I cannot find .storage/device registry files anymore. Do you know where they are located now? I’m running 0.107.5?

The feature request about deleting device seems to have been implemented. However, I cannot see any feature anywhere in the UI :frowning: Thoughts?

2 Likes

I’m 0.107.3 now. I deleted orphan entities yesterday following the post above
I tried to use the “File editor” add on at first but the files are not shown, I ended up using Visual Studio Code. I also had to change write permissions for some files using chmod o+w

1 Like

Thanks! I did not notice that .storage folder had different permissions.

1 Like

Another example:
I deleted my life360 integration, since i’m only using the build in GPS tracking in the HA apps. It did delete the life360 devices in the ‘Devices’ list, but i’m stuck with 3 entities which are in ‘read-only’ mode, so I can’t delete them? HA tells me the entities don’t have a unique ID, so they can’t be managed from the GUI. But the entities are also nowhere to be found in my .yaml config…