From 71be56e1fd7bd7626347f6918e26e75b5ae43bd0 Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Tue, 5 Mar 2024 21:51:12 +0100 Subject: [PATCH] Remove entity description mixin in Android IP Webcam (#112380) --- .../components/android_ip_webcam/sensor.py | 14 +++----------- .../components/android_ip_webcam/switch.py | 13 +++---------- 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/homeassistant/components/android_ip_webcam/sensor.py b/homeassistant/components/android_ip_webcam/sensor.py index e55112b7259..bd057bac7c7 100644 --- a/homeassistant/components/android_ip_webcam/sensor.py +++ b/homeassistant/components/android_ip_webcam/sensor.py @@ -23,19 +23,11 @@ from .coordinator import AndroidIPCamDataUpdateCoordinator from .entity import AndroidIPCamBaseEntity -@dataclass(frozen=True) -class AndroidIPWebcamSensorEntityDescriptionMixin: - """Mixin for required keys.""" - - value_fn: Callable[[PyDroidIPCam], StateType] - - -@dataclass(frozen=True) -class AndroidIPWebcamSensorEntityDescription( - SensorEntityDescription, AndroidIPWebcamSensorEntityDescriptionMixin -): +@dataclass(frozen=True, kw_only=True) +class AndroidIPWebcamSensorEntityDescription(SensorEntityDescription): """Entity description class for Android IP Webcam sensors.""" + value_fn: Callable[[PyDroidIPCam], StateType] unit_fn: Callable[[PyDroidIPCam], str | None] = lambda _: None diff --git a/homeassistant/components/android_ip_webcam/switch.py b/homeassistant/components/android_ip_webcam/switch.py index d2a40cb619a..d3edd4a0439 100644 --- a/homeassistant/components/android_ip_webcam/switch.py +++ b/homeassistant/components/android_ip_webcam/switch.py @@ -18,21 +18,14 @@ from .coordinator import AndroidIPCamDataUpdateCoordinator from .entity import AndroidIPCamBaseEntity -@dataclass(frozen=True) -class AndroidIPWebcamSwitchEntityDescriptionMixin: - """Mixin for required keys.""" +@dataclass(frozen=True, kw_only=True) +class AndroidIPWebcamSwitchEntityDescription(SwitchEntityDescription): + """Entity description class for Android IP Webcam switches.""" on_func: Callable[[PyDroidIPCam], Coroutine[Any, Any, bool]] off_func: Callable[[PyDroidIPCam], Coroutine[Any, Any, bool]] -@dataclass(frozen=True) -class AndroidIPWebcamSwitchEntityDescription( - SwitchEntityDescription, AndroidIPWebcamSwitchEntityDescriptionMixin -): - """Entity description class for Android IP Webcam switches.""" - - SWITCH_TYPES: tuple[AndroidIPWebcamSwitchEntityDescription, ...] = ( AndroidIPWebcamSwitchEntityDescription( key="exposure_lock",