in my coban 103 (protocol gps103) devices , when sending the comaand to stop engine an attribute called event : jt received and for resume engine the event become : tk
i am trying to make a custom notification in computed attribute like this :
attribute : alarm
experssion : event == 'kt' ? 'powerOn' : null (or : event == 'jt' ? 'PowerOff' : null)
tpe: string
but i keep getting this error
org.traccar.handler.ComputedAttributesHandler.computeAttribute:138@1:1 variable 'event' is undefined - Variable (ComputedAttributesHandler:139 < AttributeResource:63 < ... < OverrideFilter:49 < ...)
even thou in my config i have this set up :
<entry key='processing.copyAttributes.enable'>true</entry>
<entry key='processing.copyAttributes'>
<entry key='processing.computedAttributes.localVariables'>true</entry>
<entry key='processing.computedAttributes.loops'>true</entry>
<entry key='processing.computedAttributes.deviceAttributes.config'>true</entry>
<entry key='processing.computedAttributes.deviceAttributes'>true</entry>
<entry key='processing.computedAttributes.lastAttributes'>true</entry>
<entry key='processing.computedAttributes.newInstanceCreation'>true</entry>
can anyone please help me
The error seems to be pretty clear. Event is not available, so your expression is failing. You have to check that it exists before using it.
the moment i tested it , it did exist,
when i sent the command resume engine i received an attribute event=kt
i imidietly went and tested the computed attribute
editting
you are totaly right
i just wasnt fast enough
now its working
It's possible that it exists in some positions only.
i am sorry Anton i edited my comment
you were right , when i tested it the attribute wasnt availbale
sorry again
after through testing , its working but not all the time
the first couple of time the alarm got triggered byt now its not .
Are you sure it's not a duplicate alarm?
in my coban 103 (protocol gps103) devices , when sending the comaand to stop engine an attribute called event : jt received and for resume engine the event become : tk
i am trying to make a custom notification in computed attribute like this :
attribute : alarm
experssion :
event == 'kt' ? 'powerOn' : null (or : event == 'jt' ? 'PowerOff' : null)
tpe: string
but i keep getting this error
even thou in my config i have this set up :
<entry key='processing.copyAttributes.enable'>true</entry> <entry key='processing.copyAttributes'> <entry key='processing.computedAttributes.localVariables'>true</entry> <entry key='processing.computedAttributes.loops'>true</entry> <entry key='processing.computedAttributes.deviceAttributes.config'>true</entry> <entry key='processing.computedAttributes.deviceAttributes'>true</entry> <entry key='processing.computedAttributes.lastAttributes'>true</entry> <entry key='processing.computedAttributes.newInstanceCreation'>true</entry>
can anyone please help me