OwnTracks Location
Real-time location awareness via OwnTracks → HTTP webhook → SQLite.
Architecture
Phone (OwnTracks) → HTTP POST → server.mjs (port 18793) → SQLite + latest.json
Agent queries → places.mjs CLI or curl http://localhost:18793/latest
Setup
1. Start the receiver
node scripts/server.mjs
# Default port: 18793. Override: OWNTRACKS_PORT=9999
# Data dir override: OWNTRACKS_DATA=/path/to/data
Recommended: install as user systemd service for persistence.
mkdir -p ~/.config/systemd/user
cat << 'EOF' > ~/.config/systemd/user/owntracks-receiver.service
[Unit]
Description=OwnTracks Location Receiver
After=network.target
[Service]
Type=simple
Environment=OWNTRACKS_PORT=18793
Environment=OWNTRACKS_DATA=<SKILL_DIR>/scripts/data
ExecStart=/usr/local/bin/node <SKILL_DIR>/scripts/server.mjs
Restart=always
RestartSec=5
[Install]
WantedBy=default.target
EOF
systemctl --user daemon-reload
systemctl --user enable --now owntracks-receiver
Replace <SKILL_DIR> with the absolute path to this skill directory.
2. Configure OwnTracks on phone
- Install OwnTracks from F-Droid or Play Store
- Open → Menu → Preferences → Mode → HTTP
- URL:
http://<host-tailscale-ip>:18793/owntracks - Tap 📤 on the map to send a test ping
Phone must reach the receiver (same LAN or Tailscale).
3. Verify
curl http://localhost:18793/latest
# Should return JSON with lat, lon, acc, batt, etc.
Places CLI
Named locations with haversine distance queries.
# Add a place
node scripts/places.mjs add "Home" 41.3200 1.8900 home "Olivella"
node scripts/places.mjs add "Gym" 41.2229 1.7385 gym "Aqua Sport, Vilanova"
# Where am I? (reads OwnTracks latest + finds nearest named place)
node scripts/places.mjs where
# Find nearby places from arbitrary coordinates
node scripts/places.mjs nearest 41.22 1.74 5 500
# Search by name/category/notes
node scripts/places.mjs search "gym"
# List all
node scripts/places.mjs list
node scripts/places.mjs list gym
# Remove
node scripts/places.mjs remove "Old Place"
Agent Usage
When user asks "where am I?":
curl -s http://localhost:18793/latest
node scripts/places.mjs where
When user says "this is my X" at a location:
- Get current coords from
/latest - Reverse geocode via Nominatim or web search for the business name
node scripts/places.mjs add "<name>" <lat> <lon> <category>
Server Endpoints
| Method | Path | Description |
|---|---|---|
| POST | /owntracks | OwnTracks webhook (expects _type: "location") |
| GET | /latest | Last known location |
| GET | /history?limit=50 | Location history |
| GET | /health | Health check |
Dependencies
- Node.js 22+
better-sqlite3(for places.mjs)- OwnTracks app (Android/iOS)
- Network path from phone to receiver (Tailscale recommended)