scheduler: fix runtime reset when date changes

Signed-off-by: Thomas Klaehn <tkl@blackfinn.de>
This commit is contained in:
2025-09-29 11:22:56 +02:00
parent c85d0d1f68
commit 4efce925f0

View File

@@ -124,11 +124,13 @@ func poll_auto_off() {
// check date change // check date change
now := time.Now() now := time.Now()
if now.After(today) { if now.After(today) {
logger.Print("date change detected")
// reset date // reset date
today = time.Date(now.Year(), now.Month(), now.Day(), 23, 59, 59, 0, now.Location()) today = time.Date(now.Year(), now.Month(), now.Day(), 23, 59, 59, 0, now.Location())
for _, od := range app_state_cache.off_devices { devices := apiservice_devices.GetDevices()
for _, d := range devices.Devices {
// reset run times // reset run times
apiservice_state.SetRuntime(od.device.Name, 0) apiservice_state.SetRuntime(d.Name, 0)
} }
} }