mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 14:27:07 +00:00
Remove entity description mixin in Devolo Home Network (#112399)
* Remove entity description mixin in Devolo Home Network * Fix
This commit is contained in:
parent
32bb33c55e
commit
9a24e97ecb
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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](
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user