I don’t advise doing this at all but…
I have the Samba Share add-on installed and use that to access HA remotely.
From my laptop I browse the HA config folder to find the devices database file. Back this up, make a physical copy of it somewhere. Backup with HA backup also.
Open the devices database file in vscode. Make sure nothing like word wrap or anything is enabled.
Each device is on a line of it’s own.
Use search to locate the device you want to remove using the zone id I.e. 14:14400 or whatever. You must remove the entire line.
If the device you want to delete is at the end of the list then you MUST ensure that the structure of the file is not altered. This is what screwed me over. I removed the last line and it corrupted the database and deleted most of my devices on a reboot. I don’t know the exact syntax but if you just delete the last line if the section then expect hours of pain.
Once you’ve removed the devices you want. Save the file and reboot. Keep all your fingers crossed and hope that everythings ok. You should tell quickly, if the file size of the device database decreases in size after reboot then it’s bad times.
If you are trying to fix the database never use you original database file, always create new copies.
If you replace the file and reboot it seems to override the database on shutdown. I got to a point where I had to reboot HA, wait for it to be down enough, then I overwrite the dB file before it came back online. It came back and worked again.
It’s really not nice when it goes wrong. You may be able to restore from HA backup, I didn’t try.