mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 22:27:07 +00:00
Remove entity description mixin in SFR Box (#112937)
This commit is contained in:
parent
f668dfecb2
commit
ae003c21c8
@ -27,20 +27,13 @@ from .models import DomainData
|
|||||||
_T = TypeVar("_T")
|
_T = TypeVar("_T")
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(frozen=True, kw_only=True)
|
||||||
class SFRBoxBinarySensorMixin(Generic[_T]):
|
class SFRBoxBinarySensorEntityDescription(BinarySensorEntityDescription, Generic[_T]):
|
||||||
"""Mixin for SFR Box sensors."""
|
"""Description for SFR Box binary sensors."""
|
||||||
|
|
||||||
value_fn: Callable[[_T], bool | None]
|
value_fn: Callable[[_T], bool | None]
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
|
||||||
class SFRBoxBinarySensorEntityDescription(
|
|
||||||
BinarySensorEntityDescription, SFRBoxBinarySensorMixin[_T]
|
|
||||||
):
|
|
||||||
"""Description for SFR Box binary sensors."""
|
|
||||||
|
|
||||||
|
|
||||||
DSL_SENSOR_TYPES: tuple[SFRBoxBinarySensorEntityDescription[DslInfo], ...] = (
|
DSL_SENSOR_TYPES: tuple[SFRBoxBinarySensorEntityDescription[DslInfo], ...] = (
|
||||||
SFRBoxBinarySensorEntityDescription[DslInfo](
|
SFRBoxBinarySensorEntityDescription[DslInfo](
|
||||||
key="status",
|
key="status",
|
||||||
|
@ -50,18 +50,13 @@ def with_error_wrapping(
|
|||||||
return wrapper
|
return wrapper
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(frozen=True, kw_only=True)
|
||||||
class SFRBoxButtonMixin:
|
class SFRBoxButtonEntityDescription(ButtonEntityDescription):
|
||||||
"""Mixin for SFR Box buttons."""
|
"""Description for SFR Box buttons."""
|
||||||
|
|
||||||
async_press: Callable[[SFRBox], Coroutine[None, None, None]]
|
async_press: Callable[[SFRBox], Coroutine[None, None, None]]
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
|
||||||
class SFRBoxButtonEntityDescription(ButtonEntityDescription, SFRBoxButtonMixin):
|
|
||||||
"""Description for SFR Box buttons."""
|
|
||||||
|
|
||||||
|
|
||||||
BUTTON_TYPES: tuple[SFRBoxButtonEntityDescription, ...] = (
|
BUTTON_TYPES: tuple[SFRBoxButtonEntityDescription, ...] = (
|
||||||
SFRBoxButtonEntityDescription(
|
SFRBoxButtonEntityDescription(
|
||||||
async_press=lambda x: x.system_reboot(),
|
async_press=lambda x: x.system_reboot(),
|
||||||
|
@ -33,18 +33,13 @@ from .models import DomainData
|
|||||||
_T = TypeVar("_T")
|
_T = TypeVar("_T")
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(frozen=True, kw_only=True)
|
||||||
class SFRBoxSensorMixin(Generic[_T]):
|
class SFRBoxSensorEntityDescription(SensorEntityDescription, Generic[_T]):
|
||||||
"""Mixin for SFR Box sensors."""
|
"""Description for SFR Box sensors."""
|
||||||
|
|
||||||
value_fn: Callable[[_T], StateType]
|
value_fn: Callable[[_T], StateType]
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
|
||||||
class SFRBoxSensorEntityDescription(SensorEntityDescription, SFRBoxSensorMixin[_T]):
|
|
||||||
"""Description for SFR Box sensors."""
|
|
||||||
|
|
||||||
|
|
||||||
DSL_SENSOR_TYPES: tuple[SFRBoxSensorEntityDescription[DslInfo], ...] = (
|
DSL_SENSOR_TYPES: tuple[SFRBoxSensorEntityDescription[DslInfo], ...] = (
|
||||||
SFRBoxSensorEntityDescription[DslInfo](
|
SFRBoxSensorEntityDescription[DslInfo](
|
||||||
key="linemode",
|
key="linemode",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user