Add support for dual lens cameras in Reolink (#89554)
This commit is contained in:
parent
40ed3be4a8
commit
431a8d0047
5 changed files with 19 additions and 8 deletions
|
@ -3,6 +3,8 @@ from __future__ import annotations
|
|||
|
||||
import logging
|
||||
|
||||
from reolink_aio.api import DUAL_LENS_MODELS
|
||||
|
||||
from homeassistant.components.camera import Camera, CameraEntityFeature
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
@ -25,7 +27,7 @@ async def async_setup_entry(
|
|||
host = reolink_data.host
|
||||
|
||||
cameras = []
|
||||
for channel in host.api.channels:
|
||||
for channel in host.api.stream_channels:
|
||||
streams = ["sub", "main", "snapshots"]
|
||||
if host.api.protocol in ["rtmp", "flv"]:
|
||||
streams.append("ext")
|
||||
|
@ -56,7 +58,10 @@ class ReolinkCamera(ReolinkChannelCoordinatorEntity, Camera):
|
|||
|
||||
self._stream = stream
|
||||
|
||||
self._attr_name = self._stream
|
||||
if self._host.api.model in DUAL_LENS_MODELS:
|
||||
self._attr_name = f"{self._stream} lens {self._channel}"
|
||||
else:
|
||||
self._attr_name = self._stream
|
||||
self._attr_unique_id = f"{self._host.unique_id}_{self._channel}_{self._stream}"
|
||||
self._attr_entity_registry_enabled_default = stream == "sub"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue