How to track my oil consumption

Hello everyone,

I have moved and now have oil heating in the house. Since I have already integrated everything possible in Home Assistant, it is now obvious to also track the oil consumption and thus get an overview of the total energy costs.
I calculate the oil consumption with the help of a Shelly (querying the time over a certain oil consumption) and the oil throughput per hour. This all works well so far. The conversion to kWh should also be reasonably accurate thanks to the information about my burner.
Unfortunately, I can’t get the consumption correctly into my energy dashboard now, as the built entity resets to 0 every day at 00:00. So I have then no reasonable tracking in the energy dashboard.
I also tried to save the values using a helper consumption counter, but since the input value resets to 0 at night, I don’t get any usable values here.
Do you have any idea how I can work around this?
I have attached an example image of my daily consumption counter.

Have you tried using a utility meter helper?

Yes, I have tried that. After the first day, however, the consumption has gone into the negative due to the reset:

That should not matter if the entity has state_class: total_increasing.

It should definitely not do that. Can you share your utility meter settings?

Thanks for the hint, I had device_class: measurement stored until earlier. Now I have changed it to total_increasing, here once my configuration:

configuration.yaml

sensor:
  - platform: history_stats
    name: Oil Burner Time Today
    unique_id: oil_burner_time_today
    entity_id: binary_sensor.heizung_aktiv
    state: "on"
    type: time
    start: "{{ today_at() }}"
    end: "{{ now() }}"

template:
  - sensor:
    - name: Oil Power Today 
      unique_id: oil_power_today
      state: "{{ states('sensor.oil_burner_time_today') | float(0) * 2.353 * 10.68 }}"

homeassistant:
    customize: !include customize.yaml

customize.yaml:

sensor.oil_power_today:
  device_class: energy
  unit_of_measurement: kWh
  friendly_name: Öl Heizleistung
  state_class: total_increasing

And the helper I have now recreated as follows:

Is that correct so far?

Hello,

and thank you for the question and the code.
Not sure if I may use this reply to ask.

‘state: “{{ states(‘sensor.oil_burner_time_today’) | float(0) * 2.353 * 10.68 }}”’

What are you calculating here?

Since I have almost everything set up as described here and was then able to get that into my energy dashboard as ‘gas’ consumption.

Our oil burner uses 0.04 l per Minute (equals 2.4 l per hour).
my fix price would be 1.05 per liter.

my energy dashboard shows after approx. one hour a consumption price of around 193 Eur per day - which in my opinion would ruin me in a year.

can you maybe help / explain the syntax of your sensor calculation?
Where do i have to look first, Yaml, customize.yaml, helper?

And when I have already a sensor for burner hours, could I use that ?

I am trying to do the same , to find my burner consumption and quantity of oil burned or left in the tank . I have the entity that count how many time and how long the burner has run but cannot figure out a way to get an helper to compute the result. I know the pgh consumption of my burner.

Sorry if this is a slight tangent, but it might help someone if you are just monitoring the oil from the tank, and not trying to measure real-time:
https://github.com/masaccio/ha-kingspan-watchman-sensit/issues/31