Add TideForecast and WateringNeeds to TimedTasks

This commit is contained in:
PicelBoi committed 2025-12-15 22:02:14 -05:00
1 parent 89c8c06a35
commit 73166b2670
2 files changed
+26

No files matched your search

+10
View File
@@ -109,6 +109,14 @@ public class Config
"MetroMapCity6",
"MetroMapCity7",
"MetroMapCity8",
"TideStation1",
"TideStation2",
"TideStation3",
"TideStation4",
"TideStation5",
"TideStation6",
"TideStation7",
"TideStation8",
};
}
@@ -141,5 +149,7 @@ public class Config
[XmlElement] public bool Breathing { get; set; } = true;
[XmlElement] public bool HeatingAndCooling { get; set; } = true;
[XmlElement] public bool PollenForecast { get; set; } = true;
[XmlElement] public bool WateringNeeds { get; set; } = true;
[XmlElement] public bool TideForecast { get; set; } = true;
}
}
+16
View File
@@ -175,6 +175,22 @@ public class TimedTasks
sender.SendFile(brsRecord, "storeData(QGROUP=__Breathing__,Feed=Breathing)");
}
if (dataConfig.TideForecast)
{
Log.Info($"Building Tide Forecast I2 record for {locations.Length} locations..");
List<GenericResponse<TideForecastResponse>> tfcst = await new TideForecastProduct().Populate(locations);
string tfcstRecord = await new TideForecastRecord().MakeRecord(tfcst);
sender.SendFile(tfcstRecord, "storeData(QGROUP=__TidesForecast__,Feed=TidesForecast)");
}
if (dataConfig.WateringNeeds)
{
Log.Info($"Building Watering Needs I2 record for {locations.Length} locations..");
List<GenericResponse<WateringNeedsResponse>> wns = await new WateringNeedsProduct().Populate(locations);
string wnsRecord = await new WateringNeedsRecord().MakeRecord(wns);
sender.SendFile(wnsRecord, "storeData(QGROUP=__WateringNeeds__,Feed=WateringNeeds)");
}
string nextTimestamp = DateTime.Now.AddSeconds(generationInterval).ToString("h:mm tt");
watch.Stop();