More Traccar attributes

In the previous custom component:
https://github.com/koen01/hass/blob/master/custom_components/device_tracker/traccar.py

I was able to add “speed”, “motion” and “batteryLevel” as attributes to my traccar device_trackers.
These attributes would be very helpful to have in this new traccar component.

Nice to be able to have automations reacting on motion=true, speed>120 or batteryLevel<20 for example.

Am i the only one using traccar?
2 days and not even a singe comment on my post :frowning:
Was hoping @ludeeus would see this and maybe have a opinion.

I did see it and have a response, but I don’t think you will like it.

I believe that if these types of attributes where to be exposed, they should be sensors, and not attributes to the device_tracker entity.

motion== binary_sensor
current_speed == sensor
battery_level == sensor

This will require creating a component to do API handling and communication to the platforms.
I do not see myself doing that anytime soon, but others are most welcome to do so :slight_smile:

Get people voting for this, to gain traction :slight_smile:

1 Like

Ok…
Ill go back to use the old custom component in the meantime untill someone with knowledge and time grab a hold of this.

1 Like

First of all, thanks for making the traccar component!

I think however it’s business as usual to add these items as attributes. Other device_trackers do the same:
Google Maps
Owntracks
TrackR

Also the device tracker of the HA iOS app shows speed and battery as attributes.

I will have to look into the code for those trakcers.
but the iOS one does have battery level and Battery state as sensors:
https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/sensor/ios.py
I was not aware that the HA iOS app reports speed, where did you see that?

It’s part of the attributes of the device tracker, see the screenshot of my config.

I need to find a Traccar device; once I do, I can give this a shot.

You can use the mobile client.

Are there consensus for adding these kind of attributes to device_tracker entities?
if so https://github.com/home-assistant/home-assistant/pull/19090

1 Like

If someone is going to work on this it might be good to know that the speed that is reported from the traccar server is reported i knots, no matter what you have set inside the traccar server UI.

So this does not work?
https://www.traccar.org/forums/topic/change-speed-unit-in-traccar-server-online/#post-25073

1 Like

As far as my experience that only change the speed unit in the web ui and atleast the android traccar server app (i guess that app only wrap the web ui)

yup… looks like it…

:frowning: same here… wonder why the custom component was never used in the integration as opposed to starting from what I can see is a new component from scratch? Surely the custom component can be integrated as an official component?

The reason is quite simple, I was not aware of the custom one before making this.

Hi @ludeeus,

Sorry for bumping this old tread but may i request additional attribute for traccar?

I would like to request for last_seen attribute.

Thanks.

Please include “Total Distance” attribute too. I plan to put one smartphone with traccar in my car. If HA can get the value of the total distance travelled, then I can create an automation to remind me to send the car for servicing when it hits certain value.

Any updates on getting the device_tracker battery as a sensor? Dont want to use custom components

Any chance we can get total distance or odometer added please?