What are the corresponding total distance?
The current totalDistance values from the API are:
My offset calculations:
So my corrected expression should be:
deviceId == 6 ? totalDistance + 43438000 : deviceId == 5 ? totalDistance + 78625000 : totalDistance
Is this the correct approach for adding odometer offsets?
I'm a bit confused. Isn't it the expected values?
Sorry for the confusion! You're absolutely right. Let me clarify with the current actual values:
Current API data:
But computed attribute returns:
The expected results (84,810 km and 115,257 km) are what the vehicles' real odometers should show after adding the GPS offset.
My expression:
deviceId == 6 ? totalDistance + 43438000 : deviceId == 5 ? totalDistance + 78625000 : totalDistance
The computed values don't match the expected totalDistance + offset calculation.
When you change the expression does the value change? Say if you just return a fixed value.
No, the values didn't change at all. I updated the computed attribute expression to:
deviceId == 6 ? 99999000 : deviceId == 5 ? 88888000 : totalDistance
Expected:
Actual results (unchanged):
The computed attribute doesn't seem to be active or working at all. The odometer values in the API response are the same as before the expression change.
Questions:
You're making some assumptions that your device id check works. I would recommend trying a hardcoded value without any logic.
You're absolutely right. Let me test with the simplest possible expression first.
I'll change the computed attribute to just:
99999000
This should return 99,999 km for ALL devices if computed attributes are working at all.
Testing now...
it seems that the following expression is giving me the desired odometer.

however, with the following curl command I don't get same data.
it is the deviceID = 6
● Bash(curl -H "Authorization: Bearer
XXXXXX"
http://192.168.2.251:8082/api/positions)
⎿ [
{
"id": 1451188,
"attributes": {
"priority": 0,
"sat": 11,
"event": 239,
"ignition": false,
"motion": false,
"rssi": 3,
"io200": 0,
"io69": 1,
"pdop": 1.1,
"hdop": 0.8,
"power": 13.158,
"battery": 4.117,
"io68": 0,
"operator": 20210,
"odometer": 27896647,
"distance": 0,
"totalDistance": 41404594.97353495,
"hours": 2778626670
},
"deviceId": 6,
"protocol": "teltonika",
"serverTime": "2025-11-20T12:36:27.865+00:00",
"deviceTime": "2025-11-20T12:36:24.000+00:00",
"fixTime": "2025-11-20T12:36:24.000+00:00",
"outdated": false,
"valid": true,
"latitude": 38.1751416,
"longitude": 20.4889666,
"altitude": 37,
"speed": 0,
"course": 49,
"address": null,
"accuracy": 0,
"network": null,
"geofenceIds": null
},
{
"id": 1451229,
"attributes": {
"priority": 0,
"sat": 11,
"event": 240,
"ignition": true,
"motion": false,
"rssi": 2,
"io200": 0,
"io69": 1,
"pdop": 1.2000000000000002,
"hdop": 0.9,
"power": 14.053,
"battery": 4.0840000000000005,
"io68": 0,
"operator": 20210,
"odometer": 22726950,
"distance": 5.8711763834035064,
"totalDistance": 36718352.60875312,
"hours": 2922770550
},
"deviceId": 5,
"protocol": "teltonika",
"serverTime": "2025-11-20T13:06:40.276+00:00",
"deviceTime": "2025-11-20T13:06:34.000+00:00",
"fixTime": "2025-11-20T13:06:34.000+00:00",
"outdated": false,
"valid": true,
"latitude": 38.1644333,
"longitude": 20.495945,
"altitude": -5,
"speed": 0,
"course": 41,
"address": null,
"accuracy": 0,
"network": null,
"geofenceIds": null
}
]
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1326 100 1326 0 0 54505 0 --:--:-- --:--:-- --:--:-- 55250
I don't see a trip odometer in your attributes at all.
I think I’ve been approaching my question the wrong way for the last two days, so let me clarify it properly.
Is there any way to adjust or correct the stored Traccar data so that the system shows the actual odometer reading of the vehicle (as displayed on the car’s dashboard)?
In other words: can I safely align Traccar’s odometer value with the real car mileage?
Also, I would really appreciate a clarification on the difference between odometer and totalDistance in Traccar.
From my understanding:
totalDistance is the raw cumulative distance reported by the device (in meters), continuously increasing.
odometer is a calculated or adjusted value that can include offsets or custom logic.
Is this correct?
Thanks in advance, and sorry for the confusion — I’m just trying to make sure the mileage I see in Traccar matches the real car values.
Regards,
Gerasimos
totalDistance - calculated on the server based on locations
odometer - reported by your device
Send a command to the device with the correct odometer value. (unless it takes it from OBD2)
I have to do it sometimes because of the cumulative drift some devices have while under a roof makes a lot of distance.
Since they are diferent vehicles, you can change de device identifier from the "old" vehicle to... "something" and add a new device with the actual identifier for the new vehicle. This way you can keep history and have no confusion on usage.
Hello,
I'm trying to set up computed attributes to add an odometer offset for vehicles where GPS was installed after purchase. Here's my setup:
Traccar Version: 5.12
Issue: GPS devices installed on vehicles that already had mileage, need to add offset
Current Setup:
Expected Results:
Actual Results:
The API returns the computed odometer values but they don't match my calculations. It seems like the expression isn't being applied correctly or there's something else
interfering.
Questions:
Any help would be appreciated!
Thanks