A Python application to forward Meshtastic MQTT location messages to a Traccar server
Project description
Mesh2Traccar
A Python application to forward Meshtastic MQTT location messages to a Traccar server.
Installation
-
Install the Package:
- Option A: Via PyPI (Recommended):
pip install mesh2traccar
- Option B: Via Git Clone (for developers or custom versions):
git clone https://gitlab.com/drid/mesh2traccar cd mesh2traccar pip install .
Note for Developers: For local development, placemesh2traccar.confin the current directory to use it instead of/etc/mesh2traccar/mesh2traccar.conf. Logs will be written to./mesh2traccar.logif/var/log/mesh2traccar/is not writable.
- Option A: Via PyPI (Recommended):
-
Create a User and Group:
sudo groupadd mesh2traccar sudo useradd -r -g mesh2traccar -d /var/lib/mesh2traccar -s /sbin/nologin mesh2traccar
-
Set Up Directories:
sudo mkdir -p /etc/mesh2traccar /var/lib/mesh2traccar /var/log/mesh2traccar sudo chown mesh2traccar:mesh2traccar /var/lib/mesh2traccar /var/log/mesh2traccar
-
Copy Configuration File:
- For PyPI installation:
sudo cp $(python -c "import pkg_resources; print(pkg_resources.resource_filename('mesh2traccar', 'mesh2traccar.conf'))") /etc/mesh2traccar/
- For Git clone installation:
sudo cp mesh2traccar.conf /etc/mesh2traccar/
- Set permissions:
sudo chown mesh2traccar:mesh2traccar /etc/mesh2traccar/mesh2traccar.conf sudo chmod 640 /etc/mesh2traccar/mesh2traccar.conf
- For PyPI installation:
-
Edit Configuration: Edit
/etc/mesh2traccar/mesh2traccar.confto set your MQTT and Traccar settings:mqtt.broker: MQTT broker address.mqtt.port: MQTT broker port (default 1883).mqtt.usernameandmqtt.password: MQTT credentials (optional).mqtt.client_id_prefix: Prefix for MQTT client ID.mqtt.topic_sub: Meshtastic MQTT topic (e.g.,msh/ANZ/2/json/LongFast/+).traccar.url: Traccar server URL (e.g.,http://your-traccar-server:5055).traccar.device_id: Default device ID for Traccar.traccar.api_key: Traccar API key (optional).
-
Install Systemd Service:
- For PyPI installation:
sudo cp $(python -c "import pkg_resources; print(pkg_resources.resource_filename('mesh2traccar', 'mesh2traccar.service'))") /etc/systemd/system/
- For Git clone installation:
sudo cp mesh2traccar.service /etc/systemd/system/
- Enable the service:
sudo systemctl daemon-reload sudo systemctl enable mesh2traccar.service
- For PyPI installation:
-
Start the Service:
sudo systemctl start mesh2traccar.service
Usage
-
Check Service Status:
sudo systemctl status mesh2traccar.service
-
View Logs:
tail -f /var/log/mesh2traccar/mesh2traccar.log
-
Stop or Restart:
sudo systemctl stop mesh2traccar.service sudo systemctl restart mesh2traccar.service
Notes
- Ensure your MQTT broker and Traccar server are running and accessible.
- Register Meshtastic node IDs (e.g.,
!2f8382cc) in Traccar as device identifiers. - If the
!prefix causes issues, modifymesh2traccar.pyto remove it:device_id = format(from_id, 'x') if from_id is not None else TRACCAR_DEVICE_ID
- The software is licensed under the GNU General Public License v3 (GPLv3). See the
LICENSEfile for details.
Troubleshooting
- Check
/var/log/mesh2traccar/mesh2traccar.log(or./mesh2traccar.logfor local development) for errors. - Verify MQTT topic and Traccar URL in the configuration file.
- Ensure the
mesh2traccaruser has permissions to read/etc/mesh2traccar/mesh2traccar.conf(or./mesh2traccar.conffor development).
License
This project is licensed under the GNU General Public License v3.0.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mesh2traccar-0.1.2.tar.gz.
File metadata
- Download URL: mesh2traccar-0.1.2.tar.gz
- Upload date:
- Size: 43.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
41a1ba4a3331b8284254f728f4930d88408407956a3455641b382a5738c0d1d8
|
|
| MD5 |
49e8964e8dbf709c331a35082eec7ac6
|
|
| BLAKE2b-256 |
d42dde092a50f6839db2863650cd52117dab831f2d8c6240c8e00f73b80222dc
|
File details
Details for the file mesh2traccar-0.1.2-py3-none-any.whl.
File metadata
- Download URL: mesh2traccar-0.1.2-py3-none-any.whl
- Upload date:
- Size: 30.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c0759f0834623a027cf8f6507f2723e5e54fad6b04ccf2f5d3bb1ed93e117fac
|
|
| MD5 |
af1c36ffd9203ce6ae6c344a30661f9a
|
|
| BLAKE2b-256 |
cb1d20a499c9f9416c7ef114630ef06d27aeaca00283e6a44d721455abbbdad1
|