Skip to content

Commit

Permalink
fix: improve handling of fan percentage to better match blueair in ap…
Browse files Browse the repository at this point in the history
…p values, improvement provided by rainwoodman
  • Loading branch information
dahlb committed Dec 5, 2024
1 parent fbddc71 commit db332f3
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions custom_components/ha_blueair/fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,7 @@ def is_on(self) -> int:
@property
def percentage(self) -> int:
"""Return the current speed percentage."""
current_speed = int(round(self._device.fan_speed / self._device.speed_count * 100))
if current_speed == 51:
current_speed = 50
return current_speed
return int((self._device.fan_speed * 100) // self._device.speed_count)

async def async_set_percentage(self, percentage: int) -> None:
await self._device.set_fan_speed(int(round(percentage / 100 * self._device.speed_count)))
Expand Down

0 comments on commit db332f3

Please sign in to comment.