suggestion: explain counterToday in documentation
Posted: Wednesday 07 September 2022 9:55
I suggest to add to the documentation the exact functioning of the counterToday value of GAS and COUNTER devices. Typically counter devices are updated incrementally, so the total counter value constantly increases over time. The counterToday value is expected to show the increase during the day.
I already found in previous discussions that counterToday cannot be found in the database but it is a computed variable. It was suggested that it is computed as currentvalue minus value at 00:00 hours, but this seems to be only part of the truth. From this statement one might expect the counterToday is automatically reset at 00:00 and then starts to be computed from that moment on, but ....
From my testing: counterToday continues to show the value of the previous day until the first update of the relevant device in the new day. Only then it is reset and the initial value is the newly added value (so indeed currentvalue minus value at 00:00).
Advantage:
* one can make calculations using previous day total even after 00:00 as long as the device is not updated.
Disadvantage:
* if you expect a reset at 00:00 and therefore initial value is 0, then this is not the case. The initial value will be the value of the first update (which might be zero after all if you force an update with 0 increase immediately at 00:00), but until the update it will show the total increase of the previous day.
Am I correct in this analysis?
I already found in previous discussions that counterToday cannot be found in the database but it is a computed variable. It was suggested that it is computed as currentvalue minus value at 00:00 hours, but this seems to be only part of the truth. From this statement one might expect the counterToday is automatically reset at 00:00 and then starts to be computed from that moment on, but ....
From my testing: counterToday continues to show the value of the previous day until the first update of the relevant device in the new day. Only then it is reset and the initial value is the newly added value (so indeed currentvalue minus value at 00:00).
Advantage:
* one can make calculations using previous day total even after 00:00 as long as the device is not updated.
Disadvantage:
* if you expect a reset at 00:00 and therefore initial value is 0, then this is not the case. The initial value will be the value of the first update (which might be zero after all if you force an update with 0 increase immediately at 00:00), but until the update it will show the total increase of the previous day.
Am I correct in this analysis?