Hello everyone,
I am facing an issue with fuel consumption calculations in the standard Summary Report for stationary equipment (excavators/generators) that works on a single spot without generating odometer mileage.
What I did:
To calculate fuel consumption strictly on standing vehicles, I implemented a true cumulative fuel counter using Computed Attributes (JEXL expressions). I created two attributes assigned to a Teltonika tracker:
fuel (Number): Calculates current liters from IO elements.
fuelUsed (Number): A cumulative odometer that aggregates only fuel drops and "freezes" during refuel events:
prevPosition != null && prevPosition.getAttributes().containsKey("fuelUsed") ? (fuel != null && prevPosition.getAttributes().containsKey("fuel") && fuel < prevPosition.getDouble("fuel") ? prevPosition.getDouble("fuelUsed") + (prevPosition.getDouble("fuel") - fuel) : prevPosition.getDouble("fuelUsed")) : 0
I also adjusted my traccar.xml server configuration to support stationary monitoring:
<entry key='report.ignoreOdometer'>true</entry>
<entry key='processing.fuel.ignoreIgnitionOff'>false</entry>
<entry key='processing.fuel.speedThreshold'>0.0</entry>
<entry key='filter.skipAttributes'>fuel,fuelUsed,ignition</entry>
The Problem:
The fuelUsed attribute compiles and saves to the database absolutely correctly. During the test, the machine burned 11 liters on standby (fuel dropped from 20L to 9L), and the cumulative counter reflected this. Then, a refuel event occurred back up to 19L.
However, the Summary Report completely ignores the fuelUsed database records for the total period. It calculates consumption using simple stateless arithmetic: Initial Fuel (20L) - Final Fuel (19L) = 1L. The actual 11 liters burned before lunch are completely lost in the report layout, even though they are recorded point-by-point in the positions table.
It seems the Summary report only uses the difference of cumulative attributes if the vehicle is moving (has trips/odometer changes), but defaults to raw fuel level differences if the speed is 0.
My Question:
How can we force the standard Summary Report to show actual cumulative consumption for stationary machinery when refuels happen on the spot? Is there a way to patch the report logic or an alternative configuration so that the end-user can click a single button and get a true total consumption (e.g., 11L consumed before refuel + new consumption) without it resetting?
Thank you in advance!
You're using some hallucinated configuration parameters and your computed attributes expression also seems completely invalid.
Thank you for the direct feedback, Anton. I appreciate it.
Let's strip away all the custom JEXL logic and unverified config keys. Let's look at this from a standard Traccar architecture perspective.
We have a purely stationary asset (an excavator working on a single spot, 0.0 km/h speed, no odometer change). It consumes 50 liters of fuel before lunch, then it gets refueled back to its initial level on the spot, and then consumes another 50 liters after lunch.
If we only use a basic computed attribute for fuel (translating raw bytes to liters) and standard native Traccar configuration, the Summary Report calculates consumption as Initial Fuel - Final Fuel, resulting in 0 liters spent for the whole day because the refueling brought the level back to the starting point.
Could you please guide me on the correct, official way to configure Traccar so that the standard Summary Report can properly calculate and display the true total consumption (100L) for stationary equipment when refuels happen on the spot? What are the proper configuration keys for this use case?
You don't need any configuration keys. You just need usedFuel value.
Hello everyone,
I am facing an issue with fuel consumption calculations in the standard Summary Report for stationary equipment (excavators/generators) that works on a single spot without generating odometer mileage.
What I did:
To calculate fuel consumption strictly on standing vehicles, I implemented a true cumulative fuel counter using Computed Attributes (JEXL expressions). I created two attributes assigned to a Teltonika tracker:
I also adjusted my traccar.xml server configuration to support stationary monitoring:
<entry key='report.ignoreOdometer'>true</entry> <entry key='processing.fuel.ignoreIgnitionOff'>false</entry> <entry key='processing.fuel.speedThreshold'>0.0</entry> <entry key='filter.skipAttributes'>fuel,fuelUsed,ignition</entry>The Problem:
The fuelUsed attribute compiles and saves to the database absolutely correctly. During the test, the machine burned 11 liters on standby (fuel dropped from 20L to 9L), and the cumulative counter reflected this. Then, a refuel event occurred back up to 19L.
However, the Summary Report completely ignores the fuelUsed database records for the total period. It calculates consumption using simple stateless arithmetic: Initial Fuel (20L) - Final Fuel (19L) = 1L. The actual 11 liters burned before lunch are completely lost in the report layout, even though they are recorded point-by-point in the positions table.
It seems the Summary report only uses the difference of cumulative attributes if the vehicle is moving (has trips/odometer changes), but defaults to raw fuel level differences if the speed is 0.
My Question:
How can we force the standard Summary Report to show actual cumulative consumption for stationary machinery when refuels happen on the spot? Is there a way to patch the report logic or an alternative configuration so that the end-user can click a single button and get a true total consumption (e.g., 11L consumed before refuel + new consumption) without it resetting?
Thank you in advance!