mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +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
|
from .entity import ReolinkChannelCoordinatorEntity
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(kw_only=True)
|
||||||
class ReolinkBinarySensorEntityDescriptionMixin:
|
class ReolinkBinarySensorEntityDescription(BinarySensorEntityDescription):
|
||||||
"""Mixin values for Reolink binary sensor entities."""
|
|
||||||
|
|
||||||
value: Callable[[Host, int], bool]
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class ReolinkBinarySensorEntityDescription(
|
|
||||||
BinarySensorEntityDescription, ReolinkBinarySensorEntityDescriptionMixin
|
|
||||||
):
|
|
||||||
"""A class that describes binary sensor entities."""
|
"""A class that describes binary sensor entities."""
|
||||||
|
|
||||||
icon: str = "mdi:motion-sensor"
|
|
||||||
icon_off: str = "mdi:motion-sensor-off"
|
icon_off: str = "mdi:motion-sensor-off"
|
||||||
|
icon: str = "mdi:motion-sensor"
|
||||||
supported: Callable[[Host, int], bool] = lambda host, ch: True
|
supported: Callable[[Host, int], bool] = lambda host, ch: True
|
||||||
|
value: Callable[[Host, int], bool]
|
||||||
|
|
||||||
|
|
||||||
BINARY_SENSORS = (
|
BINARY_SENSORS = (
|
||||||
|
@ -22,36 +22,22 @@ from .const import DOMAIN
|
|||||||
from .entity import ReolinkChannelCoordinatorEntity, ReolinkHostCoordinatorEntity
|
from .entity import ReolinkChannelCoordinatorEntity, ReolinkHostCoordinatorEntity
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(kw_only=True)
|
||||||
class ReolinkButtonEntityDescriptionMixin:
|
|
||||||
"""Mixin values for Reolink button entities for a camera channel."""
|
|
||||||
|
|
||||||
method: Callable[[Host, int], Any]
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class ReolinkButtonEntityDescription(
|
class ReolinkButtonEntityDescription(
|
||||||
ButtonEntityDescription, ReolinkButtonEntityDescriptionMixin
|
ButtonEntityDescription,
|
||||||
):
|
):
|
||||||
"""A class that describes button entities for a camera channel."""
|
"""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
|
enabled_default: Callable[[Host, int], bool] | None = None
|
||||||
|
method: Callable[[Host, int], Any]
|
||||||
|
supported: Callable[[Host, int], bool] = lambda api, ch: True
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(kw_only=True)
|
||||||
class ReolinkHostButtonEntityDescriptionMixin:
|
class ReolinkHostButtonEntityDescription(ButtonEntityDescription):
|
||||||
"""Mixin values for Reolink button entities for the host."""
|
|
||||||
|
|
||||||
method: Callable[[Host], Any]
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class ReolinkHostButtonEntityDescription(
|
|
||||||
ButtonEntityDescription, ReolinkHostButtonEntityDescriptionMixin
|
|
||||||
):
|
|
||||||
"""A class that describes button entities for the host."""
|
"""A class that describes button entities for the host."""
|
||||||
|
|
||||||
|
method: Callable[[Host], Any]
|
||||||
supported: Callable[[Host], bool] = lambda api: True
|
supported: Callable[[Host], bool] = lambda api: True
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,23 +23,15 @@ from .const import DOMAIN
|
|||||||
from .entity import ReolinkChannelCoordinatorEntity
|
from .entity import ReolinkChannelCoordinatorEntity
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(kw_only=True)
|
||||||
class ReolinkLightEntityDescriptionMixin:
|
class ReolinkLightEntityDescription(LightEntityDescription):
|
||||||
"""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
|
|
||||||
):
|
|
||||||
"""A class that describes light entities."""
|
"""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
|
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
|
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 = (
|
LIGHT_ENTITIES = (
|
||||||
|
@ -22,24 +22,16 @@ from .const import DOMAIN
|
|||||||
from .entity import ReolinkChannelCoordinatorEntity
|
from .entity import ReolinkChannelCoordinatorEntity
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(kw_only=True)
|
||||||
class ReolinkNumberEntityDescriptionMixin:
|
class ReolinkNumberEntityDescription(NumberEntityDescription):
|
||||||
"""Mixin values for Reolink number entities."""
|
|
||||||
|
|
||||||
value: Callable[[Host, int], float | None]
|
|
||||||
method: Callable[[Host, int, float], Any]
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class ReolinkNumberEntityDescription(
|
|
||||||
NumberEntityDescription, ReolinkNumberEntityDescriptionMixin
|
|
||||||
):
|
|
||||||
"""A class that describes number entities."""
|
"""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
|
mode: NumberMode = NumberMode.AUTO
|
||||||
supported: Callable[[Host, int], bool] = lambda api, ch: True
|
supported: Callable[[Host, int], bool] = lambda api, ch: True
|
||||||
get_min_value: Callable[[Host, int], float] | None = None
|
value: Callable[[Host, int], float | None]
|
||||||
get_max_value: Callable[[Host, int], float] | None = None
|
|
||||||
|
|
||||||
|
|
||||||
NUMBER_ENTITIES = (
|
NUMBER_ENTITIES = (
|
||||||
|
@ -27,20 +27,12 @@ from .entity import ReolinkChannelCoordinatorEntity
|
|||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(kw_only=True)
|
||||||
class ReolinkSelectEntityDescriptionMixin:
|
class ReolinkSelectEntityDescription(SelectEntityDescription):
|
||||||
"""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
|
|
||||||
):
|
|
||||||
"""A class that describes select entities."""
|
"""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
|
supported: Callable[[Host, int], bool] = lambda api, ch: True
|
||||||
value: Callable[[Host, int], str] | None = None
|
value: Callable[[Host, int], str] | None = None
|
||||||
|
|
||||||
|
@ -24,20 +24,12 @@ from .const import DOMAIN
|
|||||||
from .entity import ReolinkChannelCoordinatorEntity, ReolinkHostCoordinatorEntity
|
from .entity import ReolinkChannelCoordinatorEntity, ReolinkHostCoordinatorEntity
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(kw_only=True)
|
||||||
class ReolinkSensorEntityDescriptionMixin:
|
class ReolinkSensorEntityDescription(SensorEntityDescription):
|
||||||
"""Mixin values for Reolink sensor entities for a camera channel."""
|
|
||||||
|
|
||||||
value: Callable[[Host, int], int]
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class ReolinkSensorEntityDescription(
|
|
||||||
SensorEntityDescription, ReolinkSensorEntityDescriptionMixin
|
|
||||||
):
|
|
||||||
"""A class that describes sensor entities for a camera channel."""
|
"""A class that describes sensor entities for a camera channel."""
|
||||||
|
|
||||||
supported: Callable[[Host, int], bool] = lambda api, ch: True
|
supported: Callable[[Host, int], bool] = lambda api, ch: True
|
||||||
|
value: Callable[[Host, int], int]
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
@ -18,38 +18,22 @@ from .const import DOMAIN
|
|||||||
from .entity import ReolinkChannelCoordinatorEntity, ReolinkHostCoordinatorEntity
|
from .entity import ReolinkChannelCoordinatorEntity, ReolinkHostCoordinatorEntity
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(kw_only=True)
|
||||||
class ReolinkSwitchEntityDescriptionMixin:
|
class ReolinkSwitchEntityDescription(SwitchEntityDescription):
|
||||||
"""Mixin values for Reolink switch entities."""
|
|
||||||
|
|
||||||
value: Callable[[Host, int], bool]
|
|
||||||
method: Callable[[Host, int, bool], Any]
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class ReolinkSwitchEntityDescription(
|
|
||||||
SwitchEntityDescription, ReolinkSwitchEntityDescriptionMixin
|
|
||||||
):
|
|
||||||
"""A class that describes switch entities."""
|
"""A class that describes switch entities."""
|
||||||
|
|
||||||
|
method: Callable[[Host, int, bool], Any]
|
||||||
supported: Callable[[Host, int], bool] = lambda api, ch: True
|
supported: Callable[[Host, int], bool] = lambda api, ch: True
|
||||||
|
value: Callable[[Host, int], bool]
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(kw_only=True)
|
||||||
class ReolinkNVRSwitchEntityDescriptionMixin:
|
class ReolinkNVRSwitchEntityDescription(SwitchEntityDescription):
|
||||||
"""Mixin values for Reolink NVR switch entities."""
|
|
||||||
|
|
||||||
value: Callable[[Host], bool]
|
|
||||||
method: Callable[[Host, bool], Any]
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class ReolinkNVRSwitchEntityDescription(
|
|
||||||
SwitchEntityDescription, ReolinkNVRSwitchEntityDescriptionMixin
|
|
||||||
):
|
|
||||||
"""A class that describes NVR switch entities."""
|
"""A class that describes NVR switch entities."""
|
||||||
|
|
||||||
|
method: Callable[[Host, bool], Any]
|
||||||
supported: Callable[[Host], bool] = lambda api: True
|
supported: Callable[[Host], bool] = lambda api: True
|
||||||
|
value: Callable[[Host], bool]
|
||||||
|
|
||||||
|
|
||||||
SWITCH_ENTITIES = (
|
SWITCH_ENTITIES = (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user