bellrichm / WeeWX-MQTTSubscribe

A WeeWX service and driver that receives data from MQTT.
GNU General Public License v3.0
52 stars 13 forks source link

Introduce total_wrap_around configuration option #164

Closed nifoc closed 2 years ago

nifoc commented 2 years ago

Allow for the detection of the wrap around of a contains_total field and adjust the new value accordingly.

Before this commit current_total being smaller than previous_total would result in the field being set to None and it would take another packet to actually calculate the difference again. This can result in some data being "lost", because the data right after the wrap around is essentially discarded. Setting the new total_wrap_around option to True will result in current_total being used as the return value right away.

The option is set to False by default, so you have to explicitly opt-in.

Some examples:

nifoc commented 2 years ago

I think the AppVeyor pipeline is failing for unrelated reasons.

bellrichm commented 2 years ago

Agree it is unrelated. I’ll get this merged shortly. Any interest in updating this page with a coming soon? Thanks for the help!

nifoc commented 2 years ago

I don't think I can edit the wiki page. I would've added the following description:

total_wrap_around

To be used in conjunction with contains_total.

Set to true if the incoming cumulative value can wrap around (yearly rain for example). The default is false.

bellrichm commented 2 years ago

Ok. Thanks again.