Skip to content

Commit

Permalink
Fix ZHA wrong cover states (#98933)
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeB-GitHub committed Mar 1, 2024
1 parent 0d0b64d commit 993c4ed
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions homeassistant/components/zha/cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,14 @@ async def async_open_cover_tilt(self, **kwargs: Any) -> None:
raise HomeAssistantError(f"Failed to open cover tilt: {res[1]}")
self.async_update_state(STATE_OPENING)

async def async_open_cover_tilt(self, **kwargs: Any) -> None:
"""Open the cover tilt."""
# 0 is open in ZCL
res = await self._cover_cluster_handler.go_to_tilt_percentage(0)
if res[1] is not Status.SUCCESS:
raise HomeAssistantError(f"Failed to open cover tilt: {res[1]}")
self.async_update_state(STATE_OPENING)

async def async_close_cover(self, **kwargs: Any) -> None:
"""Close the cover."""
res = await self._cover_cluster_handler.down_close()
Expand All @@ -297,6 +305,14 @@ async def async_close_cover_tilt(self, **kwargs: Any) -> None:
raise HomeAssistantError(f"Failed to close cover tilt: {res[1]}")
self.async_update_state(STATE_CLOSING)

async def async_close_cover_tilt(self, **kwargs: Any) -> None:
"""Close the cover tilt."""
# 100 is closed in ZCL
res = await self._cover_cluster_handler.go_to_tilt_percentage(100)
if res[1] is not Status.SUCCESS:
raise HomeAssistantError(f"Failed to close cover tilt: {res[1]}")
self.async_update_state(STATE_CLOSING)

async def async_set_cover_position(self, **kwargs: Any) -> None:
"""Move the cover to a specific position."""
self._target_lift_position = kwargs[ATTR_POSITION]
Expand Down

0 comments on commit 993c4ed

Please sign in to comment.