Home Assistant, by default does not record/save consecutive sensor values.
And this leads to errors in the computation of integrals, eg template sensors to convert power (W) to (kWh) for the energy dashboard.
The attached graph illustrates this:
I have solar installed and my smart meter reports energy going into and out of the grid:
Yellow curve - grid activity, negative is export, positive is import, in W
Blue curve - template sensor filtering only positive values of grid activity (ie grig import), in W
Green curve - integral of power of blue curve, in kWh
Because consecutive 0 values of grid import (blue curve) are ignored, this creates an incorrectly large area under the blue curve from the first 0 reading to the next non zero value if the next value is large.
The reason for the consecutive 0 values is because during the day, when the sun shines, most of the time the grid import is 0 W.
Thus, the resulting integral is also incorrectly large, when in fact i should only be the area under the positive values of the yellow curve.
And for the energy dash board, this results in incorrect calculations of energy usage.
Is there a way to force the recording of consecutive same values, particularly of consecutive 0 values.
Or is this something to be reported as future fix?