Remove entity description mixin in Melnor (#112906)

pull/108781/head
Joost Lekkerkerker 2024-03-11 12:05:55 +01:00 committed by GitHub
parent 14e7e4c860
commit 62817ba338
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 15 additions and 50 deletions

View File

@ -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,

View File

@ -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] = [

View File

@ -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,

View File

@ -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,