Bug or wrong configuration of Riemann sum integral?


for my energy Dashboard I have to calculate some values.
I use Templates to split one Sensor with negativ and possitiv values in two Sensors only with positiv values.
And I use a helper (Integration - Riemann sum integral sensor) to calculate from power to energy.
I think If there is long time zero the inegration take the last value and time for the calculation. and I get a jump in the chart.

How can I fix it?

You have not shared your sensor config so it’s hard to say for certain but you may be using the wrong method. The default is “trapezoidal”, for your data you want to use “left”.

I think you are right.
I hab use standard for this Helper.

now my question were can I see the Configurtion of this Modul.

I only find him at the GUI and there I only can change the numbers behind the “:”

I am new, I use Home Assistant since January tjhis year.

my solution now: The templates for to get no negativ Value give out no zero. whe the Value should be 0 they gave out 0.00001. This works.


Hi @Held_vom_Forst ,
here is the template i use to split a power sensor into 2 (from grid and to grid) :

  - sensor:
      - name: from_grid_power
        unit_of_measurement: 'W'
        device_class: "power"
        state: "{{ max(states('sensor.smappee_1107000202_local_total_consumption_active_power') | float, 0) }}"
        state_class: measurement

      - name: to_grid
        unit_of_measurement: 'W'
        device_class: "power"
        state: "{{ max((0 - states('sensor.smappee_1107000202_local_total_consumption_active_power') | float), 0) }}"
        state_class: measurement

In my configuration.yaml is no integration, I had done the configuration in the GUI, and now I know no way to change it.

@mistertix The sensors to split the power are working.

you can just delete it and recreate it.
if you put the same name the history will be kept.

if you want to clean history but keep the same name, before recreate it, you need to call service : Recorder : Purge Entities

This is good to know, thank you very much for that information. Before I delete, I would like to know, if I miss-configured my helper - or something else is wrong. (It was working find till the end of last year and now, the sum seems to be off a lot.)

Is there a way to see the current configuration of my Riemann-Helper?

Hi @HeldvomForst

I had the same problem.
Take a look here
Strange behavior in energy calculation