Home Assistant Community Add-on: Traccar

Hi @thoky, did you ever resolve this? I have the same issue…

Ok I’ve Traccar addons running and the database created and populated on mariadb. I running hassOS 3.5, supervisor 193 with traccar 0.5.4 My traccar.xml file is like this:

<entry key='database.driver'>com.mysql.cj.jdbc.Driver</entry>
<entry key='database.url'>jdbc:mysql://core-mariadb:3306/traccar?serverTimezone=UTC&amp;useSSL=false&amp;allowMultiQueries=true&amp;autoReconnect=true&amp;useUnicode=yes&amp;characterEncoding=UTF-8&amp;sessionVariables=sql_mode=''</entry>
<entry key='database.user'>tracuser</entry>
<entry key='database.password'>pasword-1</entry>

It took a lot of time for traccar to populate the mariadb dabatase.

I’ve forwarded the port 5055 and 8072 (http) in my router to hassio.local:5055 and 8072.
In the traccar log I can see that traccar received the data from my cellphone but I get

2020-01-05 20:02:16  INFO: [340e5992] connected
2020-01-05 20:02:16  INFO: [340e5992: osmand < 192.168.2.1] HEX: 504f5354202f3f69643d37742674696d657374616d703d31353738323639353131266c61743d34352e36383239343431266c6f6e3d2d37332e343235383439382673706565643d302e302662656172696e673d302e3026616c7469747564653d302e302661636375726163793d31362e3026626174743d39322e3020485454502f312e310d0a436f6e74656e742d547970653a206170706c69636174696f6e2f782d7777772d666f726d2d75726c656e636f6465640d0a557365722d4167656e743a2044616c76696b2f322e312e3020284c696e75783b20553b20416e64726f69642031303b20484431393035204275696c642f514b51312e3139303731362e303033290d0a486f73743a20706879746f70692e6475636b646e732e6f72673a353035350d0a436f6e6e656374696f6e3a204b6565702d416c6976650d0a4163636570742d456e636f64696e673a20677a69700d0a436f6e74656e742d4c656e6774683a20300d0a0d0a
2020-01-05 20:02:16  WARN: Unknown device - 7t (192.168.2.1)
2020-01-05 20:02:16  INFO: [340e5992: osmand > 192.168.2.1] HEX: 485454502f312e31203430302042616420526571756573740d0a636f6e74656e742d6c656e6774683a20300d0a0d0a

7t is my cellphone name and 192.168.2.1 is my router. So I receive the data from my cellphone but the user 7t is not recognised by traccar.

in my configuration yaml I have this:

device_tracker:
  - platform: traccar
    host: 192.168.2.178 # this is my hassio ip
    port: 8072
    ssl: true
    verify_ssl: false
    username: tracuser
    password: password-1

Should I use the same username and pasword that I’ve written in traccar.xml ? that password is to connect to mariadb database.
In the HA log I get rid of ‘cannot connect error’ that I had with the above configuration.yaml config
But I’m still not able to connect to traccar web ui. I get ‘502 bad gateway’
In Traccar addons log I have this error:

[20:14:58] INFO: Starting NGinx server...
nginx: [emerg] invalid number of arguments in "resolver" directive in /etc/nginx/includes/resolver.conf:1
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (assembler_aarch64.hpp:1156), pid=26141, tid=0x0000007f8c909ab0
#  guarantee(Rs != Rn && Rs != Rt) failed: unpredictable instruction
#
# JRE version: OpenJDK Runtime Environment (8.0_212-b04) (build 1.8.0_212-b04)
# Java VM: OpenJDK 64-Bit Server VM (25.212-b04 mixed mode linux-aarch64 compressed oops)
# Derivative: IcedTea 3.12.0
# Distribution: Custom build (Mon Aug 12 12:54:41 UTC 2019)
# Core dump written. Default location: /opt/traccar/core or core.26141
#
# An error report file with more information is saved as:
# /opt/traccar/hs_err_pid26141.log

Any idea of what to try next. Anybody succeed to connect to the traccar web UI ?

Update
netstat -lutanp | grep nginx
give no output

In web terminal I do:

wget -O- --no-check-certificate https://hassio:8072

and get:

https://192.168.2.178:8072/
connecting to 192.168.2.178:8072... failed: connection refused

Sorry, i know it has been months. You have any idea why devices is not showing in UI? I managed to get it work in HA devicetracker though…only cant see the decice in Traccar UI

You’ve set up the app with Home Assistant, not the addon.

Hi frenck,
Is there a way i can get both to work? I would like to use the HA integration for automation purpose, but UI Traccar provides easier way for me to review the history/route etc.

Update: i think there is, but i could not know how, because when i use server URL in Traccar Client, it is for HA (from HA integration), not for the addon. I would assume that HA would share same data with the UI, no?
How do i send the data from traccar client to addon too, instead of just to HA

:tada: Release v0.6.0

Full Changelog

This is a general maintenance release.

Changed

  • :books: Fixes incorrect instructions in documentation (#26)
  • :books: Adds link to Traccar website
  • :books: Small documentation improvements (#31)
  • :hammer: Retrigger build with empty commit
  • :books: Update add-on installation instructions
  • :fireworks: Updates maintenance/license year to 2020
  • :pencil2: Funding adjustments
  • :pencil2: Fixes some spelling and grammar
  • :arrow_up: Upgrades add-on base image to v6.0.1
  • :arrow_up: Upgrades nginx to 1.16.1-r4
  • :arrow_up: Upgrades nss to 3.48-r0
  • :arrow_up: Upgrades openjdk8-jre to 8.232.09-r0
  • :shirt: Removes unneeded whitespace from documentation

Questions? Join our Discord server! https://discord.me/hassioaddons
Enjoying my add-ons? Consider supporting my work:
https://github.com/sponsors/frenck or https://patreon.com/frenck

1 Like

:tada: Release v0.6.1

Full Changelog

This is a general maintenance release.

Changed

  • :arrow_up: Upgrades Traccar to 4.7 (#33)
  • :arrow_up: Upgrades nginx to 1.16.1-r6

Questions? Join our Discord server! https://discord.me/hassioaddons
Enjoying my add-ons? Consider supporting my work:
https://github.com/sponsors/frenck or https://patreon.com/frenck

Can someone confirm that this doesn’t work with Nabu Casa without using webhooks? I’m behind a CG-NAT so I have to use Nabu Casa. Thanks

The add-on as a whole cannot be used behind CG-NAT.

:tada: Release v0.7.0

Full Changelog

:warning: This is a major release with breaking changes

This is a major release of the Traccar add-on, that contains breaking changes, to make future use (and development) easier.

Protocols disabled by default

All protocols and ports, besides the web API, are now disabled by default! You need to manually enable each protocol you need to use in the /config/traccar.xml file yourself. Please refer to the Traccar documentation on how to do that.

The reason to switch off all protocols is to free up memory and keep Traccar from claiming hundreds of ports. This excessive port claiming caused troubles for a lot of users and confused the lesser technical known users even more.

Now uses the official MariaDB add-on

The add-on now interconnects with the official Home Assistant MariaDB add-on automatically. Make sure you have it installed and running (version 2.0 or higher). Zero, 0, configuration needed.

If you have a custom MySQL connection configured in your configuration, that will have a higher priority, and thus will be used.

Changed

  • :books: Update add-on documentation to use new YAML configuration format
  • :hammer: Re-branding
  • :hammer: Update add-on config with new password & list features
  • :hammer: Updates for upstream Supervisor changes
  • :arrow_up: Upgrades add-on base image to v7.0.2
  • :arrow_up: Upgrades openjdk8-jre to 8.242.08-r0
  • :arrow_up: Upgrades Traccar to v4.8
  • :sparkles: Automatically use and discovery MySQL service
  • :fire: Disable all ports by default, add example to custom config
  • :hammer: Update community forum links
  • :books: Update add-on installation instructions

Questions? Join our Discord server! https://discord.me/hassioaddons
Enjoying my add-ons? Consider supporting my work:
https://github.com/sponsors/frenck or https://patreon.com/frenck

Could you please provide some example on how to enable the protocols? I’ve been browsing through traccar.org but it is not very clear how to do it.

Thanks in advance.

In new installations, the config file will be automatically added with example, for existing installations I get it is more difficult. You can find the template for new installations here:

Each entry shows a protocol and the port on which it enables.

Thank you very much. I got to the protocol.port entry, but could not understand how to enable it.

Regards.

You just copy it and paste it like this:

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE properties SYSTEM 'http://java.sun.com/dtd/properties.dtd'>

<properties>

    <!--
    Loads default configuration for the Hass.io add-on.
    WARNING: Do not remove this line!
    -->
    <entry key='config.default'>/etc/traccar/hassio.xml</entry>

    <!--
    This is the main configuration file. All your configuration parameters should be placed in this file.
    Parameters in the main config file override values in the default file. Do not
    remove "config.default" parameter from this file unless you know what you are doing.
    For list of available parameters see following page:
        https://www.traccar.org/configuration-file/
    -->

    <!-- Enter you custom configuration below this line -->
    <entry key='osmand.port'>5055</entry>
    <entry key='geocoder.enable'>true</entry>
    <entry key='geocoder.type'>ban</entry>

btw . the other two entries enables address show… (but fro france) u can delete those if you want

:tada: Release v0.7.1

Full Changelog

This is a small patch release, to address issues with a locked database after restoring a snapshot.

Changed

  • :ambulance: Make sure the database isn’t locked on startup

Questions? Join our Discord server! https://discord.me/hassioaddons
Enjoying my add-ons? Consider supporting my work:
https://github.com/sponsors/frenck or https://patreon.com/frenck

:tada: Release v0.7.2

Full Changelog

Bugfix release, that fixes a bug when using a custom database server (override), allows the lock release to fail on startup and improves the documentation on how to enable protocols.

Furthermore, the OsmAnd protocol is now enabled by default, since that is needed for the official Traccar apps to function.

Changed

  • :sparkles: Open up osmand protocol by default
  • :ambulance: Allow lock releasing to fail
  • :ambulance: Skip MySQL container init when the database is overridden by the user
  • :books: Update add-on documentation on enabling protocols

Questions? Join our Discord server! https://discord.me/hassioaddons
Enjoying my add-ons? Consider supporting my work:
https://github.com/sponsors/frenck or https://patreon.com/frenck

Hi,

Do we need to do something to migrate all our data from the H2 database to the MariaDB?

Was working okay 7.0 release then upgraded to the 7.2 and now the database is empty and traccar has reset back to first state.

Any help appreciated.

configuarion.yaml under device_tracker:
image

Add-on config:
image

seems to start:

Android traccar client:
server: http://192.168.1.133:18682

traccar:
image

but no response:
image

What to do next? in terms of troubleshoot?

EDIT: Working… did not see the list that the “trackers” use (port numbers. Andoid one does 5055…

Only thing not wokring yet is to ad the android app “server” (Traccar Manager) to connect to HASS… I tried everything, with and without ssl and ports 80 8082 5055 18682 etc… but nothing works :frowning:
Any tip?

Hi all, I need an help with my first try with Traccar on HA.
I read all this topic and I followed the community hints but with this conf

  - platform: traccar
    host: http://demo3.traccar.org/
    username: [email protected]
    password: xxx

I have this error

2020-04-01 11:50:23 ERROR (MainThread) [pytraccar.api] Error connecting to Traccar, Cannot connect to host http:80 ssl:None [Name or service not known]
2020-04-01 11:50:23 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform traccar

I configured my client app and all is working fine, my position is shown on the server
qwe

Thankyou in advance

Stefano