Bugfix 458 - SensorWaterMeter reports 0 after send #476
+112
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix to issue #458 and a new example sketch for a watermeter.
With this fix, _value and _total are not reset after sending for sensors with valueprocessing == SUM. Instead, the total is accumulated inifinitely.
As far as I can tell, only SensorPulseMeter uses this valueprocessing, and its decendants SensorPowerMeter and SensorWaterMeter. The fix is tested for WaterMeter and works fine. Not tested for PowerMeter but I expect it to behave nicely there as well as it should more closely resemble how a physical powermeter behaves.
If any (future) sensor needs to summarize only between sends, a new value processing type DELTA can be added that behaves like SUM but is reset in sendValue().
Newbie disclaimer - this is my first pull request :-)