For unknown reasons, I ended up with hundreds of RM174RF sensors added to Home Assistant (via RFXtrx integration) - we’re talking hundreds of Smoke Detector devices, consisting of more than 2000 entities.
Currently there is no way to mass-delete these non-exists devices. When I try to delete one, I get:
Device / service not found
The best I can do at the moment is to click each device in turn, and Hide it. This is neither practical nor correct.
I run an SDR with rtl_433 streaming over MQTT into Home Assistant. It allows me to read from all of my utility meters, as well as snoop around the neighborhood’s RF signals (I found out my neighbors have some great outdoor temperature sensors I can read from).
It’s a really good setup, but it does result in a lot of devices getting created by the MQTT integration. Unfortunately, even without the MQTT retain flag, Home Assistant still retains the device. So, I literally have hundreds of non-existent devices listed in my instance… and I can’t mass delete them. It’s really annoying.
Yeah, running OpenMQTTGateway in an ESP32. I have thousands of ghost devices which cannot be deleted. Also losing the actual devices in the mess when they get re-added with an incrementing number tacked onto the entity ID and HA keeps using the old ID and doesn’t see the device any more. Pretty much useless.
Because this issue has not been fixed yet, I have created a Python script that can bulk remove devices based upon a given field. It helped me remove all of my useless devices and get my device registry cleaned up.
While developing stuff in ESPHome I often end up with orphaned entities I can’t delete. Sometimes I have to reboot for them to be deletable, in other cases I have to remove the esp device and add it back.
EDIT: Apparently this script can’t remove fields with null as the value
EDIT 2: I want to remove all devices created by browser_mod, so I entered these as second and third parameter: identifiers browser_mod, the created file will contain all existing devices except those created by browser_mod
After looking at the source code and tried a couple times, this is what I did:
using FIle Editor Add-On I created a file in python_scripts folder, I named it bulk_remove_devices.py like the original file. I just copy and paste the code and save the file
then still from File Editor Add-On, from the gear pull down menu I clicked Execute Shell Command menu
then I add these three parameters after the .py above, add space in between: /config/.storage/core.device_registry <field_name> <field_value>
replace the <field_name> and <field_value> with values that you want to remove. For me, I want to remove all devices which have manufacturer field equal to null
Thanks for sharing this script but I think for me the script isn’t working because the values change too much every added device is added as a smoke_detector and then with a different number. It would be nice if there would be a more simple solution, so that’s why I upvoted this topic.
i´m in the same boat, with unwanted 433 devices flooding HA.
it would be good to implement multiple choice buttons in the list to allow mass selections / operations.
(and my be deletions should go to a “trashbin” first before final purge )
I’ll add another WTH. I have 650 rtl_433 devices that I need to purge. I don’t see that this would be difficult to add to the UI as there is a list to select devices in bulk, but no way to delete the selected ones, but you can change their area and whatnot. Most people probably don’t need to delete this many entities at once, but those of us that need to, it’s a serious problem.
Echo the need to be able to select-multiple devices/entities and delete (or take any mass action).
I have worked around this by using a mouse-click macro recorder to record myself deleting a single device and then repeating the action 10, 50, 100 times – but it’s a clunky hacky solution and there should be something more elegant baked into the UI.