From 3d3486aba47a56e69d3edf123802bfc182aa50a2 Mon Sep 17 00:00:00 2001 From: msmarks Date: Sat, 11 Jun 2022 02:33:25 +0800 Subject: [PATCH] Update fan.py fix fan stepless_speed control not working --- custom_components/xiaomi_miot_raw/fan.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/custom_components/xiaomi_miot_raw/fan.py b/custom_components/xiaomi_miot_raw/fan.py index 00da7f8..2d51fd9 100644 --- a/custom_components/xiaomi_miot_raw/fan.py +++ b/custom_components/xiaomi_miot_raw/fan.py @@ -148,9 +148,9 @@ def preset_mode(self): """Return the current speed.""" return self._mode - # @property - # def percentage(self): - # return None + @property + def percentage(self): + return self.speed @property def speed_count(self): @@ -226,9 +226,9 @@ async def async_set_direction(self, direction: str) -> None: raise TypeError(f"Your fan does not support {direction}.") await self.set_property_new(self._did_prefix + "motor_control", self._ctrl_params['motor_control'][d]) - # async def async_set_percentage(self, percentage: int) -> None: - # """Set the speed percentage of the fan.""" - # pass + async def async_set_percentage(self, percentage: int) -> None: + """Set the speed percentage of the fan.""" + await self.async_set_speed(percentage) def _handle_platform_specific_attrs(self): super()._handle_platform_specific_attrs()