From 293690e3d82f65da2e520fbab2b08bfd70fccb4a Mon Sep 17 00:00:00 2001 From: Tom Matheussen Date: Thu, 8 Jul 2021 15:05:43 +0200 Subject: [PATCH] Fix KNX Fan features (#52732) * Fan entity should return support features * Revert "Fan entity should return support features" This reverts commit 3ad0e87708fbf1847aaa26e3bc76fcac365a1640. * Restore supported_features for KNX fan --- homeassistant/components/knx/fan.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/knx/fan.py b/homeassistant/components/knx/fan.py index f787795e1e8..21ede700fdd 100644 --- a/homeassistant/components/knx/fan.py +++ b/homeassistant/components/knx/fan.py @@ -66,9 +66,6 @@ class KNXFan(KnxEntity, FanEntity): # FanSpeedMode.STEP if max_step is set self._step_range: tuple[int, int] | None = (1, max_step) if max_step else None - self._attr_supported_features = SUPPORT_SET_SPEED - if self._device.supports_oscillation: - self._attr_supported_features |= SUPPORT_OSCILLATE self._attr_unique_id = str(self._device.speed.group_address) async def async_set_percentage(self, percentage: int) -> None: @@ -79,6 +76,16 @@ class KNXFan(KnxEntity, FanEntity): else: await self._device.set_speed(percentage) + @property + def supported_features(self) -> int: + """Flag supported features.""" + flags = SUPPORT_SET_SPEED + + if self._device.supports_oscillation: + flags |= SUPPORT_OSCILLATE + + return flags + @property def percentage(self) -> int | None: """Return the current speed as a percentage."""