What does your expression look like?
I have fixed the Battery level
with this io113 ? io113 : null
instead of only io113
.
But for the Sleep mode
, this workaournd doesn't work. This is the expression:
io200 == "0" ? "No Sleep" :
io200 == "1" ? "GPS Sleep" :
io200 == "2" ? "Deep Sleep" :
io200 == "3" ? "Online Sleep" :
io200 == "4" ? "Ultra Sleep" :
null
When the io200 attribute is present in the tracker message it works, but if not the warn is traced on the log.
Should work the same way.
With this expression:
io200 ?
io200 == "0" ? "No Sleep" :
io200 == "1" ? "GPS Sleep" :
io200 == "2" ? "Deep Sleep" :
io200 == "3" ? "Online Sleep" :
io200 == "4" ? "Ultra Sleep" :
null
The log shows WARN: Attribute computation error - parse error - ParseException (... < ComputedAttributesHandler:102 < *:113 < BaseDataHandler:27 < ... < *:29 < ... < *:29 < ... < *:29 < ... < GeocoderHandler:87 < ...)
Sounds like you have some error in the expression, but I don't really see it.
Wait.. where's the else statement?
Oh yes! My mistake.... Thanks :)
If anyone falls here, the right expression for teltokina protocol:
io200 ?
io200 == "0" ? "No Sleep" :
io200 == "1" ? "GPS Sleep" :
io200 == "2" ? "Deep Sleep" :
io200 == "3" ? "Online Sleep" :
io200 == "4" ? "Ultra Sleep" :
null : null
If io200 equals "0", do you get "No Sleep" as attribute?
With teltonika devices, if the io200 is 0, this statement: "io200 ? do- if-true : do-if-false" evaluates to false.
For some reason Traccar or JEXL evaluates 0 as null and because of that we have no way to handle the attributes that equal 0.
I haven't found any workaround by far.
Thats logical mistake.
io200 ? io200 : "hui"
if io200 == "1" then answer is 1
if io200 == "0" then first cindition is false and answer is "hui"
Need another solution for testing attributes on existing
I have a computed attribute that is not always present in the tracker message.
Is there any way to avoid to had a
WARN: Attribute computation error - org.traccar.handler.ComputedAttributesHandler.computeAttribute
entry in log when this happend?