Hi, I wanted my smartthings sensor to show up in HA so I setup the integration. Unfortunately it automatically added 25 device and I really did not want all of them as some of them are already integrated in HA locally via other integration.
First I tried removing them in ST and the click the reload button on the integration. no dice they are still in HA, which is even worse now, because now they don’t even exist in ST so they will always be unavailable.
I then tried to remove the entities and reboot HA as suggested in other thread, but the devices are still there… Are there really not just a simple “delete device” button? That seems very strange
You have a couple of options (I think, as I also don’t use smartthings but have run into similar situations with other integrations).
The first and easiest option is to simply select all of the entities (or devices maybe) and the in the top right there should be a box with one option to “disable selected”. They will still technicall be in HA but they won;t show up anywhere except the storage files and they will still show as existing in the devices page under that integration.
the other option is to do as Burningstone suggested and remove the integration, verify that all of the associated entities are gone and then re-add it. If you are using the original default entity_ids and didn’t edit any of them when you re-add the integration it should re-add the entities just as it did before.
alright, I really don’t like having stuff laying around in DB which has no use or shouldn’t be there. so option 1 is a no go for me.
option 2 will be what I will go for.
I must say I find it strange that such a trivial and basic need as deleting a device is not an feature. there must be a reasoning to it… like the device id can be used in a non relational way, and therefore deleting of that device wouldn’t cascade correctly into all the places it is referenced. but that sounds like a major architectural issue IMO, so I kind of hope that is not the case.
I’m not sure that there is a good reason but there is a reason.
A while back the decision was made that users shouldn’t ever decide what data should be included from integrations. The integration should always provide all of the data to the system and then the user can decide if they use it or not. So, you, as the user, have only one option if you don’t want to see the entity and that is to hide it by disabling it (or again, remove it from the data that the integration provides upstream then remove/re-add the integration - but that’s not very satisfying to me either.)
My Unifi integration config shows every entity it’s ever discovered (all 91 of them) but I only have 17 of those actually listed in my entities page and that I’m actually interested in using. The rest are “disabled” - gone but not forgotten…
You can do a search on the topic of the Unifi integration in the forums to see a few threads that I’ve been involved in voicing my opposition to that functionality but I have been summarily dismissed and told “this is the way it is and will stay”. So occasionally I need to go thru my entities list and disable a bunch of discovered entities from that integration.
wow, that is incredibly surprising to me. At the very least… the devices should be removed from HA when the integration does not provide them anymore, this is not even the case. I deleted the items in ST (although I didn’t want to… I just wanted them out of HA) but they would still show up in HA as devices unavailable…
Here’s a better reason to have it that I just ran into: I updated the firmware on about a dozen Aeotec Z-Wave devices. To do this, I had to exclude them from the network, update the firmware, then include them in the network again. But when they’re included back, they get a new Network ID and those are new devices in HA. Those devices should never ever exist with those IDs again, but their ghosts will remain forever. Stupid.
Here is another use case. When I replace my IKEA Tradfri control battery I need to add the control back to IKEA --> new device in HA. I can easily rename the entity, but get stuck with the old device which I can not remove.
So… still no way to delete devices? I have a bunch of devices I’d want to delete from deconz integration and can’t find any option that doesn’t include hacking into system files.
I just got rid of a bunch of x10 devices that were piped in from HABridge. It really sucks that I cannot clear them entirely from HA. This seems like poor database programming to me…but who knows. Perhaps switching the DB to PostgreSQL or MariaDB would make that easier?
# Ensure every device associated with this config entry is still in the list of
# motionEye cameras, otherwise remove the device (and thus entities).
for device_entry in dr.async_entries_for_config_entry(
device_registry, entry.entry_id
):
for identifier in device_entry.identifiers:
if identifier in inbound_camera:
break
else:
device_registry.async_remove_device(device_entry.id)
I managed to remove a smartthings motion sensor from HA by deleting the device from Smartthings, then going into entities on HA and ticking all the boxes (3) that applied to that sensor. Then in the top right I had the options of exclude or delete from HA. I clicked delete and it worked fine.
I tried to take this issue with a tad of humor in a similar thread
That said
When you have deleted a device from Deconz you can run the service
deconz.remove_orphaned_entries
And then boot HA.
That should get rid of it
But there are still many integrations that leave garbage behind and it is still a major flaw in the generic HA UI that you cannot force a device deletion.
I find myself editing the .storage files at least once every 2nd month. There is always something that is broken that I can only remove this way.
Before anyone does this ALWAYS make backup of the files and watch out for the commas. Note that the last item in a list does not end with a comma in the json files. If you forget HA will not start. Any error in the JSON and HA will not start.