Community Hass.io Add-on: Traccar

hassio-repository
hassio-addon
Tags: #<Tag:0x00007f2047e1d638> #<Tag:0x00007f2047e1d430>

#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


#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 %}

#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?


#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


#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>

#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.


#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"

#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


#29

Did you fix this? I have exact same issue!


#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!


#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?