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
This commit is contained in:
Tom Matheussen 2021-07-08 15:05:43 +02:00 committed by GitHub
parent f069fbdb25
commit 293690e3d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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."""