Home Assistant Community Add-on: Traccar

Update but still another issue and a question… is the port 8082 open on the demo server?

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

I get

Error connecting to Traccar, Cannot connect to host demo3.traccar.org:8082 ssl:None [Connect call failed (‘95.216.239.168’, 8082)]

@frenck is there any way to add 5001 and other ports to listen list? Cuz as i right understood listened ports are 5055 only. I have few TK110 trackers in cars and will be cool to track them in traccar and hassio at all)

Take a look in your traccar.xml file, inside that one you add all the ports you want. (as the documentation says)

See this example file.

1 Like

It’s pretty old but does the geofence still work like that for you? In Traccar it works ok but HA won’t update the info for me. It seems like i’m able to get rid of the geofence attribute only by restarting HA (when the tracked device is outside of zones) and when i cross one of my zones it gets stuck again. (everything is up to date)

The last time I checked it wasn’t working. But I don’t use Traccar anymore since a few months.

Thanks. Any good replacement or did you just get used to HA zones?

I am using tha HA iOS app combined with a pinger to detect presence and that’s working fine for me.

1 Like

Hi @sender

Am I correct that you got this working?

Your post is exactly same as my error

What did you change to get it going?

not sure what id did but this works for me:
image

but you need “a port” per GPs device the android one is 5005 (for me)

and then it started working (I do not touch it anymore :-))

Not sure if needed but I edited traccar.xml to add the port 5055

<entry key='osmand.port'>5055</entry>

.

So stupid me thought the webhook created by “hassio > integration” for traccar was the one to add to the android client app. IT’S NOT

I was wrong, that webhook DOES responds with what appears to be the right thing “Setting location for 654321” IT’S NOT :slight_smile:

It is obvoius now, but the url for the client is http://youhassio.com:5055

NOTE: NOT <s>https://</s>.

Hi,
I’m struggeling with Traccar addon in Hassio…
The interegation Traccar Webhook seems to work, I can see my “device identifier” witch I created in the Andriod Traccar Client App . But in the Hassio Traccar UI my device shows as Offline? Sometimes I can see a error message : “Web socket connection error”

Is there a setting in Nginx Proxy Manager I need to do?
I have tried this setting in the config file:

device_tracker:

Also:

device_tracker:

Do I need to port forward 8072 on my Router?
Cheers

Does it have something do with this? : https://www.traccar.org/forums/topic/web-socket-error-on-https/
Settings in Nginx Proxy Manager?¨
Cheers

Hi, HA doesn’t display any device.tracker… entity

Traccar addon is installed, NGINX server is running, MariaDB is running. I have access on Traccar UI, my phone is able to connect to the server

here is my config

device_tracker:
  - platform: traccar
    host: 192.169.1.170
    port: 8072
    username: xxxxxx
    password: xxxxx
    ssl: true
    verify_ssl: false
    monitored_conditions: ['satellites', 'total distance']

Just FYI: I’m not sure about older HA versions but now i’ve noticed it actually works but it’s unable to change a geolocation from “xxxxx” to “none”/“null” (means outside from everything). You need to define “world” zone which contains the whole country then it works as expected.

I’ve got the server addon installed and I’ve put the client app on my Android phone.

I’ve tried to add the phone to the server but it shows offline.

Weird thing is the Traccar webhook integration is showing the device in HA and the phone itself is sending updates successfully to the server using the webhook URL provided.

Any idea why it would be showing offline in the Traccar addon?

Edit: ok the penny has dropped. For others that may read this, the server addon and the webhooks integration are not linked (I thought the webhooks url pointed to the server addon and you needed both).

I changed the url in the android app to http://youhassio.com:5055 as suggested by @anthonykeane and now it connects to the server.

Hi. I’m a complete newbie to Home Assistant, but have been using traccar for several years relying on the demo servers so was very pleased to see that I could create my own server - Thanks Franck.

It was a struggle pulling together all the snippets of info from the main documentation and various support fora, but I think I’m there. So if it helps other newbies I summarize (my interpretation) what I did to get it going.

I’m running on a dedicate Raspberry Pi 4 Model B 4GB with the 32bit version of Home Assistant on a 64GB micro SD card.

  1. Installed MariaDb with the config:
databases:
  - homeassistant
  - traccar
logins:
  - username: homeassistant
    password: [MYHOMEASSISTANTPASSWORD]
  - username: traccar
    password: [MYTRACCARPASSWORD]
rights:
  - username: homeassistant
    database: homeassistant
  - username: traccar
    database: traccar

At this point nothing is using MariaDb but 2 empty databases are created somewhere on my SD card ready for HA and traccar to use.

  1. Added the following to the configuration.yaml file:
recorder:
  db_url: mysql://homeassistant:[MYHOMEASSISTANTPASSWORD]@core-mariadb/homeassistant?charset=utf8

After restarting HA it seemed to pick up the new database, old stuff was lost (I think) but nothing else new appeared.

3 Installed the traccar ad-in with the config:

ssl: true
certfile: fullchain.pem
keyfile: privkey.pem
log_level: info

The GUI worked but no trackers yet. You can create a new account or login to admin/admin. At this point it is using its own DB I think.

4 Set up my trackers - I added the trackers through the GUI with their ID (I have 2 in cars and the traccar client on my phone). Then I changed the URL in the trackers to my home’s domain name maintained by dynu and the router. I then created the port forwarding rules in the router - one for my cars on Port 5002, and the other for my phone on Port 5055 . The phone suddenly appeared on the traccar map but the cars didn’t.

I then added the tracker port I needed for my cars into the traccar.xml file in the config directory by copying the appropriate entry commented out into the custom configuration area thus:

<!-- Enter you custom configuration below this line -->
<entry key='tk103.port'>5002</entry>

Sure enough, the cars then appeared on the traccar map within their 1 minute refresh rate. They, and the phone, also appear as bars in the HA History page.

5 Get traccar to use MariaDb - The following needed to be added to traccar.xml file in the custom configuration area:

<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'>traccar</entry>
<entry key='database.password'>[MYTRACCARPASSWORD]</entry>    

Note. I tried localhost and the Pi’s actual IP address but these didn’t work. I had to use core-mariadb, as used in the recorder: bit above. No idea why!

After restarting traccar it all contuniued to work ok. Infact even the traccar history seems to still be there. I’m guessing it’s using MariaDb but not 100%.

My experience wasn’t as straight forward as this, that’s why I’m writing this to help others. I hope I didn’t miss anything out. It’s all my interpretation of what went on.

I now have a few questions.

  1. Why bother with MariaDb as it all seemed to work regardless?
  2. Apart from hosting my own traccar server, and getting the tracked devices shown as bars in the HA history, What are the benefits of integrating with HA?
  3. Should I be able to see the devices on the homeassistant map?
  4. Can I get cards for the devices on the Dashboard.

Eventually I may want to create rules and stuff based on the arrival of my car at home eg but that’s way off yet as I get to grips with everything!

Thanks to all the contributors.

1 Like

in Host put your IP address of Home assistant

  1. Starting from v0.7.0, MariaDB is used by default if it is preinstalled, so no need to configure manually. I think MariaDB is better than internal DB in terms of performance, but I’m not an expert and do not have experience with none of them because I’m using external database on my Synology NAS.
  1. I think the principal benefit is to make automations with other integrated entities, for example open the garage light or garage door when car enters at home zone… etc…

  2. Yes, you will be able.

  3. Yes, and they can show its attributes values like speed, status, position…

1 Like

Hi,

I’m pretty new to this and would really appreciate some help. I am trying to add Traccar information to a Lovelace dashboard. I would like to add the speed attribute to a gauge. I have tried adding the follwing:

    states.device_tracker.car1.speed
    states.device_tracker.car1.attributes.speed

I have also tried adding the following to my config file to create a value template

  car1_speed:
    value_template:
        "{{states('device_tracker.car1.speed') | float}}"

Any assistance would be greatly appreciated

I have followed all the information on the Documentation available and after seeing my device in the server I wanted to configure the Traccar Manager Android app.
My questions are simple?
What URL should I put on my device to connect to my HA server with the Traccar Manager through duckdns?
For example: https://myname.duckdns.org (should I add a port?)
Should I open ports on my router?

Thanks in advance for your help @frenck