28
28
PRESET_MODES_TO_NAME ,
29
29
SPEED_OFF ,
30
30
SPEED_RANGE ,
31
- SUPPORT_SET_SPEED ,
32
31
FanEntityFeature ,
33
32
)
34
33
from zha .application .platforms .fan .helpers import (
@@ -65,7 +64,7 @@ class FanEntityInfo(BaseEntityInfo):
65
64
"""Fan entity info."""
66
65
67
66
preset_modes : list [str ]
68
- supported_features : int
67
+ supported_features : FanEntityFeature
69
68
speed_count : int
70
69
speed_list : list [str ]
71
70
@@ -75,7 +74,11 @@ class BaseFan(BaseEntity):
75
74
76
75
PLATFORM = Platform .FAN
77
76
78
- _attr_supported_features = FanEntityFeature .SET_SPEED
77
+ _attr_supported_features : FanEntityFeature = (
78
+ FanEntityFeature .SET_SPEED
79
+ | FanEntityFeature .TURN_OFF
80
+ | FanEntityFeature .TURN_ON
81
+ )
79
82
_attr_translation_key : str = "fan"
80
83
81
84
@functools .cached_property
@@ -109,9 +112,9 @@ def speed_count(self) -> int:
109
112
return int_states_in_range (self .speed_range )
110
113
111
114
@functools .cached_property
112
- def supported_features (self ) -> int :
115
+ def supported_features (self ) -> FanEntityFeature :
113
116
"""Flag supported features."""
114
- return SUPPORT_SET_SPEED
117
+ return self . _attr_supported_features
115
118
116
119
@property
117
120
def is_on (self ) -> bool :
@@ -440,7 +443,12 @@ def default_on_percentage(self) -> int:
440
443
class KofFan (Fan ):
441
444
"""Representation of a fan made by King Of Fans."""
442
445
443
- _attr_supported_features = FanEntityFeature .SET_SPEED | FanEntityFeature .PRESET_MODE
446
+ _attr_supported_features = (
447
+ FanEntityFeature .SET_SPEED
448
+ | FanEntityFeature .PRESET_MODE
449
+ | FanEntityFeature .TURN_OFF
450
+ | FanEntityFeature .TURN_ON
451
+ )
444
452
445
453
@functools .cached_property
446
454
def speed_range (self ) -> tuple [int , int ]:
0 commit comments