Get back known_devices.yaml

I had some issue with the known_devices.yaml file so I made the biggest mistake of deleting it. I have restated my HA couple of times as well as we removed device_tracker: rebooted and reinserted and rebooted again and still it does not come. I was running the below config before deletion and adding the same after reboot does not work.

device_tracker:
  platform: owntracks_http

can anyone help me with this. before even in maps it used to show the phones location. not it shows nothing.

Can someone please help me.

I think you have to wait for the devices to check in before it populates again.

I waited for more that 12 hrs still nothing

Go to your backup.

is the file there but empty, or is it missing completely.

I deleted it and then created a new one. So it’s empty. Even after i put my phone with mac address details nothing shows.

I might remember this wrong, but I think the contents of the file are written when HA shuts down cleanly.
Try triggering a restart using the UI and service homeassistant.restart and check the file then.

Sebastian

Probably because you recreated it yourself HA can’t write to it due to permissions or ownership issue. Just delete it. I’m sure HA creates it if it doesn’t exist.

2nded
Remove the one you made yourself.
Stop/shutdown HA cleanly.
Start it up, and make sure your device checks in.
Stop/shutdown HA cleanly.
Check the file

Man, this is totally not what I wanted to see when looking for a solution. Same thing happened to me. Surely someone has to know how to recreate this this file after accidental deletion. I have rebooted several times cleanly.

necro post of the day!

I got very lucky, I was able to figure out how to create known_devices.yaml again and have it populated. The solution… (not documented anywhere) is to delete the .google_maps_location_sharing.cookies* files and respective entries in configuration.yaml. Reboot. Then, instead of adding the same .google_maps_location_sharing.cookies* files back (which will definitely not work)… I created these files again using my web browser… and inserted some carriage returns in the files… so they were not identical to the original files. Then copied these files back and added the configuration settings in configuration.yaml back again… then rebooted again. This allowed the known_devices.yaml to get created and populated.

Hopefully this tip might help you or someone else in the future.

Don’t know why you posted this here. Because as you posted it in your own topic, it’s a specific way for your Google maps device tracker issue. It’s not documented anywhere because it is also not the best route to do this.

Therefore I like to advise this topic owner not to take your route since it has nothing to do with owntrack.