!!! Traccar now offers own internal support for MQTT since Release 5.6 !!!
Traccar2mqtt is a small Server written in NodeJs to use Traccar in other Programs. In my case Io.Broker
- Big Jump to V1.0 the Version is very stable and no new issue reported or found
-
(added) New env variable added: debug (true,false)
-
(added) Data example forward_data/forward.json and forward_data/event_forward.json
-
(added) Event Handler
- new mqtt subtopic traccar/*/event
-
(added) json topic to get the complete posted data
- /traccar/*/event/json
- /traccar/*/device/json
- /traccar/*/position/json
-
(fixed) device/state allways "online" fixed.
-
(fixed) some mqtt errors.
- (added) new variable (Model, uniqueid, positionid, address, Battery, distance, totaldistance, motion) special thanks to dossidr
-
(improvement) better mqtt connect handle
-
(added) new variable geofanceID
-
(added) more console output for debug
- (improvement) less error prone if vars no exists on traccar
- no mqtt_topic_change (/traccar atm.)
Traccar2mqtt uses a number of open source projects to work properly:
-
MQTT - Node.JS client library for the MQTT protocol
-
node.js - evented I/O for the backend
-
Express - fast node.js network app framework @tjholowaychuk
If you have any improvement, ideas, issues, bugs, feature requests please submit a report at
https://github.com/gamebeast2k/docker_traccar2mqtt/issues or write a mail to info@gamebeast.de
The build instructions are tracked on GitHub. Automated builds are hosted on Docker Hub.
curl https://raw.githubusercontent.com/gamebeast2k/docker_traccar2mqtt/master/var.env.example --output var.env
docker run - 44110:80 -d --name traccar2mqtt --env-file ./var.env gamebeast/traccar2mqtt
The Docker is downloading images from DockerHub, starting and waiting on port 44110 TCP for data from Traccar.
curl https://raw.githubusercontent.com/gamebeast2k/docker_traccar2mqtt/master/var.env.example --output var.env
curl https://raw.githubusercontent.com/gamebeast2k/docker_traccar2mqtt/master/docker-compose.yml --output docker-compose.yml
docker-compose up
The the container is again downloading images from DockerHub and starting in foreground. Try -d to start in background.
The Update process is pretty easy.
docker pull gamebeast/traccar2mqtt
docker restart traccar2mqtt
Thats all what you need to update.
On your Traccar Setup edit conf/traccar.xml and add forward
<!-- position forwarding -->
<entry key='forward.enable'>true</entry>
<entry key='forward.json'>true</entry>
<entry key='forward.url'>http://traccar2mqtt_ip:80/</entry>
<!-- event forwarding -->
<entry key="event.forward.enable">true</entry>
<entry key='event.forward.url'>http://traccar2mqtt_ip:80/</entry>
And restart Traccar Instance
variable | default | Comment |
---|---|---|
${NODE_ENV] | production | no need to change |
${clientid} | traccar2mqtt | your mqtt ClientID (must be unique) |
${mqtt_username} | username | your mqtt username |
${mqtt_password} | password | your mqtt password |
${mqtt_host} | mqtt://1.2.3.4 | your mqtt ipaddr or dns-name |