If statement in computed attributes

Ray3 years ago

Hello,

When i try

battery == 100 ? "Battery_is_Full" : null

it works and a alarm is raised.

If i try

battery < 100 ? "Problem" : null

It does not work.

And i get following error:

org.traccar.handler.ComputedAttributesHandler.computeAttribute@102![0,12]: 'batteryLevel < '100'? 'problem' : null;' undefined variable batteryLevel - Variable (... < ComputedAttributesHandler:102 < AttributeResource:57 < ...)

Is there a IF statement?

Like if battery is lower then 100 alarm is raised.

Anton Tananaev3 years ago

The error means that you don't have batteryLevel attribute in that specific message.