Use EntityFeature enum in components (m**) (#69414)
* Use EntityFeature in melcloud * Use EntityFeature in mystrom * Use EntityFeature in mysensors * Use EntityFeature in myq * Use EntityFeature in mpd * Use EntityFeature in monoprice * Use EntityFeature in moehlenhoff_alpha2 * Use EntityFeature in modern_forms * Use EntityFeature in modbus * Use EntityFeature in melissa * Use EntityFeature in mediaroom * Use EntityFeature in maxcube * Use EntityFeature in manual_mqtt * Fix maxcube tests * Revert "Use EntityFeature in modbus" This reverts commit56cf9d900d
. * Revert "Use EntityFeature in myq" This reverts commit44a31b1a03
. * Revert "Use EntityFeature in mystrom" This reverts commit7260ee0384
. * Revert "Revert "Use EntityFeature in modbus"" This reverts commit916a612a60
. * Revert "Revert "Use EntityFeature in myq"" This reverts commita6be42fa17
.
This commit is contained in:
parent
8e090a8c04
commit
5e2cc2b9b0
15 changed files with 109 additions and 160 deletions
|
@ -6,7 +6,7 @@ from typing import Any
|
|||
from aiomodernforms.const import FAN_POWER_OFF, FAN_POWER_ON
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.fan import SUPPORT_DIRECTION, SUPPORT_SET_SPEED, FanEntity
|
||||
from homeassistant.components.fan import FanEntity, FanEntityFeature
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_platform
|
||||
|
@ -72,6 +72,8 @@ class ModernFormsFanEntity(FanEntity, ModernFormsDeviceEntity):
|
|||
|
||||
SPEED_RANGE = (1, 6) # off is not included
|
||||
|
||||
_attr_supported_features = FanEntityFeature.DIRECTION | FanEntityFeature.SET_SPEED
|
||||
|
||||
def __init__(
|
||||
self, entry_id: str, coordinator: ModernFormsDataUpdateCoordinator
|
||||
) -> None:
|
||||
|
@ -83,11 +85,6 @@ class ModernFormsFanEntity(FanEntity, ModernFormsDeviceEntity):
|
|||
)
|
||||
self._attr_unique_id = f"{self.coordinator.data.info.mac_address}"
|
||||
|
||||
@property
|
||||
def supported_features(self) -> int:
|
||||
"""Flag supported features."""
|
||||
return SUPPORT_DIRECTION | SUPPORT_SET_SPEED
|
||||
|
||||
@property
|
||||
def percentage(self) -> int | None:
|
||||
"""Return the current speed percentage."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue