mirror of
https://github.com/home-assistant/core.git
synced 2025-07-26 06:37:52 +00:00
Introduce Reolink base entity description (#126050)
This commit is contained in:
parent
02f6d4bd11
commit
a17dc3cb52
@ -19,26 +19,30 @@ from .const import DOMAIN
|
|||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True, kw_only=True)
|
@dataclass(frozen=True, kw_only=True)
|
||||||
class ReolinkChannelEntityDescription(EntityDescription):
|
class ReolinkEntityDescription(EntityDescription):
|
||||||
"""A class that describes entities for a camera channel."""
|
"""A class that describes entities for Reolink."""
|
||||||
|
|
||||||
cmd_key: str | None = None
|
cmd_key: str | None = None
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass(frozen=True, kw_only=True)
|
||||||
|
class ReolinkChannelEntityDescription(ReolinkEntityDescription):
|
||||||
|
"""A class that describes entities for a camera channel."""
|
||||||
|
|
||||||
supported: Callable[[Host, int], bool] = lambda api, ch: True
|
supported: Callable[[Host, int], bool] = lambda api, ch: True
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True, kw_only=True)
|
@dataclass(frozen=True, kw_only=True)
|
||||||
class ReolinkHostEntityDescription(EntityDescription):
|
class ReolinkHostEntityDescription(ReolinkEntityDescription):
|
||||||
"""A class that describes host entities."""
|
"""A class that describes host entities."""
|
||||||
|
|
||||||
cmd_key: str | None = None
|
|
||||||
supported: Callable[[Host], bool] = lambda api: True
|
supported: Callable[[Host], bool] = lambda api: True
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True, kw_only=True)
|
@dataclass(frozen=True, kw_only=True)
|
||||||
class ReolinkChimeEntityDescription(EntityDescription):
|
class ReolinkChimeEntityDescription(ReolinkEntityDescription):
|
||||||
"""A class that describes entities for a chime."""
|
"""A class that describes entities for a chime."""
|
||||||
|
|
||||||
cmd_key: str | None = None
|
|
||||||
supported: Callable[[Chime], bool] = lambda chime: True
|
supported: Callable[[Chime], bool] = lambda chime: True
|
||||||
|
|
||||||
|
|
||||||
@ -50,11 +54,7 @@ class ReolinkHostCoordinatorEntity(CoordinatorEntity[DataUpdateCoordinator[None]
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
_attr_has_entity_name = True
|
_attr_has_entity_name = True
|
||||||
entity_description: (
|
entity_description: ReolinkEntityDescription
|
||||||
ReolinkHostEntityDescription
|
|
||||||
| ReolinkChannelEntityDescription
|
|
||||||
| ReolinkChimeEntityDescription
|
|
||||||
)
|
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
@ -114,8 +114,6 @@ class ReolinkHostCoordinatorEntity(CoordinatorEntity[DataUpdateCoordinator[None]
|
|||||||
class ReolinkChannelCoordinatorEntity(ReolinkHostCoordinatorEntity):
|
class ReolinkChannelCoordinatorEntity(ReolinkHostCoordinatorEntity):
|
||||||
"""Parent class for Reolink hardware camera entities connected to a channel of the NVR."""
|
"""Parent class for Reolink hardware camera entities connected to a channel of the NVR."""
|
||||||
|
|
||||||
entity_description: ReolinkChannelEntityDescription | ReolinkChimeEntityDescription
|
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
reolink_data: ReolinkData,
|
reolink_data: ReolinkData,
|
||||||
@ -176,8 +174,6 @@ class ReolinkChannelCoordinatorEntity(ReolinkHostCoordinatorEntity):
|
|||||||
class ReolinkChimeCoordinatorEntity(ReolinkChannelCoordinatorEntity):
|
class ReolinkChimeCoordinatorEntity(ReolinkChannelCoordinatorEntity):
|
||||||
"""Parent class for Reolink chime entities connected."""
|
"""Parent class for Reolink chime entities connected."""
|
||||||
|
|
||||||
entity_description: ReolinkChimeEntityDescription
|
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
reolink_data: ReolinkData,
|
reolink_data: ReolinkData,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user