Calculating kWh (using the simple formula given as an example in the forum) and finding drops in the chart, which makes no sense. I have verified that the additive is positive, yet I still see a pattern I cannot explain.
The formula is simple:
return my.value + (power.past(MINUTE,1).average/60);
But the result is unexpectedly jagged:
I expect this is due to the formula looking back too far for the previous (current) value, but I haven't had any luck calculating a better window. As an example, here is some of what I have been attempting:
var prev = my.lastValue(0); var lastVal = (null === prev) ? my.value : prev.value; return lastVal + (power.value/60);
FWIW, the data point is not set to update the context; instead, it's set to update every minute.
Any clarification is greatly appreciated.