mirror of
https://github.com/home-assistant/core.git
synced 2025-07-26 06:37:52 +00:00
Fix error if cover position is not available or unknown (#147732)
This commit is contained in:
parent
39abae36f0
commit
134967b817
@ -53,6 +53,8 @@ class WebControlProCover(WebControlProGenericEntity, CoverEntity):
|
|||||||
def current_cover_position(self) -> int | None:
|
def current_cover_position(self) -> int | None:
|
||||||
"""Return current position of cover."""
|
"""Return current position of cover."""
|
||||||
action = self._dest.action(self._drive_action_desc)
|
action = self._dest.action(self._drive_action_desc)
|
||||||
|
if action is None or action["percentage"] is None:
|
||||||
|
return None
|
||||||
return 100 - action["percentage"]
|
return 100 - action["percentage"]
|
||||||
|
|
||||||
async def async_set_cover_position(self, **kwargs: Any) -> None:
|
async def async_set_cover_position(self, **kwargs: Any) -> None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user