NaN Riemann Sum Integral

Hello everyone,
I have a problem with the Riemann Sum Sensor.

I recently installed a small PV inverter. From this inverter i get power values for each panel, but no sum.
So i created a template sensor to sum up the values. This happens every 15s, whenever the inverter provides new values, but only during the day. At night, the inverter is silent.
Also, when the PV produces more energy than is consumed inside the house, the power value reading from my electric meter turns negative. The metervalues are provided every 10s, day and night.
To get the power that i produced and used myself, i created a template sensor that gives me the complete produced power if the metervalue is positive and gives me the produced power + the metervalue if the metervalue is negative.
from this self-consumed power, i’d like to have an energy reading, mainly for putting this into the energy dashboard, so i created a riemann-sum sensor.

This sensor is working on the day it was created, but during night time, it somehow gets a hiccup and does not provide new values the next day. It only shows “NaN kWh”.

I tested all 3 variants of the riemann sum (left, right, trapezoidal), but none of them work.
I also tried to update the tempate sensor with the self-consumed power, so that it is only updated, when new PV power values are produced. This did not help as well.

Interestingly another template sensor that i generated for the grid supply (which is the absolute value of the metervalue, if it is negative and 0 otherwise) works like a charm.

From my understanding of the sourcecode of the riemann sum sensor, lots of zero-values should not affect the reading, but i am not sure about that.

I am out of ideas and hope, someone can help me.

br

Hello, I had a similar problem with the sum sensor. I am attempting to track my PC energy use (which isn’t switched on all the time) using openhardware monitor but I found the values would jump unexpectedly when I turned my PC on.

After reading this thread I added a trigger to my template sensor so it updates every second (even if the value is 0) and it seems to have solved my problem with the riemann sum sensor.

Hopefully this helps you with your problem.