Nonsense energy values from Riemann sum integral integration

My tv power consumption history:

And HA says my tv consumed 3 kwh at 12.00, wtf?

Similar (I have no screenshots), I connected phone charger (constant power consumption 30 W) and after 0.5 hours I got 3 kWh. That looks useless for me.

Can I confugure it to get any useful results?

Yes you can. You need to configure it with the correct method for your situation. https://www.home-assistant.io/integrations/integration/#integration-method

method: left is what you want.

2 Likes

Why this method is better for my situation? Can I also confugure how many rectangles will be used to calculate?

Did you read the link I posted?


.

Your power waveform is rectangular.

2 Likes

My refrigerator gives this:


In this case, left sum is ok too?

Yes, left method for that too. Pretty much the only thing the trapezoidal method is good for is smooth continuous waveforms, e.g. a sine wave.

1 Like

Thanks for chiming in about the integration method. I also chose the trapezoidal method after reading the docs.

My application is related to power as well. My source will send a frequently changing power value every second which I then would like use to calculate the approximate energy in kWh.

Reading the docs about the trapezoidal method led me to believe, it would be the best method. For a non-expert the docs could be a bit misleading in my opinion. Also, trapezoidal is the default.

Trapezoidal
This method is the most accurate of the currently implemented methods, if the source updates often, since it better fits the curve of the intrinsic source.

Left
The method underestimates the intrinsic source, but is extremely accurate at estimating rectangular functions which are very stable for long periods of time and change very rapidly

There are links at the bottom of every documentation page for feedback.

I have requested this be changed before and been told “no” by the developers.

OK, thanks. I will consider providing feedback. Although in this case, I don’t really think that I have a sufficient grasp of the topic to provide good feedback. I have an intuitive understanding of what the helper does, but that is about it. I have to rely on other user’s opinions in this case I’m afraid.

Well, left underestimates, right overestimates, trapezoidal should be most accurate, but only for source without any drastic power changes. In my case (and most cases I think for home devices like tv, ligths, washing machines etc), power changes are always fast from 0 to some constant level, or between 2 levels. In such cases, trapezoidal completly fails.