I was playing around with the device_tracker with owntracker and suddenly it created some “personas” in my home assistant, which for the life of me can’t find out how to remove.
I’ve tried even deleting manually from the sqlite database with no success.
Any pointers?
P.S.: I’m quite a new home assistant user (newbie) so excuse my possibly dumb question.
after debugging via the source code, it turns out that the only way to remove a rogue tracker was by editing the core.device_registry and core.config_entries files in the …/.homeassistant/.storage folder.
I located my old device there n deleted its whole JSON entry.
Do it at own risk and keep a backup please of your whole storage folder cause im not sure on the side effects this may have caused.
If someone know a valid way to remove a device tracker (i.e. via the hass UI) please share it.
Sharing a script I have for purging device_tracker entities from the .storage/core.entity_registry file.
USE AT YOUR OWN RISK–THIS IS NOT A UI TOOL AND IS FOR ADVANCED USERS WHO KNOW WHAT THEY ARE DOING
You can download the script from the Gist below, edit the first two lines for the path to your config and entity_id regex pattern you want to remove. By default it removes ALL device_tracker entities and let’s them regenerate when you restart Home Assistant.
Download to somewhere with a) python3 and b) access to a copy of the core.entity_registry file. Suggest you run it on a copy first!
Run with ./device_tracker_purge.py or python3 device_tracker_purge.py
Check that the right number of entries were deleted.
Copy file back to your config directory (overwrite the existing)
Restart Home Assistant
In theory, this can be used to purge any specific entity_id pattern, not just device_trackers, but you should be using the UI whenever possible!
I pulled my hair out trying to get rid of own track device_tracker entities and devices. What I did:
Remove Own Track integration
Remove Mosquito integration
Purge MariaDB database with keepdays:0
remove Mosquito addon
ssh into host
find homeassistant docker id
docker stop #id
go to config/.storage and find the relevant entries inside the storage files. I found them in core.device_registry and core.restore_state
take a backup of these files
delete the entries you want gone while keeping the syntax.
save the changes
reboot the host machine
reinstall Mosquito addon if you want
I’ve stumbled upon a rather easy way of purging known devices… at least for the nmap integration, that now uses Config Flow instead of known_devices.yaml. Perhaps this would also work for other device_tracker integrations?
I needed to update my nmap configuration’s list of IPs to exclude. After doing so, it seemed to have wiped and re-created the device registry. I had lots of “stale” device entities I could easily remove.
How about removing the entities the device tracker picked up?
Some device around here seems to change his mac and I have several thousands or ble_ devices in my HA. I cannot figure out how to remove the entities
I deleted the extranous entries from known_devices file and restarted, but the entities are still there
I change my phone this week and the only way I found to remove the old device_tracker was to search for the device name in all config files (core.entity_registry, core.device_state, …) and remove manually the records found.
After a restart It have disappear from entities
Here is something I figured out.
Even if you rename/remove old device trackers, they may still have entries in your Recorder.
So run the following service (at your own risk, in my case I didn’t care what “iPhone” data was deleted, I wanted it all cleaned up):
I found this and other threads and was partly able to solve my problems with numerous device_tracker entries. My main problem was I left “track_new_devices: true” for a year or two. With a Rpi4 with SSD it wasn’t a visible problem until there were some 75000 entries in known_devices.yaml…
The solution I made is a python program that purges all entries that relates the BLE trackers.
You can find the code at my Github project including instructions how to use it. The visible result for myself is that HA generally is much more responsive, and Developer Tools|States doesn’t time out anymore.
Hi,
I had the same problem, I left track_new_devices: true for a little to long, and after I realized I was unable to even scroll through the whole list.
This solution solved it, but as target is now required in service call I wanted to share example syntax that worked for me. Maybe someone will have the same issue.
I’m wondering if anything different is needed for this now?
I’m on 2024.03 with this issue, and not having any luck with the above suggestions. I’ve cleared all the BLE entries from known_devices (which I can see remains trimmed down), and run the recorder.purge_entities service above, (tried both in gui and yaml mode), with restarts (tried both HA and full reboot) after each. Still all there though!
Same here. Non of the solutions above work. Using wildcards will throw error saying entity not found. Adding target doesn’t work either. I understand the only option is to remove registry entries. That seems rather silly to me not being able to use the UI to multi select and remove entries.
Came across this thread after ending up with over 200,000 device_tracker entities in my HA instance. These are the steps that worked for me go get rid of them:
Make a backup just in case
Go to Developer Tools > Actions
Choose “Recorder: Purge entities”
Set Domains to remove: device_tracker
Set Entity globs: device_tracker.**_**_**_**_**_**