mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 12:47:08 +00:00
Add Reolink play quick reply message (#112134)
This commit is contained in:
parent
f3a9756f81
commit
403b47f712
@ -41,6 +41,11 @@ class ReolinkSelectEntityDescription(
|
|||||||
value: Callable[[Host, int], str] | None = None
|
value: Callable[[Host, int], str] | None = None
|
||||||
|
|
||||||
|
|
||||||
|
def _get_quick_reply_id(api: Host, ch: int, mess: str) -> int:
|
||||||
|
"""Get the quick reply file id from the message string."""
|
||||||
|
return [k for k, v in api.quick_reply_dict(ch).items() if v == mess][0]
|
||||||
|
|
||||||
|
|
||||||
SELECT_ENTITIES = (
|
SELECT_ENTITIES = (
|
||||||
ReolinkSelectEntityDescription(
|
ReolinkSelectEntityDescription(
|
||||||
key="floodlight_mode",
|
key="floodlight_mode",
|
||||||
@ -72,6 +77,16 @@ SELECT_ENTITIES = (
|
|||||||
supported=lambda api, ch: api.supported(ch, "ptz_presets"),
|
supported=lambda api, ch: api.supported(ch, "ptz_presets"),
|
||||||
method=lambda api, ch, name: api.set_ptz_command(ch, preset=name),
|
method=lambda api, ch, name: api.set_ptz_command(ch, preset=name),
|
||||||
),
|
),
|
||||||
|
ReolinkSelectEntityDescription(
|
||||||
|
key="play_quick_reply_message",
|
||||||
|
translation_key="play_quick_reply_message",
|
||||||
|
icon="mdi:message-reply-text-outline",
|
||||||
|
get_options=lambda api, ch: list(api.quick_reply_dict(ch).values())[1:],
|
||||||
|
supported=lambda api, ch: api.supported(ch, "play_quick_reply"),
|
||||||
|
method=lambda api, ch, mess: (
|
||||||
|
api.play_quick_reply(ch, file_id=_get_quick_reply_id(api, ch, mess))
|
||||||
|
),
|
||||||
|
),
|
||||||
ReolinkSelectEntityDescription(
|
ReolinkSelectEntityDescription(
|
||||||
key="auto_quick_reply_message",
|
key="auto_quick_reply_message",
|
||||||
cmd_key="GetAutoReply",
|
cmd_key="GetAutoReply",
|
||||||
@ -81,8 +96,8 @@ SELECT_ENTITIES = (
|
|||||||
get_options=lambda api, ch: list(api.quick_reply_dict(ch).values()),
|
get_options=lambda api, ch: list(api.quick_reply_dict(ch).values()),
|
||||||
supported=lambda api, ch: api.supported(ch, "quick_reply"),
|
supported=lambda api, ch: api.supported(ch, "quick_reply"),
|
||||||
value=lambda api, ch: api.quick_reply_dict(ch)[api.quick_reply_file(ch)],
|
value=lambda api, ch: api.quick_reply_dict(ch)[api.quick_reply_file(ch)],
|
||||||
method=lambda api, ch, mess: api.set_quick_reply(
|
method=lambda api, ch, mess: (
|
||||||
ch, file_id=[k for k, v in api.quick_reply_dict(ch).items() if v == mess][0]
|
api.set_quick_reply(ch, file_id=_get_quick_reply_id(api, ch, mess))
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
ReolinkSelectEntityDescription(
|
ReolinkSelectEntityDescription(
|
||||||
|
@ -363,6 +363,9 @@
|
|||||||
"ptz_preset": {
|
"ptz_preset": {
|
||||||
"name": "PTZ preset"
|
"name": "PTZ preset"
|
||||||
},
|
},
|
||||||
|
"play_quick_reply_message": {
|
||||||
|
"name": "Play quick reply message"
|
||||||
|
},
|
||||||
"auto_quick_reply_message": {
|
"auto_quick_reply_message": {
|
||||||
"name": "Auto quick reply message",
|
"name": "Auto quick reply message",
|
||||||
"state": {
|
"state": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user