Remove entity description mixin in Melnor (#112906)
parent
14e7e4c860
commit
62817ba338
|
@ -26,21 +26,14 @@ from .models import (
|
|||
)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class MelnorZoneNumberEntityDescriptionMixin:
|
||||
"""Mixin for required keys."""
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class MelnorZoneNumberEntityDescription(NumberEntityDescription):
|
||||
"""Describes Melnor number entity."""
|
||||
|
||||
set_num_fn: Callable[[Valve, int], Coroutine[Any, Any, None]]
|
||||
state_fn: Callable[[Valve], Any]
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class MelnorZoneNumberEntityDescription(
|
||||
NumberEntityDescription, MelnorZoneNumberEntityDescriptionMixin
|
||||
):
|
||||
"""Describes Melnor number entity."""
|
||||
|
||||
|
||||
ZONE_ENTITY_DESCRIPTIONS: list[MelnorZoneNumberEntityDescription] = [
|
||||
MelnorZoneNumberEntityDescription(
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
|
|
|
@ -55,32 +55,18 @@ def next_cycle(valve: Valve) -> datetime | None:
|
|||
return None
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class MelnorSensorEntityDescriptionMixin:
|
||||
"""Mixin for required keys."""
|
||||
|
||||
state_fn: Callable[[Device], Any]
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class MelnorZoneSensorEntityDescriptionMixin:
|
||||
"""Mixin for required keys."""
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class MelnorZoneSensorEntityDescription(SensorEntityDescription):
|
||||
"""Describes Melnor sensor entity."""
|
||||
|
||||
state_fn: Callable[[Valve], Any]
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class MelnorZoneSensorEntityDescription(
|
||||
SensorEntityDescription, MelnorZoneSensorEntityDescriptionMixin
|
||||
):
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class MelnorSensorEntityDescription(SensorEntityDescription):
|
||||
"""Describes Melnor sensor entity."""
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class MelnorSensorEntityDescription(
|
||||
SensorEntityDescription, MelnorSensorEntityDescriptionMixin
|
||||
):
|
||||
"""Describes Melnor sensor entity."""
|
||||
state_fn: Callable[[Device], Any]
|
||||
|
||||
|
||||
DEVICE_ENTITY_DESCRIPTIONS: list[MelnorSensorEntityDescription] = [
|
||||
|
|
|
@ -25,21 +25,14 @@ from .models import (
|
|||
)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class MelnorSwitchEntityDescriptionMixin:
|
||||
"""Mixin for required keys."""
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class MelnorSwitchEntityDescription(SwitchEntityDescription):
|
||||
"""Describes Melnor switch entity."""
|
||||
|
||||
on_off_fn: Callable[[Valve, bool], Coroutine[Any, Any, None]]
|
||||
state_fn: Callable[[Valve], Any]
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class MelnorSwitchEntityDescription(
|
||||
SwitchEntityDescription, MelnorSwitchEntityDescriptionMixin
|
||||
):
|
||||
"""Describes Melnor switch entity."""
|
||||
|
||||
|
||||
ZONE_ENTITY_DESCRIPTIONS = [
|
||||
MelnorSwitchEntityDescription(
|
||||
device_class=SwitchDeviceClass.SWITCH,
|
||||
|
|
|
@ -23,21 +23,14 @@ from .models import (
|
|||
)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class MelnorZoneTimeEntityDescriptionMixin:
|
||||
"""Mixin for required keys."""
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class MelnorZoneTimeEntityDescription(TimeEntityDescription):
|
||||
"""Describes Melnor number entity."""
|
||||
|
||||
set_time_fn: Callable[[Valve, time], Coroutine[Any, Any, None]]
|
||||
state_fn: Callable[[Valve], Any]
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class MelnorZoneTimeEntityDescription(
|
||||
TimeEntityDescription, MelnorZoneTimeEntityDescriptionMixin
|
||||
):
|
||||
"""Describes Melnor number entity."""
|
||||
|
||||
|
||||
ZONE_ENTITY_DESCRIPTIONS: list[MelnorZoneTimeEntityDescription] = [
|
||||
MelnorZoneTimeEntityDescription(
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
|
|
Loading…
Reference in New Issue