Skip to content

Commit

Permalink
Upper Bounds Check in Acurite Rain Accumulation Calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
leoherzog committed Jan 1, 2025
1 parent c96bf0c commit 159818f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion code.gs
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ function refreshFromAcurite_() {
let timeDiff = (conditions.time - Number(lastRainTime)) / (60 * 60 * 1000); // Convert to hours
let accumDiff = conditions.precipSinceMidnight.in - Number(lastRainReading);

if (timeDiff > 0 && accumDiff >= 0) {
if (timeDiff > 0 && timeDiff < 0.1 && accumDiff >= 0) { // maximum six minutes since last check and accumulation has increased
conditions.precipRate = {
"in": (accumDiff / timeDiff).toFixedNumber(3),
"mm": (accumDiff / timeDiff).inTomm().toFixedNumber(2)
Expand Down

0 comments on commit 159818f

Please sign in to comment.