Skip to content

Track your [β›΅|πŸš‚|πŸš™|🚜|πŸ›΅|πŸ›·|🚢] with a Raspberry Pi and a GPS.

Notifications You must be signed in to change notification settings

bencevans/tracksix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

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)
})

Run as a service

Write the following to /etc/systemd/system/tracksix.service and update the path to node which node and tracksix which tracksix.

[Unit]
Description=Tracksix Service
After=network.target

[Service]
Type=simple
# Another Type: forking
User=pi
WorkingDirectory=/home/pi
ExecStart=/home/pi/.nvm/versions/node/v10.13.0/bin/node /home/pi/.nvm/versions/node/v10.13.0/bin/tracksix
Restart=on-failure
# Other restart options: always, on-abort, etc

# The install section is needed to use
# `systemctl enable` to start on boot
# For a user service that you want to enable
# and start automatically, use `default.target`
# For system level services, use `multi-user.target`
[Install]
WantedBy=multi-user.targe

Afterwards you need to enable the service:

$ sudo systemctl enable tracksix.service

Then start the service with:

$ sudo systemctl start tracksix

You can check the status / logs with:

$ systemctl status tracksix.service

Development

To start a mock GPSd server use gpsd-fake: npm install -g gpsd-fake && gpsd-fake.

Licence

MIT Β© Ben Evans

About

Track your [β›΅|πŸš‚|πŸš™|🚜|πŸ›΅|πŸ›·|🚢] with a Raspberry Pi and a GPS.

Topics

Resources

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •