I have a sensor reporting instantaneous power usage and I’d like home assistant to report the integral of that power over the last hour on every input sample.
So at any point I can see how many kWh this device was using over the last hour.
Integration - Riemann sum integral - Home Assistant seems to be it but it’s actually increasing seemingly forever. Like it gives the total kWh used since the sensor inception. This is not what I’m aiming for.
That’s not it unfortunately as the utility_meter ramps up but then resets to 0 before ramping up again.
In my case I’m only interested by the last point before the reset but I’d like the block to keep updating that last point indefinitely on every input sample.
Hi @tom_l,
looks like these discord links are not working anymore.
Can you give a hint which change in 2021.8 did solve the OP’s problem? I don’t see it and I am working on a similar problem right now.
Thanks.
I’m looking to calculate the half-hourly cost of charging my car - I am on a variable tariff that changes every 30 minutes. I have a sensor that gives the instantaneous power going to my car, and another sensor that shows the current rate. That looks very similar to the question posed here. The Energy dashboard solved that for an entire household energy consumption, but I can’t figure out how to do it for a single device.
I was able to getting a rolling window integral by:
Creating an Integral sensor
Creating a Statistics sensor for the change in the Integral with the desired time window
Smoothing out the noise in the change with an average_linear Statistics sensor with a time window larger than the max sub-interval of the original Integral sensor.