Including a Computed Attribute in popup info

Kaldek22 days ago

I'm down the rabbit hole of setting up a custom immobilizer function for my customers which uses latching relays that stay immobilized even if the tracker is discovered. Via Teltonika FMM130 devices, I have the latching working (with an emergency in-car button to disable the immobilizer) and because this is a latching relay, the only reliable way to determine if the car is immobilized is to track the ignition status and whether the immobilizer relay is powering the device being immobilized (e.g., ECU/fuel pump/coil pack).

My computed attributes work, and look like so:

Screenshot 2024-11-06 152708.png

I'd like to add this computed attribute to Popup Info so the customer can see if their vehicle is marked as immobilized. However, I don't see this as an option anywhere. If I select "More Details", I can at least see the status of the "Immobilized" computed attribute.

Anton Tananaev22 days ago

You can just type your custom attribute name and select it.

Kaldek22 days ago

Yeah I did that but it didn't appear. Let me try again.

Kaldek22 days ago

Hmmm, not appearing. But then neither is the "Description" under "More Details". I'll try it using the lower case.

Screenshot 2024-11-06 163536.png

Kaldek22 days ago

That seems to have done it.

Screenshot 2024-11-06 163900.png

There's a bit of weirdness in the status update, in that Traccar updates the attributes after a command is sent, but the command response doesn't include attributes. The result is that neither the computed attribute or the majority of core attributes are seen for the device.

2024-11-06 16:37:52  WARN: Attribute computation error - org.traccar.handler.ComputedAttributesHandler.computeAttribute:137@1:1 variable 'ignition' is undefined - Variable (ComputedAttributesHandler:138 < *:149 < BasePositionHandler:34 < ProcessingHandler:171 < MotionHandler:41 < ...)

This seems to require forcing another data update from the device for it to fix it so all of the attributes are available.

Anton Tananaev22 days ago

Why is that weird? If your device is not reporting some attributes, you won't have them.

Kaldek22 days ago

I think what you're saying is that this is a device side issue I need to resolve. That being, the result of a Saved Command sent to the device has some of the attributes, but not all of them.

Example:

2024-11-06 16:37:52  INFO: [T057b5ab4: teltonika < 1.152.111.245] 

.... Bunch of Hex from Teltonika Device ...

2024-11-06 16:37:52  WARN: Attribute computation error - org.traccar.handler.ComputedAttributesHandler.computeAttribute:137@1:1 variable 'ignition' is undefined - Variable (ComputedAttributesHandler:138 < *:149 < BasePositionHandler:34 < ProcessingHandler:171 < MotionHandler:41 < ...)
2024-11-06 16:37:52  INFO: Event id: 863251070XXXXXX, time: 2024-11-06 16:37:52, type: commandResult, notifications: 0
2024-11-06 16:37:52  INFO: [T057b5ab4] id: 863251070XXXXXX, time: 2024-11-06 16:37:42, lat: -XXXXX, lon: XXXXXX, course: 194.0, result: DOUT1:Already set to 0 DOUT2:1 Timeout:10s DOUT3:IGNORED
2024-11-06 16:37:56  INFO: user: 1, action: command, deviceId: 3, type: custom

It appears that the data contains only the string DOUT1:Already set to 0 DOUT2:1 Timeout:10s DOUT3:IGNORED and doesn't contain any attributes, which is maybe why they're being cleared out?

I don't seem to recall having this issue before I set up computed attributes.

Kaldek22 days ago

Hm this seems to be working now.. I think I've done something here which forces the device to send an update record after it's received the command. Which, to be honest, was my original idea on how to solve the issue.

This is a Teltonika thing then. No more assistance required.