Skip to content

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pp81381 committed Jan 12, 2024
1 parent 100f43f commit 8b0c93e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions custom_components/nice/cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ async def async_stop_cover(self, **kwargs) -> None:

async def async_set_cover_position(self, **kwargs) -> None:
"""Move to an int position - 0 is closed, 100 is fully open"""
pos: int = (100 - kwargs[ATTR_POSITION]) * 10 # pos of 1000 is fully up
pos: int = kwargs[ATTR_POSITION] * 10 # pos of 1000 is fully up
await self._tt6_cover.send_pos_command(pos)

async def async_set_drop_percent(self, drop_percent_scaled: float) -> None:
"""Move to a percent position (thousandths accuracy) - 100% is fully down"""
pos = round(1000.0 - drop_percent_scaled * 10.0) # pos of 1000 is fully up
pos = round(drop_percent_scaled * 10.0) # pos of 1000 is fully up
await self._tt6_cover.send_pos_command(pos)

async def async_send_simple_command(self, command: str) -> None:
Expand Down Expand Up @@ -118,7 +118,7 @@ async def handle_update(self):
self._attr_is_opening = self._tt6_cover.cover.is_going_up
self._attr_is_closing = self._tt6_cover.cover.is_going_down
self._attr_is_closed = self._tt6_cover.cover.is_fully_down
self._attr_current_cover_position = (1000 - self._tt6_cover.cover.pos) // 10
drop_percent_scaled = (1000 - self._tt6_cover.cover.pos) / 10.0
self._attr_current_cover_position = (self._tt6_cover.cover.pos) // 10
drop_percent_scaled = self._tt6_cover.cover.pos / 10.0
self._attr_extra_state_attributes = {"drop_percent": drop_percent_scaled}
self.async_write_ha_state()

0 comments on commit 8b0c93e

Please sign in to comment.