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

@ -15,9 +15,15 @@ PRESET_MODE_SLEEP = "sleep"
PRESET_MODE_ON = "on"
FULL_SUPPORT = (
FanEntityFeature.SET_SPEED | FanEntityFeature.OSCILLATE | FanEntityFeature.DIRECTION
FanEntityFeature.SET_SPEED
| FanEntityFeature.OSCILLATE
| FanEntityFeature.DIRECTION
| FanEntityFeature.TURN_OFF
| FanEntityFeature.TURN_ON
)
LIMITED_SUPPORT = (
FanEntityFeature.SET_SPEED | FanEntityFeature.TURN_OFF | FanEntityFeature.TURN_ON
)
LIMITED_SUPPORT = FanEntityFeature.SET_SPEED
async def async_setup_entry(
@ -75,7 +81,9 @@ async def async_setup_entry(
hass,
"fan5",
"Preset Only Limited Fan",
FanEntityFeature.PRESET_MODE,
FanEntityFeature.PRESET_MODE
| FanEntityFeature.TURN_OFF
| FanEntityFeature.TURN_ON,
[
PRESET_MODE_AUTO,
PRESET_MODE_SMART,
@ -92,6 +100,7 @@ class BaseDemoFan(FanEntity):
_attr_should_poll = False
_attr_translation_key = "demo"
_enable_turn_on_off_backwards_compatibility = False
def __init__(
self,