WTH Delete devices from GUI

UniFi integration should clean up after it self when the user remove a client from the controller.

funny thing at my system when using deconz integration and unifi integration is that when clicking on the deconz integration and the filter is filtered on ‘deconz’ it is also showing the unify controller in te list :stuck_out_tongue:

I think there’s been confusion about this. For example, I raised this issue about the Tuya integration not cleaning up devices but was told that, when the PR to enable config flow was made, they were asked to remove the cleanup code since the devices would be cleaned up automatically as a result of another PR which had been merged.

@Robban I just had to manually delete 6 devices from core.device_registry

They were all called unknown device and a record typically looked like this

            {
                "area_id": null,
                "config_entries": [
                    "4154b4ac75fc4ce49ab03078ff1dae7c"
                ],
                "connections": [
                    [
                        "mac",
                        "9c:8e:cd:08:cc:81"
                    ]
                ],
                "entry_type": null,
                "id": "f57a7c42954b4bea92f892a13b0d42ea",
                "identifiers": [],
                "manufacturer": null,
                "model": null,
                "name": null,
                "name_by_user": null,
                "sw_version": null,
                "via_device_id": null
            },

They were just cruft waiting to be deleted. Some had disabled entities and I could see from their names that they were actual old devices. Most were Apple related.

It is just another example of having to hack core.device_registry to get rid of devices that no longer exist. There should be a DELETE button natively in Home Assistant so you can get rid of the cruft.

As of today there has been no activity on the Deconz integration bug I raised. You still need to hack a JSON file to replace a light bulb in Home Assistant and I had to do it again the other day when I retired a device because I got a new and better for same lamp.

1 Like

Real life gets in the way now and again

2 Likes

The activity I hoped for was a simple acknowledgement of the bug being a real bug that will eventually be addressed.

Q: How many Home Assistant users does it take to change a light bulb?
A: None. We just tell the users to buy a new lamp and throw the old one in the corner of the living room?

Q: How many hours does it take to replace a light bulb?
A: 30 hours and 1 minute. 1 minute to replace the physical light bulb and 30 hours to read the entire official deConz thread on the forum.

Q: How do you give an old broken Philips Hue light bulb a proper funeral?
A: You just throw it in the garbage bin. The memory of its former glory will last forever in Home Assistant

Q: How do you recognise the current light bulbs from the old zombie light bulbs in Home Assistant
A: The old ones have swear words as names.

Q: Why do you have an area called Saint Paulus Cemetery?
A: That is where I move my devices that are dead and cannot be deleted

Q: Why are your light bulb jokes so pathetic?
A: Because I am an engineer
A2: Oh, I am sorry. I did not know

17 Likes

Hi all,

I noticed that also Chromecast integration has the same bug. Old devices no longer available are shown in gui.

So I opened an issue:

This is one of the most what the heckiest thing in hass. Almost every integration is affected.

I assume, that not always an integration can understand that a device is old or replaced and should be deleted. That is why we should have a way to do it manually for any integration and any device without editing JSON configuration db.

Let’s free home assistant from legacy devices!

2 Likes

Great! :slight_smile:
In 0.116 I deleted a device in deconz and ran the new service “deconz.remove_orphaned_entries”. And now the device is gone in HA!
No need to edit the core.device_registry anymore! Thank you, thank you, thank you! :slight_smile:

2 Likes

Thanks for verifying :slight_smile:

@robban I also want to give feedback. First thanks for addressing this really annoying problem

I have tried this a few times. It sort of works but not as I think people expect

First - I tried the feature of disabling new devices automatically. When I disaable this then I can add new devices and rename them before pulling them into HA. That is great. But once I have renamed it it is hard to pull it in. The deconz.device_refresh does not load the new device. I tried several times. I had to restart HA to get the device loaded.

Then I added the new device (a light bulb) and removed it again in the Phoscon app.

And then tried the deconz.remove_orpharned_entries and a device was removed. But not the new one. I never found out what is missing. Maybe another orphaned device I had forgotten about. Another restart of HA and then again deconz.remove_orpharned_entries and then it removed the device.

So much better. But that need to restarting HA is a bit strange. And from a UI point of view, the Deconz integration (and integrations in general) really should have the buttons visible to do these actions. Having to go to a geeky developer tool is not very intuitive. You have to know. But that is a generic HA problem.

In any case - it is MUCH BETTER than before. At least I do not need to hack JSON files when I remove Deconz device and that I am very thankful for. The rest is constructive feedback

1 Like

The disabling works by just ignoring signalling from the library, the data already exist in the current structures. That device_refresh then doesn’t catch the new ones is a bug missed behavior, its probably because the service logic compares what the library knows before polling deconz manually rather than looking at what is registered in hass and not. Create an issue for this please.

Yes the removal of entities currently requires you to at the least reload the integration first, because there is no mechanism right now that updates the library based on things removed from deconz so if the library has seen the device it will be there until a reload.

The generic clean up button from the GUI is complex because there needs to be integration specific logic to handle special cases unique to each (or not) integration. Earlier the registries properly automatically removed orphaned devices when entities was removed (also on restart). But since the system needs to consider there are devices not belonging to entities (the service itself) you can’t take this general approach if you want to cover all cases.

I haven’t gotten much traction yet on exposing this per integration, I will return to this topic since I need to make sure this works properly with UniFi as well, I might talk more directly to Bram or Paulus about it, I know dmulcahey saw the relevance in implementing support for ZHA at least.

Thanks for the feedback <3 !

1 Like

Why don’t we still have no integrated method of deleting devices from an integration. I am using the mikrotik integration and it added numerous (undesired) devices and entities when using auto discovery (now turned off to avoid further mayhem).

I have now deleted 6 times a number of entries (devices and entities) from both core.device_registry and core.entities_registry manually and even deleted all but one (in use) from known_devices.yaml. On HA restart these device are added back in again. This is a PEST if even manual deletion doesn’t work anymore.

Can somebody explain why even after manual deleting entries from device and entities registry they magically reappear and when are we going to have a comprehensive way of deleting unwanted devices.

1 Like

So the moral is post an issue on github, or better still, a PR :slight_smile:

I think this whole thread sums it up quite clear; Don’t leave this up to the integration! Instead provide a delete button which will remove any device and/or entity from the HA registry. Be it an active, inactive, dead, removed or orphan entry. Then it’s up to the user to make sure it is also removed everywhere else, otherwise it may well reappear upon the next reboot due to autodiscovery - which is just fine.

If the HA-Dev team continue to point their finger at every integration, this will be a never-ending-story.
So, put an end to it - please.

8 Likes

Hi,

I still have the issue with not being able to remove a device…

Could someone please summarize a “step by step” how this is done using the previously mentioned services “deconz.device_refresh” and “deconz.remove_orphaned_entries”? I tried it several times with restarting the HA also. I guess I’m doing it in a wrong order or something :slight_smile:

Thanks in advance!

2 Likes

Using the deConz zigbee with an conbee 2 I have serious issues regarding that I needed to remove several lights from Phoscon (conbee 2 GUI app), but the devices are still visable in HA.
I tried the deconz.remove_orphaned_entries but I can only click the button on that page because I dont know if I should input more info in the command text line below that text…

PLEASE someone advice on how to use that function

1 Like

Hi There
The same problem with removing devices.
Help!

Did you follow the advice in the docs?

1 Like