Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix 458 - SensorWaterMeter reports 0 after send #476

Open
wants to merge 4 commits into
base: development
Choose a base branch
from

Conversation

fredvik
Copy link

@fredvik fredvik commented Apr 26, 2019

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 :-)

@user2684
Copy link
Contributor

user2684 commented May 5, 2019

Thanks for the contribution first of all :-) Let me tell you how I'm using this SensorWaterMeter here (which is not necessarily the best approach) so to find the best compromise. I have a rain gauge and the sensor is reporting to the controller how much rain we had in the last hour. To do this is reports every hour and then clearing the value is needed since the controller cannot make the diff (again not necessarily the way I'm using it here is the best one). Having said that, I believe both the use cases are valid hence having that DELTA additional type you mentioned is probably the way to go so the user can choose which one to use. What do you think?

@fredvik
Copy link
Author

fredvik commented May 7, 2019

Happy if I can be of any help! I certainly agree that both use cases are valid and relevant. The rain meter seems like a useful fit for reporting DELTA-values and I'm sure there are other counting applications where it could be useful as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants