The idea is that devices are fully managed for you. They get created by integrations and get automatically removed when an integration is removed. If an integration is changing the devices it exposes (ie you remove a Hue bulb), it’s up to the integration to clean it up. If this doesn’t happen, it’s a bug! Integrations should clean it up. For MQTT we realized that this didn’t work, and so for MQTT there is a delete button.
Deleting a device that is still “active” will re-appear on reboot.
I understand your point and I (probably) agree.
Then it is a bug in the deconz integration that needs to get fixed. Who is maintaining the deconz integration? Since it is a “component” integrated in HA I guess it could qualify for WTH month?
The only integration I can remember having a delete device feature is the Mobile App (IOS) where I happily found that buying a new iPhone did not mean hacking JSON files. And that is a new thing added recently
How many Home Assistant Developers does it take to change a light bub? 10001. One to hold the light bulb and 10000 to turn the house around. Yes old joke.
How do you change a Philips Hue light bulb running in Deconz in Home Assistant?
Deleting it from Phoscon does not remove the device from Home Assistant. It lives on as a dead device forever. The only user interface way to get rid of it is to delete the entire integration which deletes all devices and all entities. And when you add it again, God save you if you had renamed any of the devices or entities. You will have a mess to clean up an hour in automations and Lovelace UI elements.
Another unacceptable way is to rename the old device to some dummy name and accept that your Home Assistant installation gets polluted with more and more no longer existing devices. I would have at least 50 dead devices like that now.
If you want to remove 1 device from the Deconz integration you have to delete the item from .storage/core.device_registry and restart Home Assistant while you pray that you did not miss a comma or deleted one to many. And then you can add the new device to Phoscon. And you have to do it in that order because you cannot name the new devices the same name as the old without getting _2 appended to all entities and then all your automations and Lovelace UIs are screwed.
It is really yet another light bulb joke the way this works in Home Assistant.
I have personally had to do this several time just the past few weeks. I have had a couple of light bulbs burn out on me. They do not last forever. And I keep on replacing remote controls with newer nicer models. We home automaters always tinker with things. It is in our DNA. I have Zigbee lights and Zigbee sensors, and Zigbee sensors in the entire house (“Oooh the Zigbee”). 98 Deconz devices with its 142 entities. So there are always things that get changed or break down.
So I end up hacking that darn .storage/core.device_registry several times per month.
It is only the integrations that add multiple devices that are a problem
For example my Logitech Squeezebox integration adds one device. It is not a problem deleting this device by deleting the integration.
The problem in my installation is the Deconz integration and the Unifi device tracker integration.
There is a missing user interface element in these two integrations that allows deleting a device.
@balloob Does Home Assistant even offer a Lovelace UI feature for the integrations to add a button for deleting a device? Is there an API for an integration that can remove a single device? I find it strange that NONE of the multi-device integrations I have tried have the feature. And non have made a custom component. I agree that it is the integrations that need to handle deleting devices. But are the APIs and UI elements even available to the integration authors?
There are two feature proposals for this
which was closed with the wrong reason. The person closing it mixed up deleting entities and deleting devices.
And then a new was opened
I cannot understand why HA only focus on adding a device and misses the feature of removing a device again without - like in my case - deleting 98 devices and 142 entities.
I read many of the WTHs. This is the most important one in my view.
Maybe there needs to be better documentation around this? It isn’t obvious to a user that this is the case. But where does it go? This page titled devices is about adding integrations. Then the last example is about entities, but still calls them devices. I can submit a PR to clear this page up. But it is unclear to me where the documentation on actual devices lives.
I myself spent a long time wondering why my mobile app integration had two devices for my phone and why I could not simply delete the old device that was orphaned with no entities.
There were additional bug reports but specifically related to not being able to delete group devices (which are just light devices in Deconz)
and in this closed bug report it is confirmed that you have to delete entire integration with some note about being fixed in next release. Obviously this did not happen since we still complain about it
Others should raise bug reports for additional integrations. Make sure to raise it against the integrations and not the addons.
I use the MQTT integration but with auto discovery disabled so I cannot confirm if this is still buggy. Can some of you with that problem confirm and raise bug reports against it?
I remember Philips Hue integration having same issue. But I have thrown out my Hue hub and gone all in on Deconz. So I cannot confirm that one either. Can you delete a device in the Hue integration? Does it get auto deleted if you remove it from the Hue hub?
If I update a device name (ex - because I moved a light switch to different room) through the device manufacturer app/web service/etc, HA does not update the entity_id/friendly names/etc to reflect the new name.
If I could delete the HA device, restart, the integration should recreate the device and entities to reflect the new name.
At least in this use case, you can rename the device in Phoscon.
And after that renames the device in Home Assistant. Both device and entities. There is a user interface for it. And actually for Deconz adding a device causes it to be pulled into Home Assistant when it is discovered with its default name. You can rename it all you want in Phoscon. You still need to go to HA and rename it there.
Exception is event names. They update as they are actually not stored as entities. They exist when the event happens and that is it. But the battery sensor name will be some default you have to rename after adding it
So this use case is actually not an argument why we need to be able to delete devices.
You could argue that renaming a device in Phoscon should rename it in Home Assistant. That could become a major breaking change for many of us that have renamed entities to an overall naming scheme. I am not sure I would like that.
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