From cce3913587e6fe47a5bda561827eeac2a6f5d866 Mon Sep 17 00:00:00 2001 From: LiShuzhen Date: Mon, 6 Jan 2025 11:46:10 +0800 Subject: [PATCH] fix: fan level property --- custom_components/xiaomi_home/fan.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/custom_components/xiaomi_home/fan.py b/custom_components/xiaomi_home/fan.py index 4789f4d..0ca2bcd 100644 --- a/custom_components/xiaomi_home/fan.py +++ b/custom_components/xiaomi_home/fan.py @@ -135,7 +135,13 @@ class Fan(MIoTServiceEntity, FanEntity): )/self._speed_step+1 self._attr_supported_features |= FanEntityFeature.SET_SPEED self._prop_fan_level = prop - elif isinstance(prop.value_list, list) and prop.value_list: + elif ( + self._prop_fan_level is None + # Fan level with value-range is prior to fan level with value-list + # when a fan has both fan level properties. + and isinstance(prop.value_list, list) + and prop.value_list + ): # Fan level with value-list self._speed_name_map = {item['value']: item['description'] for item in prop.value_list}