Remove entity description mixin in Trafikverket Camera (#112954)

This commit is contained in:
Joost Lekkerkerker 2024-03-10 18:16:18 +01:00 committed by GitHub
parent a64f043a93
commit 5f4881cb28
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 20 deletions

View File

@ -20,20 +20,13 @@ from .entity import TrafikverketCameraNonCameraEntity
PARALLEL_UPDATES = 0 PARALLEL_UPDATES = 0
@dataclass(frozen=True) @dataclass(frozen=True, kw_only=True)
class DeviceBaseEntityDescriptionMixin: class TVCameraSensorEntityDescription(BinarySensorEntityDescription):
"""Mixin for required Trafikverket Camera base description keys.""" """Describes Trafikverket Camera binary sensor entity."""
value_fn: Callable[[CameraData], bool | None] value_fn: Callable[[CameraData], bool | None]
@dataclass(frozen=True)
class TVCameraSensorEntityDescription(
BinarySensorEntityDescription, DeviceBaseEntityDescriptionMixin
):
"""Describes Trafikverket Camera binary sensor entity."""
BINARY_SENSOR_TYPE = TVCameraSensorEntityDescription( BINARY_SENSOR_TYPE = TVCameraSensorEntityDescription(
key="active", key="active",
translation_key="active", translation_key="active",

View File

@ -24,20 +24,13 @@ from .entity import TrafikverketCameraNonCameraEntity
PARALLEL_UPDATES = 0 PARALLEL_UPDATES = 0
@dataclass(frozen=True) @dataclass(frozen=True, kw_only=True)
class DeviceBaseEntityDescriptionMixin: class TVCameraSensorEntityDescription(SensorEntityDescription):
"""Mixin for required Trafikverket Camera base description keys.""" """Describes Trafikverket Camera sensor entity."""
value_fn: Callable[[CameraData], StateType | datetime] value_fn: Callable[[CameraData], StateType | datetime]
@dataclass(frozen=True)
class TVCameraSensorEntityDescription(
SensorEntityDescription, DeviceBaseEntityDescriptionMixin
):
"""Describes Trafikverket Camera sensor entity."""
SENSOR_TYPES: tuple[TVCameraSensorEntityDescription, ...] = ( SENSOR_TYPES: tuple[TVCameraSensorEntityDescription, ...] = (
TVCameraSensorEntityDescription( TVCameraSensorEntityDescription(
key="direction", key="direction",