Skip to content

A simple script to continuously import OpenHaystack locations into Traccar

License

Notifications You must be signed in to change notification settings

jannisko/findmy-traccar-bridge

Repository files navigation

findmy-traccar-bridge

A simple script to continuously import OpenHaystack locations into Traccar. This project uses the excellent findmy.py project to load the encrypted location data of your custom tracking beacons from Apple's FindMy network.

image usage_screencast

Requirements

  • Docker or Python 3.12
  • Some OpenHaystack beacons generating data
    • e.g. an esp32 or NRF51
    • I recommend following the instructions 2. Hardware setup from macless-haystack. This is also where you will generate the private key for later.
  • Access to an Apple account with 2FA enabled

Important

Using Apple's internal API like this may get your account banned, depending on how "trustworthy" Apple deems your account. In general, one query every 30 minutes seems to be safe, even for new throwaway accounts (this project querys once per hour by default). Some anecdotes from others: [1] [2] [3]

Usage

Run the bridge via docker compose:

services:
  bridge:
    build: https://github.com/jannisko/findmy-traccar-bridge.git
    volumes:
      - ./:/bridge/data
    environment:
      BRIDGE_PRIVATE_KEYS: "<key1>,<key2>,..."
      BRIDGE_TRACCAR_SERVER: "<your traccar base url>:5055"
via docker
docker build -t findmy-traccar-bridge https://github.com/jannisko/findmy-traccar-bridge.git
docker run -d --name bridge \
-v ./:/data
-e BRIDGE_PRIVATE_KEYS="<key1>,<key2>,..."
-e BRIDGE_TRACCAR_URL="<your traccar base url>"
findmy-traccar-bridge
as a python package
export BRIDGE_PRIVATE_KEYS="<key1>,<key2>,..." BRIDGE_TRACCAR_SERVER="<your traccar base url>"
uvx --from=git+https://github.com/jannisko/findmy-traccar-bridge findmy-traccar-bridge

Initialization

To query the internal Apple FindMy API you will need to interactively log into your Apple account with a 2FA challenge when initially setting up the containers. Until this is done, the bridge container will stay idle.

docker compose exec bridge .venv/bin/findmy-traccar-bridge-init
via docker
docker exec -it bridge .venv/bin/findmy-traccar-bridge-init
as a python package
uvx --from=git+https://github.com/jannisko/findmy-traccar-bridge findmy-traccar-bridge-init

Configuration

The script can be configured via the following environment variables:

  • BRIDGE_PRIVATE_KEYS - required - comma separated string of base64 encoded private keys of your beacons (e.g. can be generated via instructions from macless-haystack)
  • BRIDGE_TRACCAR_SERVER - required - url to your traccar server
  • BRIDGE_ANISETTE_SERVER - optional (default: https://ani.sidestore.io) - url to the anisette server used for login
  • BRIDGE_POLL_INTERVAL - optional (default: 3600 (60 minutes)) - time to wait between querying the apple API. Too frequent polling might get your account banned.
  • BRIDGE_LOGGING_LEVEL - optional (default: INFO)

Example

An example compose file running the bridge and Traccar locally can be found in the testing directory:

git clone https://github.com/jannisko/findmy-traccar-bridge
cd findmy-traccar-bridge/testing
docker compose up -d
docker compose exec bridge .venv/bin/findmy-traccar-bridge-init

About

A simple script to continuously import OpenHaystack locations into Traccar

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published