Home Assistant Community

Community Hass.io Add-on: Traccar

hassio-addon
hassio-repository
Tags: #<Tag:0x00007f374c7d6c18> #<Tag:0x00007f374c7d6ad8>
#21

I have been trying to get the device_tracker working all weekend.

Just managed to do it after 2 days :frowning:

I set up the android app with the server url: https://username.duckdns.org:8072
And I port forwarded 8072 from my router to my pi/hassio.

Here were my settings:

configuration.yaml

device_tracker:
  - platform: traccar
    host: 192.168.1.215     #whatever you internal IP address is, I tried everything else with no joy
    port: 8072
    username: !secret traccar_user
    password: !secret traccar_password
    ssl: true
    verify_ssl: false

panel_iframe:
  traccar:
    title: Traccar
    icon: mdi:car-connected
    url: https://hassio.local:8072

Make sure the traccar server is running properly by refreshing the log on the Addon page until you get reports of you position. It takes 4+ minutes to start up completely on my pi3b+. Add your device, it should show online within traccar. Check the logs and it should show that it is being reported something like this:

2018-12-10 02:08:41 INFO: [e9dca16b] connected 2018-12-10 02:08:41 INFO: [e9dca16b: 5055 &lt; 127.0.0.1] HEX: 504f5354202f3f69643d3530393437322674696d657374616d703d31353434343037373231266c61743d35332e3232383639323538266c6f6e3d2d332e33343737323833382673706565643d302e3937313932322662656172696e673d3135322e3830303030333035313735373826616c7469747564653d39382e3931313337363935333132352661636375726163793d302e3026626174743d34342e3020485454502f312e310d0a582d466f727761726465642d50726f746f3a2068747470730d0a557365722d4167656e743a2044616c76696b2f322e312e3020284c696e75783b20553b20416e64726f696420393b20506978656c2032204275696c642f505131412e3138313130352e3031372e4131290d0a582d466f727761726465642d466f723a203139322e3136382e312e310d0a582d4e67696e582d50726f78793a20747275650d0a4163636570742d456e636f64696e673a20677a69700d0a582d5265616c2d49503a203139322e3136382e312e310d0a436f6e74656e742d547970653a206170706c69636174696f6e2f782d7777772d666f726d2d75726c656e636f6465640d0a5669613a20687474702f312e31206c6f63616c686f73740d0a582d466f727761726465642d466f723a203132372e302e302e310d0a582d466f727761726465642d50726f746f3a20687474700d0a582d466f727761726465642d486f73743a206f66666c6573732e6475636b646e732e6f72673a383037320d0a582d466f727761726465642d5365727665723a203132372e302e302e310d0a486f73743a206c6f63616c686f73743a353035350d0a436f6e74656e742d4c656e6774683a20300d0a0d0a 2018-12-10 02:08:41 INFO: [e9dca16b: 5055 &gt; 127.0.0.1] HEX: 485454502f312e3120323030204f4b0d0a636f6e74656e742d6c656e6774683a20300d0a0d0a 2018-12-10 02:08:41 INFO: [e9dca16b] id: 509472, time: 2018-12-10 02:08:41, lat: 59.22869, lon: -3.94773, speed: 1.0, course: 152.8 2018-12-10 02:09:11 INFO: [e9dca16b] disconnected

I’m not sure if its necessary, but reloading core config and restarting HA from the services page did not seem to be reliable. So I SSH and used command ‘hassio ha restart’ to restart home assistant AFTER the traccar server was up and running properly. Home assistant should find the device tracker and add it to your known_devices.yaml it will also show the tracker icon on your overview page, and the map if it is out of the home area.

I was getting the error:
2018-12-10 00:16:57 ERROR (MainThread) [pytraccar.api] Error connecting to Traccar, Cannot connect to host https:80 ssl:None [Name does not resolve]
2018-12-10 00:16:57 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform traccar
2018-12-10 00:16:57 INFO (MainThread) [homeassistant.setup] Setup of domain device_tracker took 0.1 seconds.
and various combinations of it in my logs. SSH and ‘hassio ha logs’ to check.

So tldr; If you get the server up and running first then, use your internal IP, and restart home assistant from SSH.

That’s how I ‘wasted’ my weekend

0 Likes

#22

So I am using the geofence from within traccar becuase it is more customiseable than HA zones.

Here is a sensor I have set up to show the status of the geofence, might be useful to some people

sensor:
  - platform: template
    sensors:
      sensorrich:
        value_template: >
          {% if states.device_tracker.rich.attributes.geofence == 'NameOfTraccarGeofence' %}
            in
          {% else %}
            out
          {% endif %}
0 Likes

#23

I can not understand what is the logic of using credentials on the server. I installed addon on Hass.io. Only once did I manage to log in to the server with the login ‘admin / admin’. Changed password. Entered the server, saw a window with a map and devices. I tried to configure the tracker device. Did not work out. Threw. Then, during the setup, Hass ran into problem 502 Bad gateway: proxy nginx. Managed to solve. But now I can not login. Neither the new password nor the old one is accepted. I registered at traccar.org. But the credentials are not authenticated by the server. How do addon Traccar interact with the server? What needs to be entered in coficuration.yaml?

0 Likes

#24

looking for little help. Installed traccar on my hassio PI via the “addon store” but all i get is a 502 bad gateway. looking at the log file traccar is bitching about something hassio has locked. anyone know how to solve this one?

log file:
Exception in thread “main” java.lang.RuntimeException: liquibase.exception.LockException: Could not acquire change log lock. Currently locked by homeassistant (172.30.32.1) since 1/4/19 8:26 PM
at org.traccar.Main.run(Main.java:152)
at org.traccar.Main.main(Main.java:104)
Caused by: liquibase.exception.LockException: Could not acquire change log lock. Currently locked by homeassistant (172.30.32.1) since 1/4/19 8:26 PM
at liquibase.lockservice.StandardLockService.waitForLock(StandardLockService.java:230)
at liquibase.Liquibase.clearCheckSums(Liquibase.java:1442)
at org.traccar.database.DataManager.initDatabaseSchema(DataManager.java:310)
at org.traccar.database.DataManager.(DataManager.java:90)
at org.traccar.Context.init(Context.java:382)
at org.traccar.Main.run(Mai

0 Likes

#25

Thanks for making this addon and also to @ludeeus for the component!
Works really great.

I have added a geocoder in traccar.xml so you can see the address based on the lon lat coordinates.
You can make a free account at https://eu1.locationiq.com for 10,000 requests/day.

<entry key='geocoder.enable'>true</entry>
<entry key='geocoder.type'>nominatim</entry>
<entry key='geocoder.url'>https://eu1.locationiq.com/v1/reverse.php</entry>
<entry key='geocoder.key'>your_key_here</entry>
1 Like

#26

Just added Nominatim - works really well! Had issues with Google, didn’t want to work at all. Nice and easy account setup at their end too.

0 Likes

#27

Anyone else having trouble with space?

After about 1-2 weeks i guess some log gets to big, if i restart the addon it seems to work fine again.
Im running in a VM on a Intel NUC with Proxmox, and the VM has a Boot size of 32gb.

The log in the addon gives only this:

Exception: java.lang.RuntimeException thrown from the UncaughtExceptionHandler in thread "nioEventLoopGroup-3-1"
Exception: java.lang.RuntimeException thrown from the UncaughtExceptionHandler in thread "nioEventLoopGroup-3-2"
Exception: java.lang.RuntimeException thrown from the UncaughtExceptionHandler in thread "nioEventLoopGroup-3-3"
Exception: java.lang.RuntimeException thrown from the UncaughtExceptionHandler in thread "nioEventLoopGroup-3-4"
Exception: java.lang.RuntimeException thrown from the UncaughtExceptionHandler in thread "nioEventLoopGroup-3-5"
Exception: java.lang.RuntimeException thrown from the UncaughtExceptionHandler in thread "nioEventLoopGroup-3-6"
Exception: java.lang.RuntimeException thrown from the UncaughtExceptionHandler in thread "nioEventLoopGroup-3-7"
Exception: java.lang.RuntimeException thrown from the UncaughtExceptionHandler in thread "nioEventLoopGroup-3-8"
Exception: java.lang.RuntimeException thrown from the UncaughtExceptionHandler in thread "nioEventLoopGroup-2-8"
0 Likes

#28

:tada: Release v0.2.0

Full Changelog

Changed

  • Configure Renovate (#6)
  • Removes BountySource links
  • Fixes spelling error in Dockerfile
  • Upgrades nginx to 1.14.2-r0
  • Removes Anchore.io links
  • Updates maintenance year to 2019
  • Refactor of GitLab CI
  • Upgrades add-on base image to 2.3.1
  • Replaces add-on link with GitHub link
  • Upgrades openjdk8-jre to 8.191.12-r0
  • Upgrades Traccar to v4.3

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

0 Likes

#29

Did you fix this? I have exact same issue!

0 Likes

#30

Thanks for sharing gerard33.
How can this be viewed in traccar? Is there a specific setting to change like the Custom Map?

I added the code you provided in traccar.xml and used my own key; however, nothing changes when I click the Show Address hyperlink in the Traccar interface!

0 Likes

#31

@khalilio When you select the device it will show the parameters below (with e.g. lat and lon) and one of the parameters is the address.

Other question. I have noticed that the name of the geofence area doesn’t change anymore even when I have left that area. This was working fine when I first started Traccar.
When I have left the geofence it shows that correctly on the map, just the attribute doesn’t get updated. Anyone else noticing this?

0 Likes

#32

I have been trying to get Traccar working for a few days on A RPI3 B+ HA Ver 0.88.1, but am getting a 502 bad gateway error.
I have tried re-installing and waiting for several hours but still the same.
I have a version of Traccar running on a MAC (using a different port) and have gor this working.

I get his error appearing in the logs which is way beyond my limited knowledge…

2019-02-26 11:23:12 INFO: SELECT COUNT() FROM PUBLIC.DATABASECHANGELOG
2019-02-26 11:23:12 INFO: Reading from PUBLIC.DATABASECHANGELOG
2019-02-26 11:23:12 INFO: SELECT * FROM PUBLIC.DATABASECHANGELOG ORDER BY DATEEXECUTED ASC, ORDEREXECUTED ASC
2019-02-26 11:23:13 INFO: Successfully released change log lock
2019-02-26 11:23:14 INFO: Logging initialized @296113ms to org.eclipse.jetty.util.log.Slf4jLog
Exception in thread “main” java.lang.NoClassDefFoundError: net/fortuna/ical4j/model/Calendar
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetPublicMethods(Class.java:2902)
at java.lang.Class.getMethods(Class.java:1615)
at org.traccar.database.QueryBuilder.executeQuery(QueryBuilder.java:430)
at org.traccar.database.DataManager.getObjects(DataManager.java:452)
at org.traccar.database.BaseObjectManager.refreshItems(BaseObjectManager.java:61)
at org.traccar.database.SimpleObjectManager.refreshItems(SimpleObjectManager.java:67)
at org.traccar.database.BaseObjectManager.(BaseObjectManager.java:43)
at org.traccar.database.SimpleObjectManager.(SimpleObjectManager.java:40)
at org.traccar.database.CalendarManager.(CalendarManager.java:24)
at org.traccar.Context.initEventsModule(Context.java:480)
at org.traccar.Context.init(Context.java:436)
at org.traccar.Main.run(Main.java:110)
at org.traccar.Main.main(Main.java:104)
Caused by: java.lang.ClassNotFoundException: net.fortuna.ical4j.model.Calendar
at java.net.URLClassLoader$1.run(URLClassLoader.java:371)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
… 15 more
Caused by: java.util.zip.ZipException: invalid LOC header (bad signature)
at java.util.zip.ZipFile.read(Native Method)
at java.util.zip.ZipFile.access$1400(ZipFile.java:60)
at java.util.zip.ZipFile$ZipFileInputStream.read(ZipFile.java:734)
at java.util.zip.ZipFile$ZipFileInflaterInputStream.fill(ZipFile.java:434)
at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:158)
at sun.misc.Resource.getBytes(Resource.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:463)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
… 21 more
2019-02-26 11:23:25 INFO: HikariPool-1 - Starting…
2019-02-26 11:23:29 INFO: HikariPool-1 - Start completed.
2019-02-26 11:23:42 INFO: Clearing database change log checksums
2019-02-26 11:23:43 INFO: SELECT COUNT(
) FROM PUBLIC.DATABASECHANGELOGLOCK
2019-02-26 11:23:43 INFO: SELECT COUNT() FROM PUBLIC.DATABASECHANGELOGLOCK
2019-02-26 11:23:43 INFO: SELECT LOCKED FROM PUBLIC.DATABASECHANGELOGLOCK WHERE ID=1
2019-02-26 11:23:44 INFO: Successfully acquired change log lock
2019-02-26 11:23:48 INFO: SELECT MD5SUM FROM PUBLIC.DATABASECHANGELOG WHERE MD5SUM IS NOT NULL
2019-02-26 11:23:48 INFO: UPDATE PUBLIC.DATABASECHANGELOG SET MD5SUM = NULL
2019-02-26 11:23:48 INFO: Successfully released change log lock
2019-02-26 11:23:48 INFO: SELECT COUNT(
) FROM PUBLIC.DATABASECHANGELOGLOCK
2019-02-26 11:23:48 INFO: SELECT COUNT(*) FROM PUBLIC.DATABASECHANGELOGLOCK
2019-02-26 11:23:48 INFO: SELECT LOCKED FROM PUBLIC.DATABASECHANGELOGLOCK WHERE ID=1
2019-02-26 11:23:49 INFO: Successfully acquired change log lock

ANy ideas on a fix

0 Likes

#33

It seems that after the latest home assistant update even if I don’t get any errors in the traccar component and my traccar server gets updated from the clients, the entities in home assistant don’t get updated.

Anyone else having the same problem?

0 Likes

#34

To me traccar is working fine i get a node with id to display location app is starting normally. But i get stuck when trying to connect thru config.yaml i run hassio 0.88.2 latest updated
this config doesn’t work for me. I have opened ports in my “mtk” i can access traccar thru 8072 https from outside i have opened also 5000-5100 TCP and RDP (for the GPRS/GPS this works flawlesly), ports but still i get an error. I have tried with clean install different server same issue have tried all these config variable but none of them work:

device_tracker:
- platform: traccar
host: a0d7b954-traccar
port: 8072
username: !no
password: !no

device_tracker:
- platform: traccar
host: 192.X.X.X
port: 8072
username: !no
password: !no

device_tracker:
- platform: traccar
host: a0d7b954-traccar
port: 8072
username: YOUR_USERNAME
password: YOUR_PASSWORD

This is my error:
019-03-06 04:55:58 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform traccar

One stupid question does this service to be used in hass.io needs a custom_component to integrate traccar into it? Because i found this thread with custom component integration: Traccar.org (GPS/GPRS Tracker) custom platform

0 Likes

#35

Hi, can you help me for install Traccar on my OSX? Thank’s in advance!!!

0 Likes

#36

Hi!

I’m just trying to add my external traccar domain IP to the configuration but it doesn’t work:

   device_tracker:
     - platform: traccar
       host: http://18.XXX.XXX.XX
       username: admin
       password: XXXX
       port: 8082

But it doesn’t work. Anyone could get it working?

Thanks!

0 Likes

#37

I use this configuration:
host: a0d7b954-traccar
port: 8072

I dont remember from where I have this information, but this config is working for me.

0 Likes

#38

Has anyone gotten the websocket worked out with Traccar instead of polling?

0 Likes

#39

:tada: Release v0.3.0

Full Changelog

Changed

  • :arrow_up: Upgrades add-on base image to 3.0.1
  • :ambulance: Workaround Docker issue by reinstating legacy tags
  • :sparkles: Adds ARMv7 support
  • :hammer: Makes log_level optional
  • :fire: Removes custom log format override
  • :arrow_up: Upgrades openjdk8-jre to 8.201.08-r0
  • :sparkles: Adds nss package
  • :hammer: Rewrite add-on onto Bashio

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

1 Like

#40

:tada: Release v0.4.0

Full Changelog

This is a general maintenance release and an option to change the port from the native Hass.io Network settings has been added.

Changed

  • :arrow_up: Upgrades add-on base image to 3.1.0
  • :arrow_up: Upgrades openjdk8-jre to 8.201.08-r1
  • :hammer: Refactor of init scripts
  • :hammer: Makes NGinx wait for Traccar before starting
  • :hammer: Refactors add-on to use Hassio ports on the host network

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

0 Likes