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