Bugfix 3-5

This commit is contained in:
2026-04-27 15:25:58 +02:00
parent 01d21b3d72
commit d0715e8df2
2 changed files with 20 additions and 3 deletions
@@ -71,6 +71,7 @@ class SternwarteDataUpdateCoordinator(DataUpdateCoordinator[SternwarteState]):
self._pending_open_task: asyncio.Task | None = None
self._pending_close_task: asyncio.Task | None = None
self._roof_was_closed = False
self._last_roof_direction: str | None = None
async def async_config_entry_first_refresh(self) -> None:
"""Load persisted runtime state before first refresh."""
@@ -262,6 +263,7 @@ class SternwarteDataUpdateCoordinator(DataUpdateCoordinator[SternwarteState]):
async with self._command_lock:
self._cancel_pending_open_task()
self._cancel_pending_close_task()
self._last_roof_direction = None
await self.api.set_output(10, True)
await self.api.set_output(9, False)
await self.api.set_output(11, False)
@@ -323,6 +325,7 @@ class SternwarteDataUpdateCoordinator(DataUpdateCoordinator[SternwarteState]):
if state.roof_moving:
raise HomeAssistantError("Dach bewegt sich bereits")
self._last_roof_direction = "opening"
await self.api.set_output(9, True)
await self.api.set_output(10, False)
await self.api.set_output(11, False)
@@ -331,6 +334,10 @@ class SternwarteDataUpdateCoordinator(DataUpdateCoordinator[SternwarteState]):
if not state.roof_power:
raise HomeAssistantError("Dachsteuerung ist ausgeschaltet")
if state.roof_moving:
raise HomeAssistantError("Dach bewegt sich bereits")
self._last_roof_direction = "closing"
await self.api.set_output(11, True)
await self.api.set_output(10, False)
await self.api.set_output(9, False)
@@ -339,7 +346,7 @@ class SternwarteDataUpdateCoordinator(DataUpdateCoordinator[SternwarteState]):
return not state.roof_moving and not state.roof_open and not state.raining
def _can_auto_close(self, state: SternwarteState) -> bool:
return state.roof_power
return state.roof_power and not state.roof_moving and not state.roof_closed
def _is_roof_open(self, state: SternwarteState) -> bool:
return state.roof_open and not state.roof_closed
@@ -42,11 +42,21 @@ class SternwarteRoofCover(SternwarteEntity, CoverEntity):
@property
def is_opening(self) -> bool:
return self.coordinator.data.roof_moving and not self.coordinator.data.roof_open
if not self.coordinator.data.roof_moving or self.coordinator.data.roof_open:
return False
direction = self.coordinator._last_roof_direction
if direction is not None:
return direction == "opening"
return not self.coordinator.data.roof_closed
@property
def is_closing(self) -> bool:
return self.coordinator.data.roof_moving and not self.coordinator.data.roof_closed
if not self.coordinator.data.roof_moving or self.coordinator.data.roof_closed:
return False
direction = self.coordinator._last_roof_direction
if direction is not None:
return direction == "closing"
return not self.coordinator.data.roof_open
@property
def current_cover_position(self) -> int | None: