Add TURN_OFF/TURN_ON feature flags for fan (#121447)

This commit is contained in:
G Johansson 2024-07-19 11:35:24 +02:00 committed by GitHub
parent 172778053c
commit ca4c617d4b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
58 changed files with 858 additions and 132 deletions

View file

@ -42,6 +42,7 @@ class BaseHomeKitFan(HomeKitEntity, FanEntity):
# This must be set in subclasses to the name of a boolean characteristic
# that controls whether the fan is on or off.
on_characteristic: str
_enable_turn_on_off_backwards_compatibility = False
@callback
def _async_reconfigure(self) -> None:
@ -113,7 +114,7 @@ class BaseHomeKitFan(HomeKitEntity, FanEntity):
@cached_property
def supported_features(self) -> FanEntityFeature:
"""Flag supported features."""
features = FanEntityFeature(0)
features = FanEntityFeature.TURN_OFF | FanEntityFeature.TURN_ON
if self.service.has(CharacteristicsTypes.ROTATION_DIRECTION):
features |= FanEntityFeature.DIRECTION