Teltonika protocol not decoding correctly temperatures below 0

RastreameMX4 months ago

Hi good day.

We have some Teltonika FMC130 devices. They have installed Dallas temperature 1 Wire sensors which reports on io72, io73, io74 and io75 attributes.

They work and report perfect when temperature is over 0 degrees, but today one sensor read temperatures below 0 degrees, and suddenly Traccar changed values from io72 "3" (would be .3 degrees) to "4294967295" (at -0.1 degrees?) and below (lower value was 4294967196, maybe -8.9 degrees celsius?) ...

I think it's because the way that the variables are handled in the teltonika format files, but i'm not good in Java programming :C.

Apparently i've solved it using calculated attributes, and generating temp1 attribute from processed io72, converting values below 4294967295 to coherent values, but i think it could be considered as a bug on teltonika decoding?

Thank you.

RastreameMX4 months ago

Just to consider it.

According to ChatGPT, issue is because the manner of values are processed as unsigned integers. It proposes the following solution :

TeltonikaProtocolDecoder.java

register(72, fmbXXX, (p, b) -> p.set(Position.PREFIX_TEMP + 1, b.readInt() * 0.1));
register(73, fmbXXX, (p, b) -> p.set(Position.PREFIX_TEMP + 2, b.readInt() * 0.1));
register(74, fmbXXX, (p, b) -> p.set(Position.PREFIX_TEMP + 3, b.readInt() * 0.1));
register(75, fmbXXX, (p, b) -> p.set(Position.PREFIX_TEMP + 4, b.readInt() * 0.1));

To

register(72, fmbXXX, (p, b) -> p.set(Position.PREFIX_TEMP + 1, toSignedInt(b.readInt()) * 0.1));
register(73, fmbXXX, (p, b) -> p.set(Position.PREFIX_TEMP + 2, toSignedInt(b.readInt()) * 0.1));
register(74, fmbXXX, (p, b) -> p.set(Position.PREFIX_TEMP + 3, toSignedInt(b.readInt()) * 0.1));
register(75, fmbXXX, (p, b) -> p.set(Position.PREFIX_TEMP + 4, toSignedInt(b.readInt()) * 0.1));

private int toSignedInt(long value) {
    if (value > Integer.MAX_VALUE) {
        return (int)(value - (1L << 32));
    }
    return (int)value;
}

I don't think it could be the best way to solve it, but maybe it helps to identify the issue.

Anton Tananaev4 months ago

I think the issue is that you didn't set the device model.

RastreameMX4 months ago

Hi good day.

Thank you for your answer. Can you please help me to understand where should i set the device model? I didn't know model should be set somewhere.

Thank you.

Anton Tananaev4 months ago

In the device settings.

RastreameMX4 months ago

I always believed that Model, Phone and other fields in device settings were purely informative, didn't know the value placed there had some functionality on data parsing.

The device model is saved as "FMC130". Is this correct or should i write it different format? only 130? space between FMC and 130?

Thank you.

Anton Tananaev4 months ago
RastreameMX4 months ago

Thanks for your answer.

Then that doesn't solves the issue. "FMC130" were already set on "Model" field when issue happened (it happened on device that's installed on truck trailer, and iot's on travel).

Right now i'm configuring new FMC130 device and Dallas sensor to make some tests here on office and identify exactly when and how it happens.

AvlMexico4 months ago

Good morning, I had the same problem with the Dallas BT sensor, I corrected the parameter in the equipment configuration, the truth is I don't remember exactly which of the three parameters it is but it is very easy to do, I think I added 0.1 or 0.01 in the configuration , I did this for the four temperature sensors, FMC130, FMC920