mirror of
https://github.com/home-assistant/core.git
synced 2025-07-29 08:07:45 +00:00
Add Reolink pre-recording entities (#149522)
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
parent
8fc8220924
commit
96529ec245
@ -300,6 +300,12 @@
|
||||
},
|
||||
"image_hue": {
|
||||
"default": "mdi:image-edit"
|
||||
},
|
||||
"pre_record_time": {
|
||||
"default": "mdi:history"
|
||||
},
|
||||
"pre_record_battery_stop": {
|
||||
"default": "mdi:history"
|
||||
}
|
||||
},
|
||||
"select": {
|
||||
@ -390,6 +396,9 @@
|
||||
"packing_time": {
|
||||
"default": "mdi:record-rec"
|
||||
},
|
||||
"pre_record_fps": {
|
||||
"default": "mdi:history"
|
||||
},
|
||||
"post_rec_time": {
|
||||
"default": "mdi:record-rec"
|
||||
}
|
||||
@ -470,6 +479,9 @@
|
||||
"manual_record": {
|
||||
"default": "mdi:record-rec"
|
||||
},
|
||||
"pre_record": {
|
||||
"default": "mdi:history"
|
||||
},
|
||||
"hub_ringtone_on_event": {
|
||||
"default": "mdi:music-note"
|
||||
},
|
||||
|
@ -14,7 +14,7 @@ from homeassistant.components.number import (
|
||||
NumberEntityDescription,
|
||||
NumberMode,
|
||||
)
|
||||
from homeassistant.const import EntityCategory, UnitOfTime
|
||||
from homeassistant.const import PERCENTAGE, EntityCategory, UnitOfTime
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||
|
||||
@ -542,6 +542,38 @@ NUMBER_ENTITIES = (
|
||||
value=lambda api, ch: api.image_hue(ch),
|
||||
method=lambda api, ch, value: api.set_image(ch, hue=int(value)),
|
||||
),
|
||||
ReolinkNumberEntityDescription(
|
||||
key="pre_record_time",
|
||||
cmd_key="594",
|
||||
translation_key="pre_record_time",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
entity_registry_enabled_default=False,
|
||||
native_step=1,
|
||||
native_min_value=2,
|
||||
native_max_value=10,
|
||||
native_unit_of_measurement=UnitOfTime.SECONDS,
|
||||
supported=lambda api, ch: api.supported(ch, "pre_record"),
|
||||
value=lambda api, ch: api.baichuan.pre_record_time(ch),
|
||||
method=lambda api, ch, value: api.baichuan.set_pre_recording(
|
||||
ch, time=int(value)
|
||||
),
|
||||
),
|
||||
ReolinkNumberEntityDescription(
|
||||
key="pre_record_battery_stop",
|
||||
cmd_key="594",
|
||||
translation_key="pre_record_battery_stop",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
entity_registry_enabled_default=False,
|
||||
native_step=1,
|
||||
native_min_value=10,
|
||||
native_max_value=80,
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
supported=lambda api, ch: api.supported(ch, "pre_record"),
|
||||
value=lambda api, ch: api.baichuan.pre_record_battery_stop(ch),
|
||||
method=lambda api, ch, value: api.baichuan.set_pre_recording(
|
||||
ch, battery_stop=int(value)
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
SMART_AI_NUMBER_ENTITIES = (
|
||||
|
@ -250,6 +250,20 @@ SELECT_ENTITIES = (
|
||||
value=lambda api, ch: str(api.bit_rate(ch, "sub")),
|
||||
method=lambda api, ch, value: api.set_bit_rate(ch, int(value), "sub"),
|
||||
),
|
||||
ReolinkSelectEntityDescription(
|
||||
key="pre_record_fps",
|
||||
cmd_key="594",
|
||||
translation_key="pre_record_fps",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
entity_registry_enabled_default=False,
|
||||
unit_of_measurement=UnitOfFrequency.HERTZ,
|
||||
get_options=["1", "2", "5"],
|
||||
supported=lambda api, ch: api.supported(ch, "pre_record"),
|
||||
value=lambda api, ch: str(api.baichuan.pre_record_fps(ch)),
|
||||
method=lambda api, ch, value: api.baichuan.set_pre_recording(
|
||||
ch, fps=int(value)
|
||||
),
|
||||
),
|
||||
ReolinkSelectEntityDescription(
|
||||
key="post_rec_time",
|
||||
cmd_key="GetRec",
|
||||
|
@ -654,6 +654,12 @@
|
||||
},
|
||||
"image_hue": {
|
||||
"name": "Image hue"
|
||||
},
|
||||
"pre_record_time": {
|
||||
"name": "Pre-recording time"
|
||||
},
|
||||
"pre_record_battery_stop": {
|
||||
"name": "Pre-recording stop battery level"
|
||||
}
|
||||
},
|
||||
"select": {
|
||||
@ -858,6 +864,9 @@
|
||||
"packing_time": {
|
||||
"name": "Recording packing time"
|
||||
},
|
||||
"pre_record_fps": {
|
||||
"name": "Pre-recording frame rate"
|
||||
},
|
||||
"post_rec_time": {
|
||||
"name": "Post-recording time"
|
||||
}
|
||||
@ -946,6 +955,9 @@
|
||||
"manual_record": {
|
||||
"name": "Manual record"
|
||||
},
|
||||
"pre_record": {
|
||||
"name": "Pre-recording"
|
||||
},
|
||||
"hub_ringtone_on_event": {
|
||||
"name": "Hub ringtone on event"
|
||||
},
|
||||
|
@ -169,6 +169,15 @@ SWITCH_ENTITIES = (
|
||||
value=lambda api, ch: api.manual_record_enabled(ch),
|
||||
method=lambda api, ch, value: api.set_manual_record(ch, value),
|
||||
),
|
||||
ReolinkSwitchEntityDescription(
|
||||
key="pre_record",
|
||||
cmd_key="594",
|
||||
translation_key="pre_record",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
supported=lambda api, ch: api.supported(ch, "pre_record"),
|
||||
value=lambda api, ch: api.baichuan.pre_record_enabled(ch),
|
||||
method=lambda api, ch, value: api.baichuan.set_pre_recording(ch, enabled=value),
|
||||
),
|
||||
ReolinkSwitchEntityDescription(
|
||||
key="buzzer",
|
||||
cmd_key="GetBuzzerAlarmV20",
|
||||
|
@ -77,6 +77,10 @@
|
||||
'0': 1,
|
||||
'null': 1,
|
||||
}),
|
||||
'594': dict({
|
||||
'0': 1,
|
||||
'null': 1,
|
||||
}),
|
||||
'DingDongOpt': dict({
|
||||
'0': 2,
|
||||
'null': 2,
|
||||
|
Loading…
x
Reference in New Issue
Block a user