Remove AdGuard entity descriptions required fields mixins (#103991)
This commit is contained in:
parent
f24212b66e
commit
d1e460e97a
2 changed files with 6 additions and 20 deletions
|
@ -22,20 +22,13 @@ SCAN_INTERVAL = timedelta(seconds=300)
|
||||||
PARALLEL_UPDATES = 4
|
PARALLEL_UPDATES = 4
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(kw_only=True)
|
||||||
class AdGuardHomeEntityDescriptionMixin:
|
class AdGuardHomeEntityDescription(SensorEntityDescription):
|
||||||
"""Mixin for required keys."""
|
"""Describes AdGuard Home sensor entity."""
|
||||||
|
|
||||||
value_fn: Callable[[AdGuardHome], Coroutine[Any, Any, int | float]]
|
value_fn: Callable[[AdGuardHome], Coroutine[Any, Any, int | float]]
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class AdGuardHomeEntityDescription(
|
|
||||||
SensorEntityDescription, AdGuardHomeEntityDescriptionMixin
|
|
||||||
):
|
|
||||||
"""Describes AdGuard Home sensor entity."""
|
|
||||||
|
|
||||||
|
|
||||||
SENSORS: tuple[AdGuardHomeEntityDescription, ...] = (
|
SENSORS: tuple[AdGuardHomeEntityDescription, ...] = (
|
||||||
AdGuardHomeEntityDescription(
|
AdGuardHomeEntityDescription(
|
||||||
key="dns_queries",
|
key="dns_queries",
|
||||||
|
|
|
@ -21,22 +21,15 @@ SCAN_INTERVAL = timedelta(seconds=10)
|
||||||
PARALLEL_UPDATES = 1
|
PARALLEL_UPDATES = 1
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(kw_only=True)
|
||||||
class AdGuardHomeSwitchEntityDescriptionMixin:
|
class AdGuardHomeSwitchEntityDescription(SwitchEntityDescription):
|
||||||
"""Mixin for required keys."""
|
"""Describes AdGuard Home switch entity."""
|
||||||
|
|
||||||
is_on_fn: Callable[[AdGuardHome], Callable[[], Coroutine[Any, Any, bool]]]
|
is_on_fn: Callable[[AdGuardHome], Callable[[], Coroutine[Any, Any, bool]]]
|
||||||
turn_on_fn: Callable[[AdGuardHome], Callable[[], Coroutine[Any, Any, None]]]
|
turn_on_fn: Callable[[AdGuardHome], Callable[[], Coroutine[Any, Any, None]]]
|
||||||
turn_off_fn: Callable[[AdGuardHome], Callable[[], Coroutine[Any, Any, None]]]
|
turn_off_fn: Callable[[AdGuardHome], Callable[[], Coroutine[Any, Any, None]]]
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class AdGuardHomeSwitchEntityDescription(
|
|
||||||
SwitchEntityDescription, AdGuardHomeSwitchEntityDescriptionMixin
|
|
||||||
):
|
|
||||||
"""Describes AdGuard Home switch entity."""
|
|
||||||
|
|
||||||
|
|
||||||
SWITCHES: tuple[AdGuardHomeSwitchEntityDescription, ...] = (
|
SWITCHES: tuple[AdGuardHomeSwitchEntityDescription, ...] = (
|
||||||
AdGuardHomeSwitchEntityDescription(
|
AdGuardHomeSwitchEntityDescription(
|
||||||
key="protection",
|
key="protection",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue