The expression doesn't seem to be valid.
I have missed the question mark, but i have put it there now. Nevertheless, I still think the expression is wrong. As a template, given parameter xy can I assume it is
xy ? lastXy
If not, what is the correct template to do this?
Better phrased, keep the last non-null value (therefore ignoring null values)
Why not use attribute copying?
Is that the recommended way?
If not this might work:
(io390 != null ? (io390 / 10) : previous(Fuel))
@Anton
How is attribute copying used? After adding
<entry key='processing.copyAttributes.enable'>true</entry>
to traccar.xml and restarting docker, nothing changes in the web ui to allow for copy attributes with conditions. The GPT model you made suggests i need to add
but this ends up looping my system
That's not a valid configuration. Please read the documentation.
That is from the Traccar GPT model you made.
From the documentation :
Which tells me
<entry key='processing.copyAttributes.enable'>true</entry>
<entry key='processing.copyAttributes'>io390,io389</entry>
etc. This is it? The above lines retain the value for io390 and 389 when the device does not send it?
Have you tried?
Hello Traccar,
I would like to use the last value for a computed attribute on display, when the device stops reporting it. For instance, I have the OBD Fuel of a Teltonika FMC003 reported as io390. If the device is online, I can see the value on the dashboard just fine. If the device is offline, the value is lost.
I have enabled
processing.computedAttributes.lastAttributes
but the codedoes not work. Obviously I am missing something, but I cant wrap my head around what the correct expression has to be