Remove entity description mixin in Screenlogic (#112935)
* Remove entity description mixin in Screenlogic * Fix
This commit is contained in:
parent
5e530fc42e
commit
70f3da93d4
7 changed files with 18 additions and 39 deletions
|
@ -33,14 +33,14 @@ from .util import cleanup_excluded_entity
|
|||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
@dataclasses.dataclass(frozen=True, kw_only=True)
|
||||
class ScreenLogicBinarySensorDescription(
|
||||
BinarySensorEntityDescription, ScreenLogicEntityDescription
|
||||
):
|
||||
"""A class that describes ScreenLogic binary sensor eneites."""
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
@dataclasses.dataclass(frozen=True, kw_only=True)
|
||||
class ScreenLogicPushBinarySensorDescription(
|
||||
ScreenLogicBinarySensorDescription, ScreenLogicPushEntityDescription
|
||||
):
|
||||
|
|
|
@ -69,7 +69,7 @@ async def async_setup_entry(
|
|||
async_add_entities(entities)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class ScreenLogicClimateDescription(
|
||||
ClimateEntityDescription, ScreenLogicPushEntityDescription
|
||||
):
|
||||
|
|
|
@ -29,19 +29,11 @@ from .util import generate_unique_id
|
|||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class ScreenLogicEntityRequiredKeyMixin:
|
||||
"""Mixin for required ScreenLogic entity data_path."""
|
||||
|
||||
data_root: ScreenLogicDataPath
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class ScreenLogicEntityDescription(
|
||||
EntityDescription, ScreenLogicEntityRequiredKeyMixin
|
||||
):
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class ScreenLogicEntityDescription(EntityDescription):
|
||||
"""Base class for a ScreenLogic entity description."""
|
||||
|
||||
data_root: ScreenLogicDataPath
|
||||
enabled_lambda: Callable[..., bool] | None = None
|
||||
|
||||
|
||||
|
@ -104,21 +96,13 @@ class ScreenLogicEntity(CoordinatorEntity[ScreenlogicDataUpdateCoordinator]):
|
|||
raise HomeAssistantError(f"Data not found: {self._data_path}") from ke
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class ScreenLogicPushEntityRequiredKeyMixin:
|
||||
"""Mixin for required key for ScreenLogic push entities."""
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class ScreenLogicPushEntityDescription(ScreenLogicEntityDescription):
|
||||
"""Base class for a ScreenLogic push entity description."""
|
||||
|
||||
subscription_code: CODE
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class ScreenLogicPushEntityDescription(
|
||||
ScreenLogicEntityDescription,
|
||||
ScreenLogicPushEntityRequiredKeyMixin,
|
||||
):
|
||||
"""Base class for a ScreenLogic push entity description."""
|
||||
|
||||
|
||||
class ScreenLogicPushEntity(ScreenLogicEntity):
|
||||
"""Base class for all ScreenLogic push entities."""
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ async def async_setup_entry(
|
|||
async_add_entities(entities)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class ScreenLogicLightDescription(
|
||||
LightEntityDescription, ScreenLogicPushEntityDescription
|
||||
):
|
||||
|
|
|
@ -28,7 +28,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||
PARALLEL_UPDATES = 1
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class ScreenLogicNumberDescription(
|
||||
NumberEntityDescription,
|
||||
ScreenLogicEntityDescription,
|
||||
|
|
|
@ -36,21 +36,16 @@ from .util import cleanup_excluded_entity, get_ha_unit
|
|||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class ScreenLogicSensorMixin:
|
||||
"""Mixin for SecreenLogic sensor entity."""
|
||||
@dataclasses.dataclass(frozen=True, kw_only=True)
|
||||
class ScreenLogicSensorDescription(
|
||||
SensorEntityDescription, ScreenLogicEntityDescription
|
||||
):
|
||||
"""Describes a ScreenLogic sensor."""
|
||||
|
||||
value_mod: Callable[[int | str], int | str] | None = None
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class ScreenLogicSensorDescription(
|
||||
ScreenLogicSensorMixin, SensorEntityDescription, ScreenLogicEntityDescription
|
||||
):
|
||||
"""Describes a ScreenLogic sensor."""
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
@dataclasses.dataclass(frozen=True, kw_only=True)
|
||||
class ScreenLogicPushSensorDescription(
|
||||
ScreenLogicSensorDescription, ScreenLogicPushEntityDescription
|
||||
):
|
||||
|
|
|
@ -23,7 +23,7 @@ from .entity import (
|
|||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class ScreenLogicCircuitSwitchDescription(
|
||||
SwitchEntityDescription, ScreenLogicPushEntityDescription
|
||||
):
|
||||
|
|
Loading…
Add table
Reference in a new issue