Remove entity description mixin in Vallox (#112963)

This commit is contained in:
Joost Lekkerkerker 2024-03-11 11:54:00 +01:00 committed by GitHub
parent 39bfb2b5ba
commit b5c5db9ca0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 26 deletions

View File

@ -42,20 +42,13 @@ class ValloxBinarySensorEntity(ValloxEntity, BinarySensorEntity):
return self.coordinator.data.get(self.entity_description.metric_key) == 1
@dataclass(frozen=True)
class ValloxMetricKeyMixin:
"""Dataclass to allow defining metric_key without a default value."""
@dataclass(frozen=True, kw_only=True)
class ValloxBinarySensorEntityDescription(BinarySensorEntityDescription):
"""Describes Vallox binary sensor entity."""
metric_key: str
@dataclass(frozen=True)
class ValloxBinarySensorEntityDescription(
BinarySensorEntityDescription, ValloxMetricKeyMixin
):
"""Describes Vallox binary sensor entity."""
BINARY_SENSOR_ENTITIES: tuple[ValloxBinarySensorEntityDescription, ...] = (
ValloxBinarySensorEntityDescription(
key="post_heater",

View File

@ -59,18 +59,13 @@ class ValloxNumberEntity(ValloxEntity, NumberEntity):
await self.coordinator.async_request_refresh()
@dataclass(frozen=True)
class ValloxMetricMixin:
"""Holds Vallox metric key."""
@dataclass(frozen=True, kw_only=True)
class ValloxNumberEntityDescription(NumberEntityDescription):
"""Describes Vallox number entity."""
metric_key: str
@dataclass(frozen=True)
class ValloxNumberEntityDescription(NumberEntityDescription, ValloxMetricMixin):
"""Describes Vallox number entity."""
NUMBER_ENTITIES: tuple[ValloxNumberEntityDescription, ...] = (
ValloxNumberEntityDescription(
key="supply_air_target_home",

View File

@ -62,18 +62,13 @@ class ValloxSwitchEntity(ValloxEntity, SwitchEntity):
await self.coordinator.async_request_refresh()
@dataclass(frozen=True)
class ValloxMetricKeyMixin:
"""Dataclass to allow defining metric_key without a default value."""
@dataclass(frozen=True, kw_only=True)
class ValloxSwitchEntityDescription(SwitchEntityDescription):
"""Describes Vallox switch entity."""
metric_key: str
@dataclass(frozen=True)
class ValloxSwitchEntityDescription(SwitchEntityDescription, ValloxMetricKeyMixin):
"""Describes Vallox switch entity."""
SWITCH_ENTITIES: tuple[ValloxSwitchEntityDescription, ...] = (
ValloxSwitchEntityDescription(
key="bypass_locked",