Fix error if cover position is not available or unknown (#147732)

This commit is contained in:
Marc Hörsken 2025-06-28 21:57:26 +02:00 committed by GitHub
parent 39abae36f0
commit 134967b817
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -53,6 +53,8 @@ class WebControlProCover(WebControlProGenericEntity, CoverEntity):
def current_cover_position(self) -> int | None:
"""Return current position of cover."""
action = self._dest.action(self._drive_action_desc)
if action is None or action["percentage"] is None:
return None
return 100 - action["percentage"]
async def async_set_cover_position(self, **kwargs: Any) -> None: