Öffnen wird verhindert, wenn es mehr als 6 Stunden abgelaufen ist
This commit is contained in:
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -17,6 +17,7 @@ DEFAULT_PASSWORD = "sowo2009"
|
||||
|
||||
UPDATE_INTERVAL_SECONDS = 1
|
||||
POWER_ON_DELAY_SECONDS = 30
|
||||
OPEN_SCHEDULE_MAX_AGE_SECONDS = 6 * 60 * 60
|
||||
WIND_INTERVAL_SECONDS = 30
|
||||
WIND_COUNTER_INDEX = 4
|
||||
WIND_FACTOR = (2 / 3) * 3.6
|
||||
|
||||
@@ -23,6 +23,7 @@ from .const import (
|
||||
CONF_PASSWORD,
|
||||
CONF_PORT,
|
||||
DEFAULT_NAME,
|
||||
OPEN_SCHEDULE_MAX_AGE_SECONDS,
|
||||
POWER_ON_DELAY_SECONDS,
|
||||
ROOF_COUNTER_CLOSE_INDEX,
|
||||
ROOF_COUNTER_OPEN_INDEX,
|
||||
@@ -586,6 +587,24 @@ class SternwarteDataUpdateCoordinator(DataUpdateCoordinator[SternwarteState]):
|
||||
changed = True
|
||||
|
||||
open_power_on_at = self._schedule_datetime(self.schedule.open_power_on_at)
|
||||
open_at = self._schedule_datetime(self.schedule.open_at)
|
||||
if (
|
||||
open_at is not None
|
||||
and not self.schedule.open_done
|
||||
and now - open_at > timedelta(seconds=OPEN_SCHEDULE_MAX_AGE_SECONDS)
|
||||
):
|
||||
LOGGER.warning(
|
||||
"Veraltete Öffnungsplanung verworfen: open_at=%s now=%s",
|
||||
open_at.isoformat(),
|
||||
now.isoformat(),
|
||||
)
|
||||
self.schedule.open_at = ""
|
||||
self.schedule.open_done = True
|
||||
self.schedule.open_power_on_at = ""
|
||||
changed = True
|
||||
open_power_on_at = None
|
||||
open_at = None
|
||||
|
||||
if open_power_on_at is not None and not self.schedule.open_done and now >= open_power_on_at:
|
||||
if self._is_roof_open(state):
|
||||
LOGGER.info("Automatisches Öffnen bereits erfüllt")
|
||||
@@ -645,7 +664,6 @@ class SternwarteDataUpdateCoordinator(DataUpdateCoordinator[SternwarteState]):
|
||||
)
|
||||
changed = True
|
||||
|
||||
open_at = self._schedule_datetime(self.schedule.open_at)
|
||||
if open_at is not None and not self.schedule.open_done and now >= open_at and not self.schedule.open_power_on_at:
|
||||
if self._is_roof_open(state):
|
||||
LOGGER.info("Automatisches Öffnen übersprungen, Dach ist bereits offen")
|
||||
|
||||
Reference in New Issue
Block a user