Add Reolink Home Hub ringtone control (#126390)
* Add Hub alarm/visitor ringtones * fix styling * fix translations * fix tests * Rename buzzer to hub ringtonepull/125763/head
parent
66d310977d
commit
118ceedda1
|
@ -210,6 +210,18 @@
|
|||
"hdr": {
|
||||
"default": "mdi:hdr"
|
||||
},
|
||||
"hub_alarm_ringtone": {
|
||||
"default": "mdi:music-note",
|
||||
"state": {
|
||||
"alarm": "mdi:bullhorn"
|
||||
}
|
||||
},
|
||||
"hub_visitor_ringtone": {
|
||||
"default": "mdi:music-note",
|
||||
"state": {
|
||||
"alarm": "mdi:bullhorn"
|
||||
}
|
||||
},
|
||||
"motion_tone": {
|
||||
"default": "mdi:music-note",
|
||||
"state": {
|
||||
|
@ -297,8 +309,8 @@
|
|||
"manual_record": {
|
||||
"default": "mdi:record-rec"
|
||||
},
|
||||
"buzzer": {
|
||||
"default": "mdi:room-service"
|
||||
"hub_ringtone_on_event": {
|
||||
"default": "mdi:music-note"
|
||||
},
|
||||
"doorbell_button_sound": {
|
||||
"default": "mdi:volume-high"
|
||||
|
|
|
@ -13,6 +13,7 @@ from reolink_aio.api import (
|
|||
DayNightEnum,
|
||||
HDREnum,
|
||||
Host,
|
||||
HubToneEnum,
|
||||
SpotlightModeEnum,
|
||||
StatusLedEnum,
|
||||
TrackMethodEnum,
|
||||
|
@ -114,6 +115,32 @@ SELECT_ENTITIES = (
|
|||
api.set_quick_reply(ch, file_id=_get_quick_reply_id(api, ch, mess))
|
||||
),
|
||||
),
|
||||
ReolinkSelectEntityDescription(
|
||||
key="hub_alarm_ringtone",
|
||||
cmd_key="GetDeviceAudioCfg",
|
||||
translation_key="hub_alarm_ringtone",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
get_options=[mode.name for mode in HubToneEnum],
|
||||
supported=lambda api, ch: api.supported(ch, "hub_audio"),
|
||||
value=lambda api, ch: HubToneEnum(api.hub_alarm_tone_id(ch)).name,
|
||||
method=lambda api, ch, name: (
|
||||
api.set_hub_audio(ch, alarm_tone_id=HubToneEnum[name].value)
|
||||
),
|
||||
),
|
||||
ReolinkSelectEntityDescription(
|
||||
key="hub_visitor_ringtone",
|
||||
cmd_key="GetDeviceAudioCfg",
|
||||
translation_key="hub_visitor_ringtone",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
get_options=[mode.name for mode in HubToneEnum],
|
||||
supported=lambda api, ch: (
|
||||
api.supported(ch, "hub_audio") and api.is_doorbell(ch)
|
||||
),
|
||||
value=lambda api, ch: HubToneEnum(api.hub_visitor_tone_id(ch)).name,
|
||||
method=lambda api, ch, name: (
|
||||
api.set_hub_audio(ch, visitor_tone_id=HubToneEnum[name].value)
|
||||
),
|
||||
),
|
||||
ReolinkSelectEntityDescription(
|
||||
key="auto_track_method",
|
||||
cmd_key="GetAiCfg",
|
||||
|
|
|
@ -531,6 +531,38 @@
|
|||
"auto": "Auto"
|
||||
}
|
||||
},
|
||||
"hub_alarm_ringtone": {
|
||||
"name": "Hub alarm ringtone",
|
||||
"state": {
|
||||
"alarm": "Alarm",
|
||||
"citybird": "[%key:component::reolink::entity::select::motion_tone::state::citybird%]",
|
||||
"originaltune": "[%key:component::reolink::entity::select::motion_tone::state::originaltune%]",
|
||||
"pianokey": "[%key:component::reolink::entity::select::motion_tone::state::pianokey%]",
|
||||
"loop": "[%key:component::reolink::entity::select::motion_tone::state::loop%]",
|
||||
"attraction": "[%key:component::reolink::entity::select::motion_tone::state::attraction%]",
|
||||
"hophop": "[%key:component::reolink::entity::select::motion_tone::state::hophop%]",
|
||||
"goodday": "[%key:component::reolink::entity::select::motion_tone::state::goodday%]",
|
||||
"operetta": "[%key:component::reolink::entity::select::motion_tone::state::operetta%]",
|
||||
"moonlight": "[%key:component::reolink::entity::select::motion_tone::state::moonlight%]",
|
||||
"waybackhome": "[%key:component::reolink::entity::select::motion_tone::state::waybackhome%]"
|
||||
}
|
||||
},
|
||||
"hub_visitor_ringtone": {
|
||||
"name": "Hub visitor ringtone",
|
||||
"state": {
|
||||
"alarm": "[%key:component::reolink::entity::select::hub_alarm_ringtone::state::alarm%]",
|
||||
"citybird": "[%key:component::reolink::entity::select::motion_tone::state::citybird%]",
|
||||
"originaltune": "[%key:component::reolink::entity::select::motion_tone::state::originaltune%]",
|
||||
"pianokey": "[%key:component::reolink::entity::select::motion_tone::state::pianokey%]",
|
||||
"loop": "[%key:component::reolink::entity::select::motion_tone::state::loop%]",
|
||||
"attraction": "[%key:component::reolink::entity::select::motion_tone::state::attraction%]",
|
||||
"hophop": "[%key:component::reolink::entity::select::motion_tone::state::hophop%]",
|
||||
"goodday": "[%key:component::reolink::entity::select::motion_tone::state::goodday%]",
|
||||
"operetta": "[%key:component::reolink::entity::select::motion_tone::state::operetta%]",
|
||||
"moonlight": "[%key:component::reolink::entity::select::motion_tone::state::moonlight%]",
|
||||
"waybackhome": "[%key:component::reolink::entity::select::motion_tone::state::waybackhome%]"
|
||||
}
|
||||
},
|
||||
"motion_tone": {
|
||||
"name": "Motion ringtone",
|
||||
"state": {
|
||||
|
@ -663,8 +695,8 @@
|
|||
"manual_record": {
|
||||
"name": "Manual record"
|
||||
},
|
||||
"buzzer": {
|
||||
"name": "Buzzer on event"
|
||||
"hub_ringtone_on_event": {
|
||||
"name": "Hub ringtone on event"
|
||||
},
|
||||
"doorbell_button_sound": {
|
||||
"name": "Doorbell button sound"
|
||||
|
|
|
@ -171,7 +171,7 @@ SWITCH_ENTITIES = (
|
|||
ReolinkSwitchEntityDescription(
|
||||
key="buzzer",
|
||||
cmd_key="GetBuzzerAlarmV20",
|
||||
translation_key="buzzer",
|
||||
translation_key="hub_ringtone_on_event",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
supported=lambda api, ch: api.supported(ch, "buzzer") and api.is_nvr,
|
||||
value=lambda api, ch: api.buzzer_enabled(ch),
|
||||
|
@ -248,7 +248,7 @@ NVR_SWITCH_ENTITIES = (
|
|||
ReolinkNVRSwitchEntityDescription(
|
||||
key="buzzer",
|
||||
cmd_key="GetBuzzerAlarmV20",
|
||||
translation_key="buzzer",
|
||||
translation_key="hub_ringtone_on_event",
|
||||
icon="mdi:room-service",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
supported=lambda api: api.supported(None, "buzzer"),
|
||||
|
|
|
@ -77,6 +77,10 @@
|
|||
'0': 1,
|
||||
'null': 1,
|
||||
}),
|
||||
'GetDeviceAudioCfg': dict({
|
||||
'0': 2,
|
||||
'null': 2,
|
||||
}),
|
||||
'GetEmail': dict({
|
||||
'0': 1,
|
||||
'null': 2,
|
||||
|
|
Loading…
Reference in New Issue