Telic Accu attribute

cis7 years ago

I am using a Telic device (SBC-AVL). The device reports the voltage of the external power. But does this in a peculiar way: as the Telic-manual states, the real voltage needs to be calculated by the server:
"Calculate Vcc voltage from power supply input:
u = uc * 0.128V +6V
(u = voltage in V; uc = unsigned char value transmitted in event Message)"
The demo-server of traccar does not do this calculation, it displays the uc value, not the calculated one. It states "50 V" whereas real pwr was only 12.1 V
Now I tried to change this through "calculated attribute" but I don't really know what I am doing, even after reading the documentation and some of the JEXL-docs.
Is this überhaupt the right way ?
And if so could you give me a good example on how to do this?

Anton Tananaev7 years ago

Documentation has some examples.

dimonchik7 years ago

Try it like this.
power
power ? power * 0.128 + 6 : null
Number

cis7 years ago

Thanks Dimonchik, but I actually had tried that. Maybe problems resides somewhere else. Every time I add a calculated attribute (like the one you proposed) and click the question mark to test it, a pop-up appears saying "No Content".

dimonchik7 years ago

Try restarting the traccar server! Sometimes after input, the data does not take effect. I had this :-)

cis7 years ago

So far I am trying all this on the demo server (nr 4).
Maybe that's the problem.
This weekend I'll redirect unit to my own server and try again.

dimonchik7 years ago

What attribute are you trying to calculate? What name? Power or Adc #?
Test calculate Fuel

cis7 years ago

in the state of the device the attribute is listed as "Battery" (or 'Accu' in Dutch).
I am on my own server now and I still get the 'no content' although there are plenty of messages.

I've tried:

English [attribute Battery] Battery ? Battery 0.128 +6 : null
English [attribute Power] power ? power 0.128 +6 : null
Dutch [attribuut Accu] accu ? accu * 0.128 +6 : null

everytime I get 'no content' (I am running locale=en now)
I have also tried stop/starting the service (sudo bash /opt/traccar/bin/startDaemon.sh )
Makes no difference.

cis7 years ago

Wow, I got sth
unfortunately I can't paste the printscreen I've made, but it seems to compute correctly.
When I hit the question mark, I get the correct value in the pop-up.
And IT WORKS, GREAT