Remove LaMetric entity descriptions required fields mixins (#104001)
parent
ce1e6ce006
commit
1a079d7c6f
|
@ -19,20 +19,13 @@ from .entity import LaMetricEntity
|
||||||
from .helpers import lametric_exception_handler
|
from .helpers import lametric_exception_handler
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(kw_only=True)
|
||||||
class LaMetricButtonEntityDescriptionMixin:
|
class LaMetricButtonEntityDescription(ButtonEntityDescription):
|
||||||
"""Mixin values for LaMetric entities."""
|
"""Class describing LaMetric button entities."""
|
||||||
|
|
||||||
press_fn: Callable[[LaMetricDevice], Awaitable[Any]]
|
press_fn: Callable[[LaMetricDevice], Awaitable[Any]]
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class LaMetricButtonEntityDescription(
|
|
||||||
ButtonEntityDescription, LaMetricButtonEntityDescriptionMixin
|
|
||||||
):
|
|
||||||
"""Class describing LaMetric button entities."""
|
|
||||||
|
|
||||||
|
|
||||||
BUTTONS = [
|
BUTTONS = [
|
||||||
LaMetricButtonEntityDescription(
|
LaMetricButtonEntityDescription(
|
||||||
key="app_next",
|
key="app_next",
|
||||||
|
|
|
@ -19,21 +19,14 @@ from .entity import LaMetricEntity
|
||||||
from .helpers import lametric_exception_handler
|
from .helpers import lametric_exception_handler
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(kw_only=True)
|
||||||
class LaMetricEntityDescriptionMixin:
|
class LaMetricNumberEntityDescription(NumberEntityDescription):
|
||||||
"""Mixin values for LaMetric entities."""
|
"""Class describing LaMetric number entities."""
|
||||||
|
|
||||||
value_fn: Callable[[Device], int | None]
|
value_fn: Callable[[Device], int | None]
|
||||||
set_value_fn: Callable[[LaMetricDevice, float], Awaitable[Any]]
|
set_value_fn: Callable[[LaMetricDevice, float], Awaitable[Any]]
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class LaMetricNumberEntityDescription(
|
|
||||||
NumberEntityDescription, LaMetricEntityDescriptionMixin
|
|
||||||
):
|
|
||||||
"""Class describing LaMetric number entities."""
|
|
||||||
|
|
||||||
|
|
||||||
NUMBERS = [
|
NUMBERS = [
|
||||||
LaMetricNumberEntityDescription(
|
LaMetricNumberEntityDescription(
|
||||||
key="brightness",
|
key="brightness",
|
||||||
|
|
|
@ -19,21 +19,14 @@ from .entity import LaMetricEntity
|
||||||
from .helpers import lametric_exception_handler
|
from .helpers import lametric_exception_handler
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(kw_only=True)
|
||||||
class LaMetricEntityDescriptionMixin:
|
class LaMetricSelectEntityDescription(SelectEntityDescription):
|
||||||
"""Mixin values for LaMetric entities."""
|
"""Class describing LaMetric select entities."""
|
||||||
|
|
||||||
current_fn: Callable[[Device], str]
|
current_fn: Callable[[Device], str]
|
||||||
select_fn: Callable[[LaMetricDevice, str], Awaitable[Any]]
|
select_fn: Callable[[LaMetricDevice, str], Awaitable[Any]]
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class LaMetricSelectEntityDescription(
|
|
||||||
SelectEntityDescription, LaMetricEntityDescriptionMixin
|
|
||||||
):
|
|
||||||
"""Class describing LaMetric select entities."""
|
|
||||||
|
|
||||||
|
|
||||||
SELECTS = [
|
SELECTS = [
|
||||||
LaMetricSelectEntityDescription(
|
LaMetricSelectEntityDescription(
|
||||||
key="brightness_mode",
|
key="brightness_mode",
|
||||||
|
|
|
@ -21,20 +21,13 @@ from .coordinator import LaMetricDataUpdateCoordinator
|
||||||
from .entity import LaMetricEntity
|
from .entity import LaMetricEntity
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(kw_only=True)
|
||||||
class LaMetricEntityDescriptionMixin:
|
class LaMetricSensorEntityDescription(SensorEntityDescription):
|
||||||
"""Mixin values for LaMetric entities."""
|
"""Class describing LaMetric sensor entities."""
|
||||||
|
|
||||||
value_fn: Callable[[Device], int | None]
|
value_fn: Callable[[Device], int | None]
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class LaMetricSensorEntityDescription(
|
|
||||||
SensorEntityDescription, LaMetricEntityDescriptionMixin
|
|
||||||
):
|
|
||||||
"""Class describing LaMetric sensor entities."""
|
|
||||||
|
|
||||||
|
|
||||||
SENSORS = [
|
SENSORS = [
|
||||||
LaMetricSensorEntityDescription(
|
LaMetricSensorEntityDescription(
|
||||||
key="rssi",
|
key="rssi",
|
||||||
|
|
|
@ -19,21 +19,13 @@ from .entity import LaMetricEntity
|
||||||
from .helpers import lametric_exception_handler
|
from .helpers import lametric_exception_handler
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(kw_only=True)
|
||||||
class LaMetricEntityDescriptionMixin:
|
class LaMetricSwitchEntityDescription(SwitchEntityDescription):
|
||||||
"""Mixin values for LaMetric entities."""
|
|
||||||
|
|
||||||
is_on_fn: Callable[[Device], bool]
|
|
||||||
set_fn: Callable[[LaMetricDevice, bool], Awaitable[Any]]
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class LaMetricSwitchEntityDescription(
|
|
||||||
SwitchEntityDescription, LaMetricEntityDescriptionMixin
|
|
||||||
):
|
|
||||||
"""Class describing LaMetric switch entities."""
|
"""Class describing LaMetric switch entities."""
|
||||||
|
|
||||||
available_fn: Callable[[Device], bool] = lambda device: True
|
available_fn: Callable[[Device], bool] = lambda device: True
|
||||||
|
is_on_fn: Callable[[Device], bool]
|
||||||
|
set_fn: Callable[[LaMetricDevice, bool], Awaitable[Any]]
|
||||||
|
|
||||||
|
|
||||||
SWITCHES = [
|
SWITCHES = [
|
||||||
|
|
Loading…
Reference in New Issue