mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 04:37:06 +00:00
Remove Reolink entity descriptions required fields mixins (#104006)
This commit is contained in:
parent
880483624b
commit
2d36225405
@ -28,22 +28,14 @@ from .const import DOMAIN
|
||||
from .entity import ReolinkChannelCoordinatorEntity
|
||||
|
||||
|
||||
@dataclass
|
||||
class ReolinkBinarySensorEntityDescriptionMixin:
|
||||
"""Mixin values for Reolink binary sensor entities."""
|
||||
|
||||
value: Callable[[Host, int], bool]
|
||||
|
||||
|
||||
@dataclass
|
||||
class ReolinkBinarySensorEntityDescription(
|
||||
BinarySensorEntityDescription, ReolinkBinarySensorEntityDescriptionMixin
|
||||
):
|
||||
@dataclass(kw_only=True)
|
||||
class ReolinkBinarySensorEntityDescription(BinarySensorEntityDescription):
|
||||
"""A class that describes binary sensor entities."""
|
||||
|
||||
icon: str = "mdi:motion-sensor"
|
||||
icon_off: str = "mdi:motion-sensor-off"
|
||||
icon: str = "mdi:motion-sensor"
|
||||
supported: Callable[[Host, int], bool] = lambda host, ch: True
|
||||
value: Callable[[Host, int], bool]
|
||||
|
||||
|
||||
BINARY_SENSORS = (
|
||||
|
@ -22,36 +22,22 @@ from .const import DOMAIN
|
||||
from .entity import ReolinkChannelCoordinatorEntity, ReolinkHostCoordinatorEntity
|
||||
|
||||
|
||||
@dataclass
|
||||
class ReolinkButtonEntityDescriptionMixin:
|
||||
"""Mixin values for Reolink button entities for a camera channel."""
|
||||
|
||||
method: Callable[[Host, int], Any]
|
||||
|
||||
|
||||
@dataclass
|
||||
@dataclass(kw_only=True)
|
||||
class ReolinkButtonEntityDescription(
|
||||
ButtonEntityDescription, ReolinkButtonEntityDescriptionMixin
|
||||
ButtonEntityDescription,
|
||||
):
|
||||
"""A class that describes button entities for a camera channel."""
|
||||
|
||||
supported: Callable[[Host, int], bool] = lambda api, ch: True
|
||||
enabled_default: Callable[[Host, int], bool] | None = None
|
||||
method: Callable[[Host, int], Any]
|
||||
supported: Callable[[Host, int], bool] = lambda api, ch: True
|
||||
|
||||
|
||||
@dataclass
|
||||
class ReolinkHostButtonEntityDescriptionMixin:
|
||||
"""Mixin values for Reolink button entities for the host."""
|
||||
|
||||
method: Callable[[Host], Any]
|
||||
|
||||
|
||||
@dataclass
|
||||
class ReolinkHostButtonEntityDescription(
|
||||
ButtonEntityDescription, ReolinkHostButtonEntityDescriptionMixin
|
||||
):
|
||||
@dataclass(kw_only=True)
|
||||
class ReolinkHostButtonEntityDescription(ButtonEntityDescription):
|
||||
"""A class that describes button entities for the host."""
|
||||
|
||||
method: Callable[[Host], Any]
|
||||
supported: Callable[[Host], bool] = lambda api: True
|
||||
|
||||
|
||||
|
@ -23,23 +23,15 @@ from .const import DOMAIN
|
||||
from .entity import ReolinkChannelCoordinatorEntity
|
||||
|
||||
|
||||
@dataclass
|
||||
class ReolinkLightEntityDescriptionMixin:
|
||||
"""Mixin values for Reolink light entities."""
|
||||
|
||||
is_on_fn: Callable[[Host, int], bool]
|
||||
turn_on_off_fn: Callable[[Host, int, bool], Any]
|
||||
|
||||
|
||||
@dataclass
|
||||
class ReolinkLightEntityDescription(
|
||||
LightEntityDescription, ReolinkLightEntityDescriptionMixin
|
||||
):
|
||||
@dataclass(kw_only=True)
|
||||
class ReolinkLightEntityDescription(LightEntityDescription):
|
||||
"""A class that describes light entities."""
|
||||
|
||||
supported_fn: Callable[[Host, int], bool] = lambda api, ch: True
|
||||
get_brightness_fn: Callable[[Host, int], int | None] | None = None
|
||||
is_on_fn: Callable[[Host, int], bool]
|
||||
set_brightness_fn: Callable[[Host, int, int], Any] | None = None
|
||||
supported_fn: Callable[[Host, int], bool] = lambda api, ch: True
|
||||
turn_on_off_fn: Callable[[Host, int, bool], Any]
|
||||
|
||||
|
||||
LIGHT_ENTITIES = (
|
||||
|
@ -22,24 +22,16 @@ from .const import DOMAIN
|
||||
from .entity import ReolinkChannelCoordinatorEntity
|
||||
|
||||
|
||||
@dataclass
|
||||
class ReolinkNumberEntityDescriptionMixin:
|
||||
"""Mixin values for Reolink number entities."""
|
||||
|
||||
value: Callable[[Host, int], float | None]
|
||||
method: Callable[[Host, int, float], Any]
|
||||
|
||||
|
||||
@dataclass
|
||||
class ReolinkNumberEntityDescription(
|
||||
NumberEntityDescription, ReolinkNumberEntityDescriptionMixin
|
||||
):
|
||||
@dataclass(kw_only=True)
|
||||
class ReolinkNumberEntityDescription(NumberEntityDescription):
|
||||
"""A class that describes number entities."""
|
||||
|
||||
get_max_value: Callable[[Host, int], float] | None = None
|
||||
get_min_value: Callable[[Host, int], float] | None = None
|
||||
method: Callable[[Host, int, float], Any]
|
||||
mode: NumberMode = NumberMode.AUTO
|
||||
supported: Callable[[Host, int], bool] = lambda api, ch: True
|
||||
get_min_value: Callable[[Host, int], float] | None = None
|
||||
get_max_value: Callable[[Host, int], float] | None = None
|
||||
value: Callable[[Host, int], float | None]
|
||||
|
||||
|
||||
NUMBER_ENTITIES = (
|
||||
|
@ -27,20 +27,12 @@ from .entity import ReolinkChannelCoordinatorEntity
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@dataclass
|
||||
class ReolinkSelectEntityDescriptionMixin:
|
||||
"""Mixin values for Reolink select entities."""
|
||||
|
||||
method: Callable[[Host, int, str], Any]
|
||||
get_options: list[str] | Callable[[Host, int], list[str]]
|
||||
|
||||
|
||||
@dataclass
|
||||
class ReolinkSelectEntityDescription(
|
||||
SelectEntityDescription, ReolinkSelectEntityDescriptionMixin
|
||||
):
|
||||
@dataclass(kw_only=True)
|
||||
class ReolinkSelectEntityDescription(SelectEntityDescription):
|
||||
"""A class that describes select entities."""
|
||||
|
||||
get_options: list[str] | Callable[[Host, int], list[str]]
|
||||
method: Callable[[Host, int, str], Any]
|
||||
supported: Callable[[Host, int], bool] = lambda api, ch: True
|
||||
value: Callable[[Host, int], str] | None = None
|
||||
|
||||
|
@ -24,20 +24,12 @@ from .const import DOMAIN
|
||||
from .entity import ReolinkChannelCoordinatorEntity, ReolinkHostCoordinatorEntity
|
||||
|
||||
|
||||
@dataclass
|
||||
class ReolinkSensorEntityDescriptionMixin:
|
||||
"""Mixin values for Reolink sensor entities for a camera channel."""
|
||||
|
||||
value: Callable[[Host, int], int]
|
||||
|
||||
|
||||
@dataclass
|
||||
class ReolinkSensorEntityDescription(
|
||||
SensorEntityDescription, ReolinkSensorEntityDescriptionMixin
|
||||
):
|
||||
@dataclass(kw_only=True)
|
||||
class ReolinkSensorEntityDescription(SensorEntityDescription):
|
||||
"""A class that describes sensor entities for a camera channel."""
|
||||
|
||||
supported: Callable[[Host, int], bool] = lambda api, ch: True
|
||||
value: Callable[[Host, int], int]
|
||||
|
||||
|
||||
@dataclass
|
||||
|
@ -18,38 +18,22 @@ from .const import DOMAIN
|
||||
from .entity import ReolinkChannelCoordinatorEntity, ReolinkHostCoordinatorEntity
|
||||
|
||||
|
||||
@dataclass
|
||||
class ReolinkSwitchEntityDescriptionMixin:
|
||||
"""Mixin values for Reolink switch entities."""
|
||||
|
||||
value: Callable[[Host, int], bool]
|
||||
method: Callable[[Host, int, bool], Any]
|
||||
|
||||
|
||||
@dataclass
|
||||
class ReolinkSwitchEntityDescription(
|
||||
SwitchEntityDescription, ReolinkSwitchEntityDescriptionMixin
|
||||
):
|
||||
@dataclass(kw_only=True)
|
||||
class ReolinkSwitchEntityDescription(SwitchEntityDescription):
|
||||
"""A class that describes switch entities."""
|
||||
|
||||
method: Callable[[Host, int, bool], Any]
|
||||
supported: Callable[[Host, int], bool] = lambda api, ch: True
|
||||
value: Callable[[Host, int], bool]
|
||||
|
||||
|
||||
@dataclass
|
||||
class ReolinkNVRSwitchEntityDescriptionMixin:
|
||||
"""Mixin values for Reolink NVR switch entities."""
|
||||
|
||||
value: Callable[[Host], bool]
|
||||
method: Callable[[Host, bool], Any]
|
||||
|
||||
|
||||
@dataclass
|
||||
class ReolinkNVRSwitchEntityDescription(
|
||||
SwitchEntityDescription, ReolinkNVRSwitchEntityDescriptionMixin
|
||||
):
|
||||
@dataclass(kw_only=True)
|
||||
class ReolinkNVRSwitchEntityDescription(SwitchEntityDescription):
|
||||
"""A class that describes NVR switch entities."""
|
||||
|
||||
method: Callable[[Host, bool], Any]
|
||||
supported: Callable[[Host], bool] = lambda api: True
|
||||
value: Callable[[Host], bool]
|
||||
|
||||
|
||||
SWITCH_ENTITIES = (
|
||||
|
Loading…
x
Reference in New Issue
Block a user