mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 21:57:51 +00:00
Add Reolink PTZ patrol start/stop (#112129)
This commit is contained in:
parent
d6cbadba3e
commit
68f17b5eab
@ -419,6 +419,9 @@
|
|||||||
"gaurd_return": {
|
"gaurd_return": {
|
||||||
"name": "Guard return"
|
"name": "Guard return"
|
||||||
},
|
},
|
||||||
|
"ptz_patrol": {
|
||||||
|
"name": "PTZ patrol"
|
||||||
|
},
|
||||||
"email": {
|
"email": {
|
||||||
"name": "Email on event"
|
"name": "Email on event"
|
||||||
},
|
},
|
||||||
|
@ -33,7 +33,7 @@ class ReolinkSwitchEntityDescription(
|
|||||||
"""A class that describes switch entities."""
|
"""A class that describes switch entities."""
|
||||||
|
|
||||||
method: Callable[[Host, int, bool], Any]
|
method: Callable[[Host, int, bool], Any]
|
||||||
value: Callable[[Host, int], bool]
|
value: Callable[[Host, int], bool | None]
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True, kw_only=True)
|
@dataclass(frozen=True, kw_only=True)
|
||||||
@ -108,6 +108,14 @@ SWITCH_ENTITIES = (
|
|||||||
value=lambda api, ch: api.ptz_guard_enabled(ch),
|
value=lambda api, ch: api.ptz_guard_enabled(ch),
|
||||||
method=lambda api, ch, value: api.set_ptz_guard(ch, enable=value),
|
method=lambda api, ch, value: api.set_ptz_guard(ch, enable=value),
|
||||||
),
|
),
|
||||||
|
ReolinkSwitchEntityDescription(
|
||||||
|
key="ptz_patrol",
|
||||||
|
translation_key="ptz_patrol",
|
||||||
|
icon="mdi:map-marker-path",
|
||||||
|
supported=lambda api, ch: api.supported(ch, "ptz_patrol"),
|
||||||
|
value=lambda api, ch: None,
|
||||||
|
method=lambda api, ch, value: api.ctrl_ptz_patrol(ch, value),
|
||||||
|
),
|
||||||
ReolinkSwitchEntityDescription(
|
ReolinkSwitchEntityDescription(
|
||||||
key="email",
|
key="email",
|
||||||
cmd_key="GetEmail",
|
cmd_key="GetEmail",
|
||||||
@ -275,7 +283,7 @@ class ReolinkSwitchEntity(ReolinkChannelCoordinatorEntity, SwitchEntity):
|
|||||||
super().__init__(reolink_data, channel)
|
super().__init__(reolink_data, channel)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_on(self) -> bool:
|
def is_on(self) -> bool | None:
|
||||||
"""Return true if switch is on."""
|
"""Return true if switch is on."""
|
||||||
return self.entity_description.value(self._host.api, self._channel)
|
return self.entity_description.value(self._host.api, self._channel)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user