fix: add FanEntityFeature.TURN_OFF/ON to fans

This commit is contained in:
dim145
2025-01-04 12:10:52 +01:00
committed by rospogrigio
parent 42b6eb1fc1
commit b01861d53e

View File

@@ -9,7 +9,8 @@ from homeassistant.components.fan import (
DIRECTION_FORWARD, DIRECTION_FORWARD,
DIRECTION_REVERSE, DIRECTION_REVERSE,
DOMAIN, DOMAIN,
FanEntity, FanEntityFeature, FanEntityFeature,
FanEntity,
) )
from homeassistant.util.percentage import ( from homeassistant.util.percentage import (
int_states_in_range, int_states_in_range,
@@ -186,9 +187,9 @@ class LocaltuyaFan(LocalTuyaEntity, FanEntity):
self.schedule_update_ha_state() self.schedule_update_ha_state()
@property @property
def supported_features(self) -> int: def supported_features(self) -> FanEntityFeature:
"""Flag supported features.""" """Flag supported features."""
features = 0 features = FanEntityFeature(0)
if self.has_config(CONF_FAN_OSCILLATING_CONTROL): if self.has_config(CONF_FAN_OSCILLATING_CONTROL):
features |= FanEntityFeature.OSCILLATE features |= FanEntityFeature.OSCILLATE
@@ -199,6 +200,9 @@ class LocaltuyaFan(LocalTuyaEntity, FanEntity):
if self.has_config(CONF_FAN_DIRECTION): if self.has_config(CONF_FAN_DIRECTION):
features |= FanEntityFeature.DIRECTION features |= FanEntityFeature.DIRECTION
features |= FanEntityFeature.TURN_OFF
features |= FanEntityFeature.TURN_ON
return features return features
@property @property