Use EntityFeature enum in esphome (#69386)
This commit is contained in:
parent
78045df227
commit
dae2cf2827
5 changed files with 26 additions and 35 deletions
|
@ -9,10 +9,8 @@ from aioesphomeapi import FanDirection, FanInfo, FanSpeed, FanState
|
|||
from homeassistant.components.fan import (
|
||||
DIRECTION_FORWARD,
|
||||
DIRECTION_REVERSE,
|
||||
SUPPORT_DIRECTION,
|
||||
SUPPORT_OSCILLATE,
|
||||
SUPPORT_SET_SPEED,
|
||||
FanEntity,
|
||||
FanEntityFeature,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
@ -161,9 +159,9 @@ class EsphomeFan(EsphomeEntity[FanInfo, FanState], FanEntity):
|
|||
"""Flag supported features."""
|
||||
flags = 0
|
||||
if self._static_info.supports_oscillation:
|
||||
flags |= SUPPORT_OSCILLATE
|
||||
flags |= FanEntityFeature.OSCILLATE
|
||||
if self._static_info.supports_speed:
|
||||
flags |= SUPPORT_SET_SPEED
|
||||
flags |= FanEntityFeature.SET_SPEED
|
||||
if self._static_info.supports_direction:
|
||||
flags |= SUPPORT_DIRECTION
|
||||
flags |= FanEntityFeature.DIRECTION
|
||||
return flags
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue