From db332f372957afe581a59cab398a42c23ad0d56f Mon Sep 17 00:00:00 2001 From: Brendan Dahl Date: Wed, 4 Dec 2024 19:52:05 -0500 Subject: [PATCH] fix: improve handling of fan percentage to better match blueair in app values, improvement provided by rainwoodman --- custom_components/ha_blueair/fan.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/custom_components/ha_blueair/fan.py b/custom_components/ha_blueair/fan.py index 3b953da..369545d 100644 --- a/custom_components/ha_blueair/fan.py +++ b/custom_components/ha_blueair/fan.py @@ -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)))