/TraccaPy

Small Python script that uses gpsd to send the current location to a Traccar server (This repository is a mirror of the GitLab repo)

Primary LanguagePythonMIT LicenseMIT

TraccaPy

Table of contents

Getting Started

These instructions will explain to you how to get a copy TraccaPy running on your machine.

What is TraccaPy?

TraccaPy is a Python script that uploads your location to Traccar.
This tool uses gpsd to get the current location, speed, bearing, altitude and accuracy.
I used tPacketCapture to find out what the endpoint was for updating device location.

Dependencies

Installation

  1. Clone the repository: git clone https://gitlab.com/LapinoLapidus/traccapy.
  2. Rename config-sample.json to config.json.
  3. Modify the config.json file (see Configuration).
  4. Set up gpsd, I had to use /dev/serial0, since ttyAMA0 did not work.
  5. Run the file, python3 Main.py.

Configuration

You should edit the configuration file.
It contains the following:

  • sleep_time(int): time to wait between position checks. Example: 60
  • server(string): location of Traccar server(include http(s) and port number). Example: http://192.168.2.1:8082/.
  • device_id(int): has to correspond with the ID you made in Traccar. Example: 12345.
  • min_distance(int): Minimum distance required to send location, in meters. Set to negative to disable. Example: 10.
  • logging(bool): Set to true if you want to log to stdout on success and error. Example: true.

Compatibility

I've only tested this on a Raspberry Pi 3 running Raspbian using the Adafruit GPS.
It should work on any device running gpsd but I'm unsure.

Contributing

Pull requests are welcome and appreciated. For major issues, please open an issue first please.
Please be sure to test your changes before submitting.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Acknowledgements

Notice

I am in no way affiliated with Traccar Ltd, this is a fan-made project.