Remove entity description mixin in Ecoforest (#112409)
parent
362a10e82e
commit
dd3c11f179
|
@ -16,20 +16,13 @@ from .coordinator import EcoforestCoordinator
|
|||
from .entity import EcoforestEntity
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class EcoforestRequiredKeysMixin:
|
||||
"""Mixin for required keys."""
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class EcoforestNumberEntityDescription(NumberEntityDescription):
|
||||
"""Describes an ecoforest number entity."""
|
||||
|
||||
value_fn: Callable[[Device], float | None]
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class EcoforestNumberEntityDescription(
|
||||
NumberEntityDescription, EcoforestRequiredKeysMixin
|
||||
):
|
||||
"""Describes an ecoforest number entity."""
|
||||
|
||||
|
||||
NUMBER_ENTITIES = (
|
||||
EcoforestNumberEntityDescription(
|
||||
key="power_level",
|
||||
|
|
|
@ -33,20 +33,13 @@ STATUS_TYPE = [s.value for s in State]
|
|||
ALARM_TYPE = [a.value for a in Alarm] + ["none"]
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class EcoforestRequiredKeysMixin:
|
||||
"""Mixin for required keys."""
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class EcoforestSensorEntityDescription(SensorEntityDescription):
|
||||
"""Describes Ecoforest sensor entity."""
|
||||
|
||||
value_fn: Callable[[Device], StateType]
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class EcoforestSensorEntityDescription(
|
||||
SensorEntityDescription, EcoforestRequiredKeysMixin
|
||||
):
|
||||
"""Describes Ecoforest sensor entity."""
|
||||
|
||||
|
||||
SENSOR_TYPES: tuple[EcoforestSensorEntityDescription, ...] = (
|
||||
EcoforestSensorEntityDescription(
|
||||
key="temperature",
|
||||
|
|
|
@ -17,21 +17,14 @@ from .coordinator import EcoforestCoordinator
|
|||
from .entity import EcoforestEntity
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class EcoforestSwitchRequiredKeysMixin:
|
||||
"""Mixin for required keys."""
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class EcoforestSwitchEntityDescription(SwitchEntityDescription):
|
||||
"""Describes an Ecoforest switch entity."""
|
||||
|
||||
value_fn: Callable[[Device], bool]
|
||||
switch_fn: Callable[[EcoforestApi, bool], Awaitable[Device]]
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class EcoforestSwitchEntityDescription(
|
||||
SwitchEntityDescription, EcoforestSwitchRequiredKeysMixin
|
||||
):
|
||||
"""Describes an Ecoforest switch entity."""
|
||||
|
||||
|
||||
SWITCH_TYPES: tuple[EcoforestSwitchEntityDescription, ...] = (
|
||||
EcoforestSwitchEntityDescription(
|
||||
key="status",
|
||||
|
|
Loading…
Reference in New Issue