Teltonika - Computed Attributes

Hello

I need help with Computed Attributes - our device FM3001 send some unknown data like Io247 which is just a Crash detection or Io15 which is Eco score. After searching the forum I found some pieces of information about it but still, I don't know how to put that together.
In one topic I found that I have to create new key attributes and add them to default.xml in config files but still don't know how to name them. For example: <entry key='crashDetection'>...</entry> - will that be correct? Next, I guess I should add Computed Attributes and then link them to the device. The problem is that I do not fully understand the syntax and how it works.

Anton Tananaev6 years ago

You don't need to add anything to the config file. You need to create computed attribute and link it to your device.

Ok thank you. However, please help me understand / explain me computed attributes - preferably on an example. In addition, the question is whether it is a good idea to apply several computed attributes to a single result from the device - like:

Crash detection1
Io247 ? Io247 : 1
String

Crash detection2
Io247 ? Io247 : 2
String

Marko Pavlinek5 years ago

i have same problem what is correct syntax to read unassigned attribute ? in this case atribute number 247

Hussah Saleh5 years ago

Hi,
Same problem with FMB920, I am trying to fetch Harsh Acceleration, Breaking and Crash events.
would be helpful if you share your solution if done.
Thank you

Marko Pavlinek5 years ago

well if you have new firmware on teltonika than it is firmware bug try reverting to old one. with coputed attributes is next story... until device send actual attribute eg. Io247 traccar will display null, when first event occur you will see your attribute value in traccar.
so provided solution is valid
Io247 ? Io247 : "ok"
String

try messing with teltonica settings to get crash or wild driving. it is hard to detect teltonika firmware bugs but it is good to have few older firmwares for such case (last year when i updated firmware i lost half obd data including crash bumps and wild driving)
hope that help

Hussah Saleh5 years ago

That's really help me,

Thank you Marko, I appreciate your help.

Also, Thanks to Anton, he helped me yesterday with the computed attributes.

Hussah Saleh4 years ago

For more information,

  1. io253==3 ? "hardCornering":null
  2. io255==1? "overspeed":null

These expressions will handle the computed attribute as an alarm but will not be used as notification.
If you want to use the computed attribute in notifications,
you have to use the following expression in order to receive notification as an alarm

  1. event==253 && io253==3 ? "hardCornering":null
  2. event==255 && io255==1? "overspeed":null
Juan Sánchez4 years ago

Hello Hussah,

Trying to set those expressions, on 4.7 i have the following error:

event==200 && io200==2 ? "DEEP SLEEP":null

org.traccar.handler.ComputedAttributesHandler.computeAttribute@102![0,5]: 'event == 200 && io200 == 2? 'DEEP SLEEP' : null;' undefined variable event - Variable (... < ComputedAttributesHandler:102 < AttributeResource:57 < ...)

I try also with yours example and i have the same errors.

But for example, if i put io16 ? io16 /1000 : null this is ok (Teltonika total kilometers)

What could be wrong?

Anton Tananaev4 years ago

You don't have event attribute, as the error indicates.

Juan Sánchez4 years ago

Hello Anton,

Thanks for the reply :)

I have the same error when i try to use teltonika I/O events that were ok on 4.6, for example:

2020-01-21 21:24:18  WARN: Attribute computation error - org.traccar.handler.ComputedAttributesHandler.computeAttribute@102![0,5]: 'io200 == '0'? 'No sleep' : null;' undefined variable io200 - Variable (... < ComputedAttributesHandler:102 < *:113 < BaseDataHandler:27 < ... < *:29 < ... < *:29 < ... < GeocoderHandler:90 < ...)
2020-01-21 21:24:18  WARN: Attribute computation error - org.traccar.handler.ComputedAttributesHandler.computeAttribute@102![0,5]: 'io249 == '1'? 'Aviso de Interferencia' : null;' undefined variable io249 - Variable (... < ComputedAttributesHandler:102 < *:113 < BaseDataHandler:27 < ... < *:29 < ... < *:29 < ... < GeocoderHandler:90 < ...)
2020-01-21 21:24:18  WARN: Attribute computation error - org.traccar.handler.ComputedAttributesHandler.computeAttribute@102![0,5]: 'io200 == '1'? 'GPS Sleep' : null;' undefined variable io200 - Variable (... < ComputedAttributesHandler:102 < *:113 < BaseDataHandler:27 < ... < *:29 < ... < *:29 < ... < GeocoderHandler:90 < ...)
2020-01-21 21:24:18  WARN: Attribute computation error - org.traccar.handler.ComputedAttributesHandler.computeAttribute@102![0,5]: 'io200 == '2'? 'Deep Sleep' : null;' undefined variable io200 - Variable (... < ComputedAttributesHandler:102 < *:113 < BaseDataHandler:27 < ... < *:29 < ... < *:29 < ... < GeocoderHandler:90 < ...)
2020-01-21 21:24:18  WARN: Attribute computation error - org.traccar.handler.ComputedAttributesHandler.computeAttribute@102![0,5]: 'io200 == '3'? 'Online Sleep' : null;' undefined variable io200 - Variable (... < ComputedAttributesHandler:102 < *:113 < BaseDataHandler:27 < ... < *:29 < ... < *:29 < ... < GeocoderHandler:90 < ...)
2020-01-21 21:24:18  WARN: Attribute computation error - org.traccar.handler.ComputedAttributesHandler.computeAttribute@102![0,5]: 'io200 == '4'? 'Ultra Sleep' : null;' undefined variable io200 - Variable (... < ComputedAttributesHandler:102 < *:113 < BaseDataHandler:27 < ... < *:29 < ... < *:29 < ... < GeocoderHandler:90 < ...)
2020-01-21 21:24:18  WARN: Attribute computation error - org.traccar.handler.ComputedAttributesHandler.computeAttribute@102![0,5]: 'io251 == '1'? 'Ralentí Excesivo' : null;' undefined variable io251 - Variable (... < ComputedAttributesHandler:102 < *:113 < BaseDataHandler:27 < ... < *:29 < ... < *:29 < ... < GeocoderHandler:90 < ...)
2020-01-21 21:24:18  WARN: Attribute computation error - org.traccar.handler.ComputedAttributesHandler.computeAttribute@102![0,5]: 'io251 == '0'? 'Ralentí Normal' : null;' undefined variable io251 - Variable (... < ComputedAttributesHandler:102 < *:113 < BaseDataHandler:27 < ... < *:29 < ... < *:29 < ... < GeocoderHandler:90 < ...)
2020-01-21 21:24:18  WARN: Attribute computation error - org.traccar.handler.ComputedAttributesHandler.computeAttribute@102![0,5]: 'io249 == '0'? 'Sin Interferencia' : null;' undefined variable io249 - Variable (... < ComputedAttributesHandler:102 < *:113 < BaseDataHandler:27 < ... < *:29 < ... < *:29 < ... < GeocoderHandler:90 < ...)
2020-01-21 21:24:18  WARN: Attribute computation error - org.traccar.handler.ComputedAttributesHandler.computeAttribute@102![0,9]: 'gpsStatus == '0'? 'GPS OFF' : null;' undefined variable gpsStatus - Variable (... < ComputedAttributesHandler:102 < *:113 < BaseDataHandler:27 < ... < *:29 < ... < *:29 < ... < GeocoderHandler:90 < ...)
2020-01-21 21:24:18  WARN: Attribute computation error - org.traccar.handler.ComputedAttributesHandler.computeAttribute@102![0,9]: 'gpsStatus == '1'? 'GPS ON con FIX' : null;' undefined variable gpsStatus - Variable (... < ComputedAttributesHandler:102 < *:113 < BaseDataHandler:27 < ... < *:29 < ... < *:29 < ... < GeocoderHandler:90 < ...)
2020-01-21 21:24:18  WARN: Attribute computation error - org.traccar.handler.ComputedAttributesHandler.computeAttribute@102![0,9]: 'gpsStatus == '2'? 'GPS ON sin FIX' : null;' undefined variable gpsStatus - Variable (... < ComputedAttributesHandler:102 < *:113 < BaseDataHandler:27 < ... < *:29 < ... < *:29 < ... < GeocoderHandler:90 < ...)
2020-01-21 21:24:19  WARN: Attribute computation error - org.traccar.handler.ComputedAttributesHandler.computeAttribute@102![0,9]: 'gpsStatus == '3'? 'GPS SLEEP' : null;' undefined variable gpsStatus - Variable (... < ComputedAttributesHandler:102 < *:113 < BaseDataHandler:27 < ... < *:29 < ... < *:29 < ... < GeocoderHandler:90 < ...)
Anton Tananaev4 years ago

It means those variables are missing as well.

Juan Sánchez4 years ago

Hello Anton,

Were i can check a list of correct variables?

It's possible that this happens because device don't has sent the (for example) io239? Because with io16 (Total kilometers) i don't have that error.

Regards,