fix: add FanEntityFeature.TURN_OFF/ON to fans
This commit is contained in:
@@ -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
|
||||||
|
Reference in New Issue
Block a user