Quick/simple question, I hope.
I have a data point which is a lifetime kWh counter. It does not reset to 0 or run backwards. It is an energy meter and I wish to record the total kWh consumed per day, updating every hour or so.
I would like to create a meta data point which, when updated, shows the 'daily progress' of that counter.
In other words, I want to subtract the latest reading from the first reading today (or last one yesterday).
If I use this method:
return p214.value - p214.ago(DAY);
Then I get the consumption over the last 24 hours, which is not what I want.
(Bonus second question - once the daily delta is calculated, only one record needs to be retained for that day - the last one. What would be the best way to accomplish that?)