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