This project provides a set of scripts and tools to help Home Assistant track an Apple AirTag using both GPS (based on apple's FindMy network), and nearby BLE tracking. While the setup is a bit hacky, it works effectively. You'll need a separate Linux machine with Bluetooth capabilities.
For my setup, I run this on a dedicated Proxmox VM, but your mileage may vary (YMMV). Currently, it supports AirTags paired with devices running iOS 17 or earlier. You'll also need a macOS 15 or earlier device to extract the master private key for your AirTag. For more details, check out FindMy.py.
This setup has been tested with official Apple AirTags only. In theory, it should work with any Apple trackable device (e.g., iPhone/iPad), officially supported AirTag clones, and possibly OpenHaystack tags. However, these alternatives remain untested.
-
Prepare the Decrypted Plist File:
Obtain the decrypted plist file for the AirTag you want to track. -
Clone the Repository:
Clone this repository to your Linux machine. -
Set Up Python Virtual Environment:
Create a Python virtual environment and install FindMy.py. -
Configure MQTT in Home Assistant:
Follow the Home Assistant MQTT Integration Guide to set up MQTT. -
Set Up Anisette Server:
Install and run an Anisette server. For simplicity, you can run it on the same VM. -
Add Device Tracker Configuration to Home Assistant:
Add the following configuration to yourconfiguration.yamlfile in Home Assistant:mqtt: - device_tracker: name: "My AirTag" unique_id: my_airtag state_topic: "my_airtag/state" json_attributes_topic: "my_airtag/attributes" availability: - topic: "my_airtag_ble/availability" - topic: "my_airtag_gps/availability" availability_mode: "any" source_type: "bluetooth_le"
-
Edit the
config.jsonFile:
Modifyconfig.jsonto match your MQTT configuration from the step above. -
** Test Run **
(venv) $ python airtag_tracker.py config.yaml # For GPS tracking(venv) $ python ble_scan.py config.yaml # For nearby BLE scanningBoth should run and periodically send tracking status to the MQTT tracker in your home assistant.
-
Add Systemd Service Files:
Add theairtag_ble_tracker.serviceandairtag_gps_tracker.servicefiles to your systemd services directory (e.g.,/etc/systemd/system/). -
Modify the Service Files:
Edit the following lines in both files to match your setup:# airtag_ble_tracker.service ExecStart=/path/to/your/virtualenv/bin/python ble_scan.py config.yml WorkingDirectory=/path/to/your/cloned/repositoryand
airtag_gps_tracker.service ExecStart=/path/to/your/virtualenv/bin/python airtag_tracker.py config.yml WorkingDirectory=/path/to/your/cloned/repository
-
Enable and Start the Services:
Activate and start the services:sudo systemctl enable airtag_ble_tracker.service sudo systemctl enable airtag_gps_tracker.service sudo systemctl start airtag_ble_tracker.service sudo systemctl start airtag_gps_tracker.service