Hi,
I’m using Torque - Home Assistant to track my car gas and distance.
The problem is that the sensor resets to zero at the beginning of each trip, so it only reports the ‘per trip’ values, going back to zero.
I want to have a sensor of the accumulated distance and gas usage.
For that, i created the following template sensor: Template - Home Assistant
- sensor:
- unique_id: 'mycar_fuel_used_total'
name: "MyCar Fuel Total Consumed"
state: "{{ (states('sensor.mycar_fuel_used_trip')|float(default=0)) }}"
unit_of_measurement: "L"
icon: "mdi:gauge"
state_class: total_increasing
device_class: volume
With special emphasis on the ‘total_increasing’ which, per definition, should identify that when the value drops below the previous one it means is a ‘reset’ and should account to be adding it up to the recurring total. Sensor Entity | Home Assistant Developer Docs
Statistics of the accumulated growth of the sensor’s value since it was first added is updated every 5 minutes.
However, my sensor is not calculating the accumulated growth, when the underlying sensors goes back to zero, the new template sensor goes back to zero as well.
- Any idea why this is not working? I’m using the wrong sensor type maybe?
Thanks.