Skip to content

a small bridge between Traccar and a MQTT Broker maybe for your Smarthome like IO.Broker or Fhem.

Notifications You must be signed in to change notification settings

gamebeast2k/docker_traccar2mqtt

Repository files navigation

!!! Traccar now offers own internal support for MQTT since Release 5.6 !!!

I will continue to maintain this GIT and provide security updates or bug fixes when necessary.

thanks for the countless downloads! ♥ ♥ ♥

What is Traccar2mqtt

Build Status

OpenIssue

dockerbuild

Traccar2mqtt is a small Server written in NodeJs to use Traccar in other Programs. In my case Io.Broker

Changelog

1.0

  • Big Jump to V1.0 the Version is very stable and no new issue reported or found

0.4

  • (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.

0.3

  • (added) new variable (Model, uniqueid, positionid, address, Battery, distance, totaldistance, motion) special thanks to dossidr

0.2

  • (improvement) better mqtt connect handle

  • (added) new variable geofanceID

  • (added) more console output for debug

0.1

  • (improvement) less error prone if vars no exists on traccar

currently Limits

  • no mqtt_topic_change (/traccar atm.)

Tech

Traccar2mqtt uses a number of open source projects to work properly:

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.

Setup and Starting via Docker Run

!!! Dont forget Setup the var.env file for your environment !!!
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.

Setup and Starting via Docker-compose

!!! Dont forget Setup the var.env file for your environment !!!
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.

UPDATING

The Update process is pretty easy.

docker pull gamebeast/traccar2mqtt
docker restart traccar2mqtt

Thats all what you need to update.

Setup Traccar

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

environment vars

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

About

a small bridge between Traccar and a MQTT Broker maybe for your Smarthome like IO.Broker or Fhem.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published