mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 09:17:53 +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)
|
||||
class ReolinkChannelEntityDescription(EntityDescription):
|
||||
"""A class that describes entities for a camera channel."""
|
||||
class ReolinkEntityDescription(EntityDescription):
|
||||
"""A class that describes entities for Reolink."""
|
||||
|
||||
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
|
||||
|
||||
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class ReolinkHostEntityDescription(EntityDescription):
|
||||
class ReolinkHostEntityDescription(ReolinkEntityDescription):
|
||||
"""A class that describes host entities."""
|
||||
|
||||
cmd_key: str | None = None
|
||||
supported: Callable[[Host], bool] = lambda api: True
|
||||
|
||||
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class ReolinkChimeEntityDescription(EntityDescription):
|
||||
class ReolinkChimeEntityDescription(ReolinkEntityDescription):
|
||||
"""A class that describes entities for a chime."""
|
||||
|
||||
cmd_key: str | None = None
|
||||
supported: Callable[[Chime], bool] = lambda chime: True
|
||||
|
||||
|
||||
@ -50,11 +54,7 @@ class ReolinkHostCoordinatorEntity(CoordinatorEntity[DataUpdateCoordinator[None]
|
||||
"""
|
||||
|
||||
_attr_has_entity_name = True
|
||||
entity_description: (
|
||||
ReolinkHostEntityDescription
|
||||
| ReolinkChannelEntityDescription
|
||||
| ReolinkChimeEntityDescription
|
||||
)
|
||||
entity_description: ReolinkEntityDescription
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
@ -114,8 +114,6 @@ class ReolinkHostCoordinatorEntity(CoordinatorEntity[DataUpdateCoordinator[None]
|
||||
class ReolinkChannelCoordinatorEntity(ReolinkHostCoordinatorEntity):
|
||||
"""Parent class for Reolink hardware camera entities connected to a channel of the NVR."""
|
||||
|
||||
entity_description: ReolinkChannelEntityDescription | ReolinkChimeEntityDescription
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
reolink_data: ReolinkData,
|
||||
@ -176,8 +174,6 @@ class ReolinkChannelCoordinatorEntity(ReolinkHostCoordinatorEntity):
|
||||
class ReolinkChimeCoordinatorEntity(ReolinkChannelCoordinatorEntity):
|
||||
"""Parent class for Reolink chime entities connected."""
|
||||
|
||||
entity_description: ReolinkChimeEntityDescription
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
reolink_data: ReolinkData,
|
||||
|
Loading…
x
Reference in New Issue
Block a user