Reolink add auto tracking entities (#90063)
This commit is contained in:
parent
56293ad876
commit
97f8a3fdcd
3 changed files with 73 additions and 1 deletions
|
@ -188,6 +188,60 @@ NUMBER_ENTITIES = (
|
||||||
value=lambda api, ch: api.quick_reply_time(ch),
|
value=lambda api, ch: api.quick_reply_time(ch),
|
||||||
method=lambda api, ch, value: api.set_quick_reply(ch, time=int(value)),
|
method=lambda api, ch, value: api.set_quick_reply(ch, time=int(value)),
|
||||||
),
|
),
|
||||||
|
ReolinkNumberEntityDescription(
|
||||||
|
key="auto_track_limit_left",
|
||||||
|
name="Auto track limit left",
|
||||||
|
icon="mdi:angle-acute",
|
||||||
|
mode=NumberMode.SLIDER,
|
||||||
|
entity_category=EntityCategory.CONFIG,
|
||||||
|
native_step=1,
|
||||||
|
native_min_value=-1,
|
||||||
|
native_max_value=2700,
|
||||||
|
supported=lambda api, ch: api.supported(ch, "auto_track_limit"),
|
||||||
|
value=lambda api, ch: api.auto_track_limit_left(ch),
|
||||||
|
method=lambda api, ch, value: api.set_auto_track_limit(ch, left=int(value)),
|
||||||
|
),
|
||||||
|
ReolinkNumberEntityDescription(
|
||||||
|
key="auto_track_limit_right",
|
||||||
|
name="Auto track limit right",
|
||||||
|
icon="mdi:angle-acute",
|
||||||
|
mode=NumberMode.SLIDER,
|
||||||
|
entity_category=EntityCategory.CONFIG,
|
||||||
|
native_step=1,
|
||||||
|
native_min_value=-1,
|
||||||
|
native_max_value=2700,
|
||||||
|
supported=lambda api, ch: api.supported(ch, "auto_track_limit"),
|
||||||
|
value=lambda api, ch: api.auto_track_limit_right(ch),
|
||||||
|
method=lambda api, ch, value: api.set_auto_track_limit(ch, right=int(value)),
|
||||||
|
),
|
||||||
|
ReolinkNumberEntityDescription(
|
||||||
|
key="auto_track_disappear_time",
|
||||||
|
name="Auto track disappear time",
|
||||||
|
icon="mdi:target-account",
|
||||||
|
entity_category=EntityCategory.CONFIG,
|
||||||
|
native_step=1,
|
||||||
|
native_unit_of_measurement=UnitOfTime.SECONDS,
|
||||||
|
native_min_value=1,
|
||||||
|
native_max_value=60,
|
||||||
|
supported=lambda api, ch: api.supported(ch, "auto_track_disappear_time"),
|
||||||
|
value=lambda api, ch: api.auto_track_disappear_time(ch),
|
||||||
|
method=lambda api, ch, value: api.set_auto_tracking(
|
||||||
|
ch, disappear_time=int(value)
|
||||||
|
),
|
||||||
|
),
|
||||||
|
ReolinkNumberEntityDescription(
|
||||||
|
key="auto_track_stop_time",
|
||||||
|
name="Auto track stop time",
|
||||||
|
icon="mdi:target-account",
|
||||||
|
entity_category=EntityCategory.CONFIG,
|
||||||
|
native_step=1,
|
||||||
|
native_unit_of_measurement=UnitOfTime.SECONDS,
|
||||||
|
native_min_value=1,
|
||||||
|
native_max_value=60,
|
||||||
|
supported=lambda api, ch: api.supported(ch, "auto_track_stop_time"),
|
||||||
|
value=lambda api, ch: api.auto_track_stop_time(ch),
|
||||||
|
method=lambda api, ch, value: api.set_auto_tracking(ch, stop_time=int(value)),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ from collections.abc import Callable
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from reolink_aio.api import DayNightEnum, Host, SpotlightModeEnum
|
from reolink_aio.api import DayNightEnum, Host, SpotlightModeEnum, TrackMethodEnum
|
||||||
|
|
||||||
from homeassistant.components.select import SelectEntity, SelectEntityDescription
|
from homeassistant.components.select import SelectEntity, SelectEntityDescription
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
@ -79,6 +79,17 @@ SELECT_ENTITIES = (
|
||||||
ch, file_id=[k for k, v in api.quick_reply_dict(ch).items() if v == mess][0]
|
ch, file_id=[k for k, v in api.quick_reply_dict(ch).items() if v == mess][0]
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
ReolinkSelectEntityDescription(
|
||||||
|
key="auto_track_method",
|
||||||
|
name="Auto track method",
|
||||||
|
icon="mdi:target-account",
|
||||||
|
translation_key="auto_track_method",
|
||||||
|
entity_category=EntityCategory.CONFIG,
|
||||||
|
get_options=[method.name for method in TrackMethodEnum],
|
||||||
|
supported=lambda api, ch: api.supported(ch, "auto_track_method"),
|
||||||
|
value=lambda api, ch: TrackMethodEnum(api.auto_track_method(ch)).name,
|
||||||
|
method=lambda api, ch, name: api.set_auto_tracking(ch, method=name),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,13 @@
|
||||||
"state": {
|
"state": {
|
||||||
"off": "Off"
|
"off": "Off"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"auto_track_method": {
|
||||||
|
"state": {
|
||||||
|
"digital": "Digital",
|
||||||
|
"digitalfirst": "Digital first",
|
||||||
|
"pantiltfirst": "Pan/tilt first"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue