Add Reolink binning mode select entity (#131570)

This commit is contained in:
starkillerOG 2024-11-26 16:19:41 +01:00 committed by GitHub
parent 0e88e22fd2
commit a2ebfe6e83
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 28 additions and 3 deletions

View File

@ -222,6 +222,9 @@
"hdr": {
"default": "mdi:hdr"
},
"binning_mode": {
"default": "mdi:code-block-brackets"
},
"hub_alarm_ringtone": {
"default": "mdi:music-note",
"state": {

View File

@ -8,6 +8,7 @@ import logging
from typing import Any
from reolink_aio.api import (
BinningModeEnum,
Chime,
ChimeToneEnum,
DayNightEnum,
@ -175,6 +176,19 @@ SELECT_ENTITIES = (
value=lambda api, ch: HDREnum(api.HDR_state(ch)).name,
method=lambda api, ch, name: api.set_HDR(ch, HDREnum[name].value),
),
ReolinkSelectEntityDescription(
key="binning_mode",
cmd_key="GetIsp",
translation_key="binning_mode",
entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False,
get_options=[method.name for method in BinningModeEnum],
supported=lambda api, ch: api.supported(ch, "binning_mode"),
value=lambda api, ch: BinningModeEnum(api.binning_mode(ch)).name,
method=lambda api, ch, name: api.set_binning_mode(
ch, BinningModeEnum[name].value
),
),
ReolinkSelectEntityDescription(
key="main_frame_rate",
cmd_key="GetEnc",

View File

@ -490,7 +490,7 @@
"name": "Floodlight mode",
"state": {
"off": "[%key:common::state::off%]",
"auto": "Auto",
"auto": "[%key:component::reolink::entity::select::day_night_mode::state::auto%]",
"onatnight": "On at night",
"schedule": "Schedule",
"adaptive": "Adaptive",
@ -529,7 +529,7 @@
"name": "Doorbell LED",
"state": {
"stayoff": "Stay off",
"auto": "Auto",
"auto": "[%key:component::reolink::entity::select::day_night_mode::state::auto%]",
"alwaysonatnight": "Auto & always on at night",
"alwayson": "Always on"
}
@ -539,7 +539,15 @@
"state": {
"off": "[%key:common::state::off%]",
"on": "[%key:common::state::on%]",
"auto": "Auto"
"auto": "[%key:component::reolink::entity::select::day_night_mode::state::auto%]"
}
},
"binning_mode": {
"name": "Binning mode",
"state": {
"off": "[%key:common::state::off%]",
"on": "[%key:common::state::on%]",
"auto": "[%key:component::reolink::entity::select::day_night_mode::state::auto%]"
}
},
"hub_alarm_ringtone": {