Riemann sum integral did reset to zero

Hi all,
I am (roughly) tracking my gas consumption by using a Rieman sum on the current power as reported by my boiler using modbus.

That means I have a modbus sensor reporting the current power in kW

      device_class: power
      state_class: measurement
      unit_of_measurement: kW

and a rieman sum integral that I had set up before it was available as helper in the UI using this yaml:

sensor:
  # https://www.home-assistant.io/integrations/integration/
  # Integrate the instantaneous kW into a cumulative kWh sensor
  - platform: integration
    source: sensor.heater_power
    name: Heater Energy
    round: 2
    method: left

It was all working fine for a very long time, but now I noticed, that my energy dashboard shows a -18000 kW usage on one day, caused by the integrated sensor having reset to 0.

The instantaneous power (modbus) looks like this:
power

The integration result like this, with no reading from May 20 to June 11, as no gas was used, then continues at 0 kWh:
energy

The dashboard shows the negative usage on June 11:
dashboard

Any idea, why this happened and how I can fix the wrong value?
My first idea was to check out the Developer>Statistics options, but it shows “0” for the time period of interest. I also tried simply deleting the few wrong states from the database, but that did not work.

I have similiar problems with all my riemann sums. they just reset to zero sometimes and I dont know why. really annoying.
Ps. Im trying to update now: State of Riemann sum integral sensor resets to zero · Issue #94653 · home-assistant/core · GitHub

1 Like