README
Tracksix
Track your [⛵|🚂|🚙|🚜|🛵|🛷|🚶] with a Raspberry Pi and a GPS.
Features
- OwnTracks Compatable Config & Reporting Format
- MQTT(S) Reporting
- MQTT over WebSocket Reporting
- Programmatic usage or executable use
- Compatable with a huge array of GPS devices through
GPSd
- Replays reports when an internet connection arrises
Install
To communicate with your GPS device, tracksix
utilises GPSd
(Global Positioning System daemon) which standardises the format from different GPS devices.
On OSX:
$ brew install gpsd
On Debian/Ubuntu:
$ sudo apt install gpsd
Ensure you have Node.js installed on your device, then install tracksix
:
$ npm install --global tracksix
Usage
$ tracksix [path to config file]
Tracksix uses the same configuration format as OwnTracks, this can be exported from your OwnTracks mobile app or copy the config.example.json and edit the contents appropriately.
Programmatic Usage
First follow the above steps for installing GPSd. Then install the tracksix library into your nodejs project:
$ npm install tracksix
Import the library:
const tracksix = require('tracksix')
Load your configuration file:
const path = require('path')
const config = tracksix.readConfigSync(
path.resolve(__dirname, './config.json')
)
Start tracking:
const tracker = tracksix(config)
To listen for errors, tracksix()
returns an EventEmitter which emits 'error'
events.
tracker.on('error', (err) => {
console.error(err)
})
To listen for updates sent to the MQTT server, subscribe to 'location'
events. A location event contains the same elements as specified in the OwnTracks location object.
tracker.on('location', (report) => {
console.log(report)
})
Development
To start a mock GPSd
server use gpsd-fake
: npm install -g gpsd-fake && gpsd-fake
.
Licence
MIT © Ben Evans