TLDR: You can try it here https://www.martinpham.com/findmysync/
Having location-based automation on your Smart Home is pretty cool: Turn on the security camera when you’re away, Turn off the heating in your kid’s room when they’re at school, Show the shopping list when you’re at supermarkets, … Tons of ideas!
I was using the Home Assistant’s iCloud integration.. everything was cool, except the annoying emails from Apple saying someone is logging into my account. Also a big catch: It does not have locations of my Airtags!
A quick Google search turned out, the integration was fetching data from the Apple Find My website, and unfortunately, Airtags are not listed there, therefore the integration couldn’t fetch those data.
After doing some research, I’ve found out that it’s possible to fetch those data – not from Apple Find My website, but from some secured files on my Mac. They are located in ~/Library/Caches/com.apple.findmy.fmipcore/
- Devices.data: contains the last locations of my devices (which I signed in and enabled Find My)
- Items.data: contains the last locations of my Airtags.
Fortunately, those data are saved in plain text, with JSON format. With just one catch: it’s secured under macOS protections, to read those file contents, you will need to grant Full Disk Access permission – OR request users to grant access this folder.
Alright, now we have the data sources, just need to find a way to send those data into Home Assistant’s tracker database!
And it’s simple, from https://www.home-assistant.io/integrations/device_tracker/#device_trackersee-service we can see the device_tracker.see service can be used to update our tracker’s data – which could be defined in known_devices.yaml file
So I’ve decided to write a simple pet app – FindMySync, which will take data files from my Mac, and synchronize those data into Home Assistant with the device_tracker.see service. It also can hide the Find My app window during synchronization, less cluttered desktop!