How to remove unwanted entities?

I paced bluetooth low energy in my config yaml and it found a lot of device tracker entities. They do not have unique IDs and cannot be edited. I removed ble from my config and restarted, but the entities are still there. How can I remove them? I haven’t used any in automations. Thanks.

3 Likes

Maybe this is of any help:

Are they listed in Configuration → Devices and Services → Entities?

If they are, look at the icon in the entity’s rightmost column. If it’s a red dot with an exclamation mark, click it and the resulting popup should offer a Delete button.

They are listed in Settings>Devices>Entities, but the icon is of a lined-through pencil, indicating read-only.

These are not listed in either registry, example of one being ble_01_9b_ae_e2_c9_eb. They are listed in a file called known_devices.yaml, which I thought was being deprecated. Should I delete them from there?

I deleted them from known_devices and, after a couple of restarts, they went away.

3 Likes

I don’t have any file named ‘known_devices.yaml’ is there any other fix?

I experience the same problem, especially after updates or reboots. However, I have found a solution for myself, combining the different recommendations here in the board. I’ll try to summarize:

  1. I try to identify the unwanted entities by their name in the database, especially entities with _2 or _3 at the end
  2. I go to “Development tools” → “Services” and select “Purge Entities”
  3. I select the entities I want to remove, sometimes I select the correct entities and the corresponding entites with _2 and/or _3, eg. sensor.test and sensor.test_2. I’m not sure if this is necessary.
  4. After having selected all entities I execute the service
  5. I reboot HA and close the browser (or clear the browsers cache)

After HA is up again, in most cases the unwanted entities are gone!

11 Likes

I was just struggling with this too with a template fan that I had in config.yaml. What finally worked for me:

  1. Add the template entity (or at least something that will have the same entity ID) back to the yaml file it came from.
  2. Then do a “quick reload” of the yaml configurations. (A full restart would probably also be fine here.)
  3. Then delete the template entity from the yaml file, and then do another “quick reload”. (DO NOT do a restart here before the “quick reload”.)
  4. Now the entity should be gone, and you’re free to do a full restart and it won’t come back!

Seems like a really obscure bug, but maybe they can fix it.

5 Likes

Isn’t there an integration or hacs / add-on that finds inconsistencies in code/orphaned items?

4 Likes

On a related topic, I also activated the bluetooth BLE device tracker and I now have hundreds of entities that I am stuck with. I’d love to say I’m exaggerating, but I can barely believe it myself. There are literal hundreds of entities. Any idea how to bulk delete them?

2 Likes

check if you have the “known_devices.yaml”
They come from this file delete them and you should be good.
Check the device_tracker settings and ensure it doesn’t add new devices, otherwise it will add every car and drivers phone and any other device with bluetooth enabled that drives by at your house

3 Likes

None of the methods above worked for me. Where is known_devices.yaml located? I read that known_devices.yaml was being phased out?

Removing all entries from known_devices.yaml worked for me. I had played around with the BLE device tracker a while ago and left it running, over time it had put 1,000’s of BLE device entries in the file. After disabling the Bluetooth LE Tracker service in my configuration.yaml, clearing the known_devices.yaml, and restarting HA, the entities are gone and the startup time and overall performance seems to have improved dramatically.

Had a similar issue with zigbee devices. I added three temperature sensors but renamed them afterwards. I clicked something like “rename entity” in the pop-up window after “update” on the device property window. The old named entities still existed afterwards.
I tried the steps from @WebSpyder → “Development tools” → “Services” and select “Purge Entities” but marked only “Entity globs to remove” and entered “test-th*” since all three sensors followed this same pattern. After a click on “CALL SERVICE” all the old unwanted entities was removed.

But I noticed that a 4th device that I renamed but not matched the pattern was also removed… So I am not sure if the pattern did anything but it worked for me in the end.