Unable to get Traccar device-tracker in HA

Yes! Played around with that port and found another suitable one :slight_smile:

Hi @sender, do you still use Traccar and would be willing to share the config for both the addon and the integration. I simply cannot get devices to show from my traccar server to HA, and Iā€™ve tried so many combinations

Did you figure this out? In the same boat.

Yes, the devices were showing up in Traccar, but not in HA. Turns out I simply just needed to set track: true in known_devices.yaml for the traccar devicesā€¦

In case this helps someone in the future, I did end up getting my device to show up just wasnā€™t evident right away. I had to go search for it under States in Developer Tools to see that it was active.

I have read that known_devices is deprecated and I didnā€™t have to utilize it.

Note this is running behind a reverse proxy, so for me, SSL is true, and in that case I had to utilize port 443 for SSL. I have read other configs that may need this to be false to make it operable, plus will have to adjust port status and opening of the port on your network.

My configuration utilizes a secrets file to hide details but the gist of it is this under configuration.yaml

device_tracker:
  - platform: traccar
    host: !secret traccar_hostIP
    port: !secret traccar_port#
    username: !secret traccar_userID
    password: !secret traccar_passID
    ssl: true
    verify_ssl: false
    event: ['all_events']
    new_device_defaults:
      track_new_devices: true
    max_accuracy: 13
1 Like

For anyone else struggling to set up traccar, here is some things I learned.

  • Host must not include http/https only include demo.traccar.org not https://demo.traccar.org
  • The update info from traccar function does not provide a log output if the connection failed. If you see ā€œTesting connection to Traccarā€ in your logs and its not followed by ā€œConnection to Traccar restoredā€; then your connection to the traccar server failed.
  • If you made a sub account for ha, make sure that you add all geofences connected to devices on the account. If account includes a device without the relevant geofence you will receive an error Error combining data from Traccar, # where # is the id of the geofence

I hope this helps the next person

1 Like

My setup always was like this:

device_tracker:
  - platform: traccar
    host: demo3.traccar.org
    username: !secret traccar_login
    password: !secret traccar_password

Getting these errors for a last month:

2022-07-20 02:47:27 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform legacy traccar
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/device_tracker/legacy.py", line 254, in async_setup_legacy
setup = await self.platform.async_setup_scanner(
File "/usr/src/homeassistant/homeassistant/components/traccar/device_tracker.py", line 197, in async_setup_scanner
return await scanner.async_init()
File "/usr/src/homeassistant/homeassistant/components/traccar/device_tracker.py", line 235, in async_init
await self._async_update()
File "/usr/src/homeassistant/homeassistant/components/traccar/device_tracker.py", line 250, in _async_update
await self._api.get_device_info(self._custom_attributes)
File "/usr/local/lib/python3.10/site-packages/pytraccar/api.py", line 117, in get_device_info
geofence = self.geofences[dev["geofenceIds"][0]]
TypeError: 'NoneType' object is not subscriptable

There is an issue: