Reolink check if stream is supported (#182567)

This commit is contained in:
starkillerOG
2026-09-18 09:59:01 +02:00
committed by GitHub
parent 8777713f71
commit c00d1c8507
2 changed files with 42 additions and 14 deletions
+24 -8
View File
@@ -36,27 +36,35 @@ CAMERA_ENTITIES = (
key="sub",
stream="sub",
translation_key="sub",
supported=lambda api, ch: api.supported(ch, "stream"),
supported=lambda api, ch: (
api.supported(ch, "stream") and api.supported(ch, "sub")
),
),
ReolinkCameraEntityDescription(
key="main",
stream="main",
translation_key="main",
supported=lambda api, ch: api.supported(ch, "stream"),
supported=lambda api, ch: (
api.supported(ch, "stream") and api.supported(ch, "main")
),
entity_registry_enabled_default=False,
),
ReolinkCameraEntityDescription(
key="snapshots_sub",
stream="snapshots_sub",
translation_key="snapshots_sub",
supported=lambda api, ch: api.supported(ch, "snapshot"),
supported=lambda api, ch: (
api.supported(ch, "snapshot") and api.supported(ch, "sub")
),
entity_registry_enabled_default=False,
),
ReolinkCameraEntityDescription(
key="snapshots",
stream="snapshots_main",
translation_key="snapshots_main",
supported=lambda api, ch: api.supported(ch, "snapshot"),
supported=lambda api, ch: (
api.supported(ch, "snapshot") and api.supported(ch, "main")
),
entity_registry_enabled_default=False,
),
ReolinkCameraEntityDescription(
@@ -70,27 +78,35 @@ CAMERA_ENTITIES = (
key="autotrack_sub",
stream="telephoto_sub",
translation_key="telephoto_sub",
supported=lambda api, ch: api.supported(ch, "autotrack_stream"),
supported=lambda api, ch: (
api.supported(ch, "autotrack_stream") and api.supported(ch, "sub")
),
),
ReolinkCameraEntityDescription(
key="autotrack_main",
stream="telephoto_main",
translation_key="telephoto_main",
supported=lambda api, ch: api.supported(ch, "autotrack_stream"),
supported=lambda api, ch: (
api.supported(ch, "autotrack_stream") and api.supported(ch, "main")
),
entity_registry_enabled_default=False,
),
ReolinkCameraEntityDescription(
key="autotrack_snapshots_sub",
stream="autotrack_snapshots_sub",
translation_key="telephoto_snapshots_sub",
supported=lambda api, ch: api.supported(ch, "autotrack_snapshot"),
supported=lambda api, ch: (
api.supported(ch, "autotrack_snapshot") and api.supported(ch, "sub")
),
entity_registry_enabled_default=False,
),
ReolinkCameraEntityDescription(
key="autotrack_snapshots_main",
stream="autotrack_snapshots_main",
translation_key="telephoto_snapshots_main",
supported=lambda api, ch: api.supported(ch, "autotrack_snapshot"),
supported=lambda api, ch: (
api.supported(ch, "autotrack_snapshot") and api.supported(ch, "main")
),
entity_registry_enabled_default=False,
),
)
+18 -6
View File
@@ -253,7 +253,9 @@ SELECT_ENTITIES = (
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"),
supported=lambda api, ch: (
api.supported(ch, "frame_rate") and api.supported(ch, "main")
),
value=lambda api, ch: str(api.frame_rate(ch, "main")),
method=lambda api, ch, value: api.set_frame_rate(ch, int(value), "main"),
),
@@ -266,7 +268,9 @@ SELECT_ENTITIES = (
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"),
supported=lambda api, ch: (
api.supported(ch, "frame_rate") and api.supported(ch, "sub")
),
value=lambda api, ch: str(api.frame_rate(ch, "sub")),
method=lambda api, ch, value: api.set_frame_rate(ch, int(value), "sub"),
),
@@ -279,7 +283,9 @@ SELECT_ENTITIES = (
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"),
supported=lambda api, ch: (
api.supported(ch, "bit_rate") and api.supported(ch, "main")
),
value=lambda api, ch: str(api.bit_rate(ch, "main")),
method=lambda api, ch, value: api.set_bit_rate(ch, int(value), "main"),
),
@@ -292,7 +298,9 @@ SELECT_ENTITIES = (
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"),
supported=lambda api, ch: (
api.supported(ch, "bit_rate") and api.supported(ch, "sub")
),
value=lambda api, ch: str(api.bit_rate(ch, "sub")),
method=lambda api, ch, value: api.set_bit_rate(ch, int(value), "sub"),
),
@@ -304,7 +312,9 @@ SELECT_ENTITIES = (
entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False,
get_options=[val.name for val in EncodingEnum],
supported=lambda api, ch: api.supported(ch, "encoding"),
supported=lambda api, ch: (
api.supported(ch, "encoding") and api.supported(ch, "main")
),
value=lambda api, ch: api.encoding(ch, "main"),
method=lambda api, ch, value: api.set_encoding(ch, value, "main"),
),
@@ -316,7 +326,9 @@ SELECT_ENTITIES = (
entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False,
get_options=[val.name for val in EncodingEnum],
supported=lambda api, ch: api.supported(ch, "encoding"),
supported=lambda api, ch: (
api.supported(ch, "encoding") and api.supported(ch, "sub")
),
value=lambda api, ch: api.encoding(ch, "sub"),
method=lambda api, ch, value: api.set_encoding(ch, value, "sub"),
),