From d9bb43694f0bba381dce2f5c8b0a2e90de038355 Mon Sep 17 00:00:00 2001 From: Josh Bonfield Date: Wed, 8 Feb 2023 12:23:42 +0000 Subject: [PATCH] feat: keep the regulator using 2 min avg --- pkg/app/manage_zones.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/app/manage_zones.go b/pkg/app/manage_zones.go index bc8d467..5a91765 100644 --- a/pkg/app/manage_zones.go +++ b/pkg/app/manage_zones.go @@ -4,7 +4,6 @@ import ( "log" "time" - "github.com/mewejo/go-watering/pkg/constants" "github.com/mewejo/go-watering/pkg/model" "github.com/mewejo/go-watering/pkg/persistence" ) @@ -67,7 +66,7 @@ func (app *App) regulateZone(zone *model.Zone) error { } if zone.Mode == model.GetDefaultZoneMode() { - averageMoisture, err := persistence.GetAverageReadingForSensorsSince(zone.MoistureSensors, constants.MOISTURE_READINGS_AVERAGE_DURATION) + averageMoisture, err := persistence.GetAverageReadingForSensorsSince(zone.MoistureSensors, 2*time.Minute) if err != nil { return err