i am trying to make this work in computed attributes
alarm == "powerCut" ? false : true
the thing is , device doesnt report alarm alwayse, and most of the times , whene there is no alarm triggered , the attribute alarm is none existed (this perfect for my need actuely and i am aware that i can copy attribute if i want)
this is causing issues in computed attributes , when the attribute i am working on is non exisiting , this wont work : alarm == "powerCut" ? false : true
first half will work (true)
but second always return this error
org.traccar.handler.ComputedAttributesHandler.computeAttribute:138@1:1 variable 'alarm' is undefined - Variable (ComputedAttributesHandler:139 < AttributeResource:63 < ... < OverrideFilter:49 < ...)
is there a way to always return a value even if attribute is undefined
like if there is no alarm i want charge to be always true
thank you
You can do something like this:
alarm ? (alarm == "powerCut" ? false : true) : true
thank you , its working now
i am trying to make this work in computed attributes
the thing is , device doesnt report alarm alwayse, and most of the times , whene there is no alarm triggered , the attribute alarm is none existed (this perfect for my need actuely and i am aware that i can copy attribute if i want)
this is causing issues in computed attributes , when the attribute i am working on is non exisiting , this wont work :
alarm == "powerCut" ? false : true
first half will work (true)
but second always return this error
is there a way to always return a value even if attribute is undefined
like if there is no alarm i want charge to be always true
thank you