Reolink media second lens (#121800)

DUO lens camera distinguish between lenses for media playback
This commit is contained in:
starkillerOG 2024-07-12 09:13:55 +02:00 committed by GitHub
parent cdf7ecebc0
commit 97aaae1372
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View File

@ -5,6 +5,7 @@ from __future__ import annotations
import datetime as dt
import logging
from reolink_aio.api import DUAL_LENS_MODELS
from reolink_aio.enums import VodRequestType
from homeassistant.components.camera import DOMAIN as CAM_DOMAIN, DynamicStreamSettings
@ -184,6 +185,9 @@ class ReolinkVODMediaSource(MediaSource):
if device.name_by_user is not None:
device_name = device.name_by_user
if host.api.model in DUAL_LENS_MODELS:
device_name = f"{device_name} lens {ch}"
children.append(
BrowseMediaSource(
domain=DOMAIN,

View File

@ -54,6 +54,7 @@ TEST_FILE_NAME = f"{TEST_YEAR}{TEST_MONTH}{TEST_DAY}{TEST_HOUR}{TEST_MINUTE}00"
TEST_FILE_NAME_MP4 = f"{TEST_YEAR}{TEST_MONTH}{TEST_DAY}{TEST_HOUR}{TEST_MINUTE}00.mp4"
TEST_STREAM = "main"
TEST_CHANNEL = "0"
TEST_CAM_NAME = "Cam new name"
TEST_MIME_TYPE = "application/x-mpegURL"
TEST_MIME_TYPE_MP4 = "video/mp4"
@ -130,6 +131,7 @@ async def test_browsing(
"""Test browsing the Reolink three."""
entry_id = config_entry.entry_id
reolink_connect.api_version.return_value = 1
reolink_connect.model = "Reolink TrackMix PoE"
with patch("homeassistant.components.reolink.PLATFORMS", [Platform.CAMERA]):
assert await hass.config_entries.async_setup(entry_id) is True
@ -137,7 +139,7 @@ async def test_browsing(
entries = dr.async_entries_for_config_entry(device_registry, entry_id)
assert len(entries) > 0
device_registry.async_update_device(entries[0].id, name_by_user="Cam new name")
device_registry.async_update_device(entries[0].id, name_by_user=TEST_CAM_NAME)
caplog.set_level(logging.DEBUG)
@ -149,6 +151,7 @@ async def test_browsing(
assert browse.title == "Reolink"
assert browse.identifier is None
assert browse.children[0].identifier == browse_root_id
assert browse.children[0].title == f"{TEST_CAM_NAME} lens 0"
# browse resolution select
browse = await async_browse_media(hass, f"{URI_SCHEME}{DOMAIN}/{browse_root_id}")