mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 01:08:12 +00:00
Reolink media second lens (#121800)
DUO lens camera distinguish between lenses for media playback
This commit is contained in:
parent
cdf7ecebc0
commit
97aaae1372
@ -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,
|
||||
|
@ -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}")
|
||||
|
Loading…
x
Reference in New Issue
Block a user