I have been trying to get the device_tracker working all weekend.
Just managed to do it after 2 days
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 < 127.0.0.1] HEX: 504f5354202f3f69643d3530393437322674696d657374616d703d31353434343037373231266c61743d35332e3232383639323538266c6f6e3d2d332e33343737323833382673706565643d302e3937313932322662656172696e673d3135322e3830303030333035313735373826616c7469747564653d39382e3931313337363935333132352661636375726163793d302e3026626174743d34342e3020485454502f312e310d0a582d466f727761726465642d50726f746f3a2068747470730d0a557365722d4167656e743a2044616c76696b2f322e312e3020284c696e75783b20553b20416e64726f696420393b20506978656c2032204275696c642f505131412e3138313130352e3031372e4131290d0a582d466f727761726465642d466f723a203139322e3136382e312e310d0a582d4e67696e582d50726f78793a20747275650d0a4163636570742d456e636f64696e673a20677a69700d0a582d5265616c2d49503a203139322e3136382e312e310d0a436f6e74656e742d547970653a206170706c69636174696f6e2f782d7777772d666f726d2d75726c656e636f6465640d0a5669613a20687474702f312e31206c6f63616c686f73740d0a582d466f727761726465642d466f723a203132372e302e302e310d0a582d466f727761726465642d50726f746f3a20687474700d0a582d466f727761726465642d486f73743a206f66666c6573732e6475636b646e732e6f72673a383037320d0a582d466f727761726465642d5365727665723a203132372e302e302e310d0a486f73743a206c6f63616c686f73743a353035350d0a436f6e74656e742d4c656e6774683a20300d0a0d0a 2018-12-10 02:08:41 INFO: [e9dca16b: 5055 > 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