I’m running the Pentair integration for my pool equipment. This integration provides the pump’s current power consumption in watts. I would like to create a sensor that tracks this consumption in kWh, with the intention to add this new sensor to my energy dashboard. What’s teh best way to go abou this?
Rieman Sum integration helper (with left sum) is what you’re after.
I had a feeling that might have been the case. So I don’t really need Utility Meter?
The Utility Meter helper basically just lets you take a value that’s always increasing and have it reset at user-specified intervals.
So for what you’re asking, no.
Depends. Do you want to acrue power over time with a periodic reset? If so yes. You do need a utility meter
The Reimann sum (left) helper will take watts over time and create an always increasing sensor that will count up forever.
The utility meter (fed by that same Reimann sum) win allow you to reset on a schedule and/or assign tariffs to the meter so you can also count costs.
I thought I was done here with the Sum helper, however after the device turned off for the night and turned on the following morning, this was the result
And. That’s what I would expect if it were powered off?
right, but what’s with the enormous jump at 6 AM? It definitely didn’t consume 6kWh in 1 minute
That pattern denotes a correction. It looks like it was offline and measuring something and when it came back it reported the delta.
IDK what I’m missing here. This is the entity I’m monitoring
I did use the trapezoidal rule instead of the left rule, which I saw that people were recommending. Could that have caused this? I set up another test Sum helper with the left rule, but need to let it run for a day to check the results
That’s the problem. Use left
I confirmed this morning that this was the problem. Is that a bug? I skimmed through the wikipedia article on Reimann sum and it doesn’t seem like that should be the result for trapezoidal.
If you have 0 watts usage at 0:00 because the light is off, then turn on the light at 10:00, subsequently consuming 10 watts for 1 second, then the riemann trapezoidal will assume a gradual increase in power consumption growing from 0 at 0:00, to 5W at 5:00 until it reaches 10 at 10:00. But that is not what happened, you just consumed 10W for one second, not approx. 50Wh as trapeziodal would assume. So that explains the weird peeks you see when using trapezoidal. Left Rieman will correctly assume a square graph, where no new value in the logs means that the value hasn’t changed since last time. And that is what Home Assistant normally registers.