This project provides an HTTP server that handles endpoints for the Digital Matters Yabby3 GPS tracking devices. It also serves web pages of maps showing current tag locations.
Demo at: https://tags.bitwombat.com.au/current
and
https://tags.bitwombat.com.au/paths
Notifications indicate when the tag has left boundaries or when the battery is low.
A web service written in Go listens to endpoints.
The /upload
endpoint is for GPS tracking devices to post their JSON payloads. The payload is
dumped as-is into a MongoDB database.
If the device location is outside the Safe Zone or Property boundaries, notifications are sent (currently ntfy.sh is supported).
A boundary can be divided up into named zones for more useful notifications. See screenshot below. These zones are defined in .kml files created with Google Earth.
When web users visit /current
with a browser, a Google Map is returned with
markers showing current tag positions. The markers have other data about the
device, including data freshness and battery level.
When web users visit /paths
with a browser, a Google Map is returned showing a
path of the last 50 received positions.
/testnotify
is provided to trigger notifications for the purpose of testing
them.
- You'll need a VPS and a Google Maps API key. The VPS needs to have MongoDB installed.
- Notifications are currently supported using the incredibly easy ntfy.sh. No signup or API key is required to use it. Just install the app on your phone and choose a random subscription name.
- Customize environment variables in devops/dog-tracking.service
- Set your VPS name in the deployment script in devops/deploy_and_run.sh
- Delete the example zone and boundary files from
boundary_zones/
andnamed_zones/
. - Generate .kml zone and boundary files using Google Earth and save those files
individually to
boundary_zones/
andnamed_zones/
. - Create an issue to bug the author to make the rest of the system configurable (see TODOs below)
From this dir, run
$ devops/deploy_and_run.sh
$ docker run --name some-mongo -d mongo:7.0
$ go test ./...
- Make own location configurable (get it out of current-map.html).
- Read boundaries from boundary_zones dir (get them out of main.go).
- Put all boundaries and zones into two .kml files (just save the top folder in Google Earth).
- Add instructions about how to make zones in Google Earth.
- Improve instructions for setting up a server.
- Make domain configurable with env vars (get it out of ntfy.go).
- Make dog names and tag IDs controlled by env vars.