mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Add Reolink bitrate and framerate select entities (#131571)
This commit is contained in:
parent
666b908242
commit
5f7c7b323e
@ -263,6 +263,18 @@
|
|||||||
"state": {
|
"state": {
|
||||||
"off": "mdi:music-note-off"
|
"off": "mdi:music-note-off"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"main_frame_rate": {
|
||||||
|
"default": "mdi:play-speed"
|
||||||
|
},
|
||||||
|
"sub_frame_rate": {
|
||||||
|
"default": "mdi:play-speed"
|
||||||
|
},
|
||||||
|
"main_bit_rate": {
|
||||||
|
"default": "mdi:play-speed"
|
||||||
|
},
|
||||||
|
"sub_bit_rate": {
|
||||||
|
"default": "mdi:play-speed"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sensor": {
|
"sensor": {
|
||||||
|
@ -21,7 +21,7 @@ from reolink_aio.api import (
|
|||||||
from reolink_aio.exceptions import InvalidParameterError, ReolinkError
|
from reolink_aio.exceptions import InvalidParameterError, ReolinkError
|
||||||
|
|
||||||
from homeassistant.components.select import SelectEntity, SelectEntityDescription
|
from homeassistant.components.select import SelectEntity, SelectEntityDescription
|
||||||
from homeassistant.const import EntityCategory
|
from homeassistant.const import EntityCategory, UnitOfDataRate, UnitOfFrequency
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import HomeAssistantError, ServiceValidationError
|
from homeassistant.exceptions import HomeAssistantError, ServiceValidationError
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
@ -175,6 +175,54 @@ SELECT_ENTITIES = (
|
|||||||
value=lambda api, ch: HDREnum(api.HDR_state(ch)).name,
|
value=lambda api, ch: HDREnum(api.HDR_state(ch)).name,
|
||||||
method=lambda api, ch, name: api.set_HDR(ch, HDREnum[name].value),
|
method=lambda api, ch, name: api.set_HDR(ch, HDREnum[name].value),
|
||||||
),
|
),
|
||||||
|
ReolinkSelectEntityDescription(
|
||||||
|
key="main_frame_rate",
|
||||||
|
cmd_key="GetEnc",
|
||||||
|
translation_key="main_frame_rate",
|
||||||
|
entity_category=EntityCategory.CONFIG,
|
||||||
|
entity_registry_enabled_default=False,
|
||||||
|
unit_of_measurement=UnitOfFrequency.HERTZ,
|
||||||
|
get_options=lambda api, ch: [str(v) for v in api.frame_rate_list(ch, "main")],
|
||||||
|
supported=lambda api, ch: api.supported(ch, "frame_rate"),
|
||||||
|
value=lambda api, ch: str(api.frame_rate(ch, "main")),
|
||||||
|
method=lambda api, ch, value: api.set_frame_rate(ch, int(value), "main"),
|
||||||
|
),
|
||||||
|
ReolinkSelectEntityDescription(
|
||||||
|
key="sub_frame_rate",
|
||||||
|
cmd_key="GetEnc",
|
||||||
|
translation_key="sub_frame_rate",
|
||||||
|
entity_category=EntityCategory.CONFIG,
|
||||||
|
entity_registry_enabled_default=False,
|
||||||
|
unit_of_measurement=UnitOfFrequency.HERTZ,
|
||||||
|
get_options=lambda api, ch: [str(v) for v in api.frame_rate_list(ch, "sub")],
|
||||||
|
supported=lambda api, ch: api.supported(ch, "frame_rate"),
|
||||||
|
value=lambda api, ch: str(api.frame_rate(ch, "sub")),
|
||||||
|
method=lambda api, ch, value: api.set_frame_rate(ch, int(value), "sub"),
|
||||||
|
),
|
||||||
|
ReolinkSelectEntityDescription(
|
||||||
|
key="main_bit_rate",
|
||||||
|
cmd_key="GetEnc",
|
||||||
|
translation_key="main_bit_rate",
|
||||||
|
entity_category=EntityCategory.CONFIG,
|
||||||
|
entity_registry_enabled_default=False,
|
||||||
|
unit_of_measurement=UnitOfDataRate.KILOBITS_PER_SECOND,
|
||||||
|
get_options=lambda api, ch: [str(v) for v in api.bit_rate_list(ch, "main")],
|
||||||
|
supported=lambda api, ch: api.supported(ch, "bit_rate"),
|
||||||
|
value=lambda api, ch: str(api.bit_rate(ch, "main")),
|
||||||
|
method=lambda api, ch, value: api.set_bit_rate(ch, int(value), "main"),
|
||||||
|
),
|
||||||
|
ReolinkSelectEntityDescription(
|
||||||
|
key="sub_bit_rate",
|
||||||
|
cmd_key="GetEnc",
|
||||||
|
translation_key="sub_bit_rate",
|
||||||
|
entity_category=EntityCategory.CONFIG,
|
||||||
|
entity_registry_enabled_default=False,
|
||||||
|
unit_of_measurement=UnitOfDataRate.KILOBITS_PER_SECOND,
|
||||||
|
get_options=lambda api, ch: [str(v) for v in api.bit_rate_list(ch, "sub")],
|
||||||
|
supported=lambda api, ch: api.supported(ch, "bit_rate"),
|
||||||
|
value=lambda api, ch: str(api.bit_rate(ch, "sub")),
|
||||||
|
method=lambda api, ch, value: api.set_bit_rate(ch, int(value), "sub"),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
CHIME_SELECT_ENTITIES = (
|
CHIME_SELECT_ENTITIES = (
|
||||||
|
@ -653,6 +653,18 @@
|
|||||||
"moonlight": "[%key:component::reolink::entity::select::motion_tone::state::moonlight%]",
|
"moonlight": "[%key:component::reolink::entity::select::motion_tone::state::moonlight%]",
|
||||||
"waybackhome": "[%key:component::reolink::entity::select::motion_tone::state::waybackhome%]"
|
"waybackhome": "[%key:component::reolink::entity::select::motion_tone::state::waybackhome%]"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"main_frame_rate": {
|
||||||
|
"name": "Clear frame rate"
|
||||||
|
},
|
||||||
|
"sub_frame_rate": {
|
||||||
|
"name": "Fluent frame rate"
|
||||||
|
},
|
||||||
|
"main_bit_rate": {
|
||||||
|
"name": "Clear bit rate"
|
||||||
|
},
|
||||||
|
"sub_bit_rate": {
|
||||||
|
"name": "Fluent bit rate"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sensor": {
|
"sensor": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user