Show battery percentage from H02 protocol ?

gaskooa year ago

Why is dangerous?

Anton Tananaeva year ago

Because we assume that the value is number, so it might crash somewhere if it's not.

gaskooa year ago

I will test couple weeks and give feedback.

Geoff Backa year ago

After working on this for a couple of hours today I have the battery level showing up for the SinoTrack ST-905 tracker, and it should work for the others too. To do this, you need a computed attribute that converts the 'io5' string attribute into the numeric 'Battery Level' attribute. Unfortunately that doesn't seem to be as simple as it appears.

First, enable objects in the computed attributes by adding this to your traccar.xml:

<entry key='processing.computedAttributes.newInstanceCreation'>true</entry>

Then add a Computed Attribute with Attribute = "Battery Level" which will automatically set Type to Number. For Expression enter this:

io5 ? new("java.lang.Integer", io5) : null

Finally, turn on the attribute on the appropriate device.

Viola, battery level on the SinoTrack device.