From fe92704286128a5ced9b6cac8513ad1da06b7c4c Mon Sep 17 00:00:00 2001 From: Alone Date: Tue, 25 Feb 2025 13:00:02 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20fix=20for=20hass=20v2024.11=20an?= =?UTF-8?q?d=20older?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/xiaomi_miot/climate.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/custom_components/xiaomi_miot/climate.py b/custom_components/xiaomi_miot/climate.py index 202b13f0a..b49232f73 100644 --- a/custom_components/xiaomi_miot/climate.py +++ b/custom_components/xiaomi_miot/climate.py @@ -207,9 +207,10 @@ def on_init(self): self._attr_swing_modes = [SWING_ON, SWING_OFF] self._attr_supported_features |= ClimateEntityFeature.SWING_MODE elif prop.in_list(['horizontal_swing']): - self._conv_swing_h = conv - self._attr_swing_horizontal_modes = [SWING_ON, SWING_OFF] - self._attr_supported_features |= ClimateEntityFeature.SWING_HORIZONTAL_MODE + if hasattr(ClimateEntityFeature, 'SWING_HORIZONTAL_MODE'): # v2024.12 + self._conv_swing_h = conv + self._attr_swing_horizontal_modes = [SWING_ON, SWING_OFF] + self._attr_supported_features |= ClimateEntityFeature.SWING_HORIZONTAL_MODE elif prop.in_list(['target_temperature']): self._conv_target_temp = conv self._attr_min_temp = prop.range_min()