More Traccar attributes


#1

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.


#2

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.


#3

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:


#4

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


#5

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.


#6

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?


#7

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


#8

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


#9

You can use the mobile client.


#10

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


#11

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.


#12

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


#13

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)


#14

yup… looks like it…