r900: decode leak, fraud, and backflow status flags #27
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.
TL;DR - this patch decodes the unknown2 and unknown4 fields into leak,
fraud, and backflow status information.
Pretty output now shows:
NoUse:$BIN BackFlow:$FLAG ... Leak:$BIN LeakNow:$FLAG
Where BackFlow is 0, 1, or 2 for no, low, or high backflow in past 35d;
LeakNow is 0, 1, or 2 for no, low, or high leak in the past 24h;
NoUse and Leak is a number from 0 through 6 representing the number of
days in the past 35 days for which either no use or a leak has occurred,
according to this table:
bucket days
0 0
1 1-2
2 3-7
3 8-14
4 15-21
5 22-34
6 35+
I sorted this out using public documentation such as
https://www.neptunetg.com/About/Case-Studies/Water/Westbank-Irrigation-District,-BC
which indicates that the utility can gather stats on days of no use and
days of leak in the past 35 days, and that it is divided into buckets as
shown in the table above.
Using this public information, intentionally triggering the leak flag in
my home, and listening to many meters over time led me to this decoding
of the unknown2 and unknown4 fields.
The 8 unknown2 bits seem to show days of no use and backflow information,
like this (? is still unknown, but this patch lumps it in with the bucket
number):
???BBBHL
BBB: bucket # for days of no use in past 35 days
H: high backflow in past 35 days
L: low backflow in past 35 days
Backflow seems to require some minimum frequency of occurrence before it
will set the flag.
Similarly, the 6 unknown4 bits look like this:
?BBBHL
BBB: bucket # for days of leak in past 35 days
H: continuous leak in past 24 hours
L: intermittent leak in past 24 hours
Intermittent leaks are described by Neptune in other public docs as:
"Intermittent leak indicates that water has been used for at
least 50 of the 96 15-minute intervals during a 24-hour period"
and a continuous leak indicates use in every 15-minute period over
the past 24h.