Hello everyone 
if anyone is interested I have developed this simple package to send data from any device_tracker from Home Assistant to Traccar, a popular open-source GPS tracking system, already integrated in HA but from Traccar to HA.
For example, I used it to track on Traccar phones that are already being tracked with Home Assistantās iOS/Android app, without having to install any other software that sends data to Traccar (and without exposing Traccar outside my network) and my electric scooter (Silence) integrated in HA but not on Traccar.
I think Traccar is much better than Home Assistant for storing and showing travel history data, while Home Assistant is much better for automations and everything else.
You can find the script and a very small guide on how to configure and use it here.
https://github.com/lorenzo-deluca/homeassistant-traccar
If anyone wants to participate in the project go ahead and PR at will!
Let me know what you think and if you want to add contributions 
4 Likes
Thanks for sharing Lorenzo!
Works like a charm.
I would like to add a button with tekstbox in home assistant to send an annotation to traccar for when i see something while travelling i want to remember where approx. it is on the map.
Nice project! Works perfectly and indeed Traccar is much better at tracking history.
1 Like
Very interesting project!
Thinking about a possible use for myselfā¦
Cannot get it working with a demo Traccar server.
It has āhttps://demo3.traccar.org/ā address.
Tried this:
url: "http://'xxx:yyy'@demo3.traccar.org:8082"
where āxxxā - login, āyyyā - password.
And in fact āxxxā - email id, āyyyā contains a ā@ā character.
So, the line is like
url: "http://'[email protected]:abc@'@demo3.traccar.org:8082"
Added a device on a Traccar server:

But still the device is not updated:

Modified the automation a bit, it sends a persistent notification:
...
action:
- service: notify.persistent_notification
data:
message: virtual_tracker_1
- service: rest_command.update_traccar
continue_on_error: true
data:
...
So, the notification appears when the āvirtual_tracker_1ā is updated, but the corr. device on Traccar - not updatedā¦
I write it in documentation, for updates I use default protocol that runs on port 5055 
I never try on public demo Traccar server but I guarantee that on local server works :slight_smile
Let me know.
Sad, I am using a public serverā¦
ok, so, you have to check if with default protocol (on port 5055) can be enable authenticationā¦ by default there is no authentication as I know.
Ciao Lorenzo,
Iām using your automation and it works great (thank you for sharing) but I have an issue with battery level with one of my devices. Iām tracking 2 samsung smartphones and a senseCAP T1000-A tracking device. Battery level are correct for my 2 smartphones but stays at 0% for my tracker. In the Sensecap integration, I can clearly see that battery level is reported correctly:
[custom_components.sensecap.sensor] entities:{'2cf7f1c064900884': {'SOS Event': <entity sensor.2cf7f1c064900884_sos_event=[]>, 'longitude': <entity sensor.2cf7f1c064900884_longitude=2.113286>, 'latitude': <entity sensor.2cf7f1c064900884_latitude=48.891124>, 'Air Temperature': <entity sensor.2cf7f1c064900884_air_temperature=20.5>, 'Light': <entity sensor.2cf7f1c064900884_light=0.0>, 'Battery': <entity sensor.2cf7f1c064900884_battery=60.0>}}
Iām pushing these data in a device.tracker using this automation:
battery: "{{ states('sensor.2cf7f1c064900884_battery') | float(0) | round(6) }}"
once these data are in the device.tracker it triggers your automation and the resulting payload is always:
Success. Url: http://192.168.4.8:5055. Status code: 200. Payload: b'?id=device_tracker.t1000_anais&lat=48.891124&lon=2.113286&altitude=0&batt=0&speed=0'
Can you please help me fix this issue, I tried to modify the traccar_positionning.yaml but with no success.
Thanks
Hi,
I found a workaround but Iām no dev, I donāt understand your code so, Iām quite sure my workaround is ugly:
actions:
- action: rest_command.update_traccar
continue_on_error: true
data:
id: '{{ trigger.entity_id }}'
lat: '{{ state_attr(trigger.entity_id, ''latitude'') | float(0) }}'
lon: '{{ state_attr(trigger.entity_id, ''longitude'') | float(0) }}'
alt: '{{ state_attr(trigger.entity_id, ''altitude'') | float(0) }}'
batt: >
{% set device_tracker = trigger.entity_id %}
{% set battery_level = state_attr(device_tracker, 'battery_level') %}
{% if battery_level is not none %}
{{ battery_level | float(0) }}
{% else %}
{% set sensor_entities = states.sensor | selectattr('entity_id', 'match', '.*' ~ device_tracker.split('.')[1] ~ '_battery_level') | map(attribute='entity_id') | list %}
{% if sensor_entities is not none and sensor_entities | length > 0 %}
{{ states(sensor_entities[0]) | float(0) }}
{% else %}
{{ state_attr(trigger.entity_id, 'battery') | float(0) }}
{% endif %}
{% endif %}
speed: '0'
Can you please advise why itās doing this and if it would be better to modify your code to get a proper solution ?
Grazie mille