diff --git a/homeassistant/components/devolo_home_network/binary_sensor.py b/homeassistant/components/devolo_home_network/binary_sensor.py index cf8358b69a3..8d7f578651a 100644 --- a/homeassistant/components/devolo_home_network/binary_sensor.py +++ b/homeassistant/components/devolo_home_network/binary_sensor.py @@ -32,20 +32,13 @@ def _is_connected_to_router(entity: DevoloBinarySensorEntity) -> bool: ) -@dataclass(frozen=True) -class DevoloBinarySensorRequiredKeysMixin: - """Mixin for required keys.""" +@dataclass(frozen=True, kw_only=True) +class DevoloBinarySensorEntityDescription(BinarySensorEntityDescription): + """Describes devolo sensor entity.""" value_func: Callable[[DevoloBinarySensorEntity], bool] -@dataclass(frozen=True) -class DevoloBinarySensorEntityDescription( - BinarySensorEntityDescription, DevoloBinarySensorRequiredKeysMixin -): - """Describes devolo sensor entity.""" - - SENSOR_TYPES: dict[str, DevoloBinarySensorEntityDescription] = { CONNECTED_TO_ROUTER: DevoloBinarySensorEntityDescription( key=CONNECTED_TO_ROUTER, diff --git a/homeassistant/components/devolo_home_network/button.py b/homeassistant/components/devolo_home_network/button.py index eba1ad05157..3bcdf6c4610 100644 --- a/homeassistant/components/devolo_home_network/button.py +++ b/homeassistant/components/devolo_home_network/button.py @@ -22,20 +22,13 @@ from .const import DOMAIN, IDENTIFY, PAIRING, RESTART, START_WPS from .entity import DevoloEntity -@dataclass(frozen=True) -class DevoloButtonRequiredKeysMixin: - """Mixin for required keys.""" +@dataclass(frozen=True, kw_only=True) +class DevoloButtonEntityDescription(ButtonEntityDescription): + """Describes devolo button entity.""" press_func: Callable[[Device], Awaitable[bool]] -@dataclass(frozen=True) -class DevoloButtonEntityDescription( - ButtonEntityDescription, DevoloButtonRequiredKeysMixin -): - """Describes devolo button entity.""" - - BUTTON_TYPES: dict[str, DevoloButtonEntityDescription] = { IDENTIFY: DevoloButtonEntityDescription( key=IDENTIFY, diff --git a/homeassistant/components/devolo_home_network/image.py b/homeassistant/components/devolo_home_network/image.py index 72cf4f57c1d..16b89bb1180 100644 --- a/homeassistant/components/devolo_home_network/image.py +++ b/homeassistant/components/devolo_home_network/image.py @@ -21,20 +21,13 @@ from .const import DOMAIN, IMAGE_GUEST_WIFI, SWITCH_GUEST_WIFI from .entity import DevoloCoordinatorEntity -@dataclass(frozen=True) -class DevoloImageRequiredKeysMixin: - """Mixin for required keys.""" +@dataclass(frozen=True, kw_only=True) +class DevoloImageEntityDescription(ImageEntityDescription): + """Describes devolo image entity.""" image_func: Callable[[WifiGuestAccessGet], bytes] -@dataclass(frozen=True) -class DevoloImageEntityDescription( - ImageEntityDescription, DevoloImageRequiredKeysMixin -): - """Describes devolo image entity.""" - - IMAGE_TYPES: dict[str, DevoloImageEntityDescription] = { IMAGE_GUEST_WIFI: DevoloImageEntityDescription( key=IMAGE_GUEST_WIFI, diff --git a/homeassistant/components/devolo_home_network/sensor.py b/homeassistant/components/devolo_home_network/sensor.py index 750bb9ad13d..8a7676ceb26 100644 --- a/homeassistant/components/devolo_home_network/sensor.py +++ b/homeassistant/components/devolo_home_network/sensor.py @@ -49,19 +49,14 @@ class DataRateDirection(StrEnum): TX = "tx_rate" -@dataclass(frozen=True) -class DevoloSensorRequiredKeysMixin(Generic[_CoordinatorDataT]): - """Mixin for required keys.""" - - value_func: Callable[[_CoordinatorDataT], float] - - -@dataclass(frozen=True) +@dataclass(frozen=True, kw_only=True) class DevoloSensorEntityDescription( - SensorEntityDescription, DevoloSensorRequiredKeysMixin[_CoordinatorDataT] + SensorEntityDescription, Generic[_CoordinatorDataT] ): """Describes devolo sensor entity.""" + value_func: Callable[[_CoordinatorDataT], float] + SENSOR_TYPES: dict[str, DevoloSensorEntityDescription[Any]] = { CONNECTED_PLC_DEVICES: DevoloSensorEntityDescription[LogicalNetwork]( diff --git a/homeassistant/components/devolo_home_network/switch.py b/homeassistant/components/devolo_home_network/switch.py index af0569a016f..05169073369 100644 --- a/homeassistant/components/devolo_home_network/switch.py +++ b/homeassistant/components/devolo_home_network/switch.py @@ -23,22 +23,15 @@ from .entity import DevoloCoordinatorEntity _DataT = TypeVar("_DataT", bound=WifiGuestAccessGet | bool) -@dataclass(frozen=True) -class DevoloSwitchRequiredKeysMixin(Generic[_DataT]): - """Mixin for required keys.""" +@dataclass(frozen=True, kw_only=True) +class DevoloSwitchEntityDescription(SwitchEntityDescription, Generic[_DataT]): + """Describes devolo switch entity.""" is_on_func: Callable[[_DataT], bool] turn_on_func: Callable[[Device], Awaitable[bool]] turn_off_func: Callable[[Device], Awaitable[bool]] -@dataclass(frozen=True) -class DevoloSwitchEntityDescription( - SwitchEntityDescription, DevoloSwitchRequiredKeysMixin[_DataT] -): - """Describes devolo switch entity.""" - - SWITCH_TYPES: dict[str, DevoloSwitchEntityDescription[Any]] = { SWITCH_GUEST_WIFI: DevoloSwitchEntityDescription[WifiGuestAccessGet]( key=SWITCH_GUEST_WIFI, diff --git a/homeassistant/components/devolo_home_network/update.py b/homeassistant/components/devolo_home_network/update.py index 03f86381307..88c10b61cfc 100644 --- a/homeassistant/components/devolo_home_network/update.py +++ b/homeassistant/components/devolo_home_network/update.py @@ -26,21 +26,14 @@ from .const import DOMAIN, REGULAR_FIRMWARE from .entity import DevoloCoordinatorEntity -@dataclass(frozen=True) -class DevoloUpdateRequiredKeysMixin: - """Mixin for required keys.""" +@dataclass(frozen=True, kw_only=True) +class DevoloUpdateEntityDescription(UpdateEntityDescription): + """Describes devolo update entity.""" latest_version: Callable[[UpdateFirmwareCheck], str] update_func: Callable[[Device], Awaitable[bool]] -@dataclass(frozen=True) -class DevoloUpdateEntityDescription( - UpdateEntityDescription, DevoloUpdateRequiredKeysMixin -): - """Describes devolo update entity.""" - - UPDATE_TYPES: dict[str, DevoloUpdateEntityDescription] = { REGULAR_FIRMWARE: DevoloUpdateEntityDescription( key=REGULAR_FIRMWARE,