Reolink add binary sensors (#85654)
Co-authored-by: J. Nick Koston <nick@koston.org> Co-authored-by: Martin Hjelmare <marhje52@gmail.com> Co-authored-by: Franck Nijhof <frenck@frenck.nl>
This commit is contained in:
parent
7f4a727e10
commit
7e51aeb916
11 changed files with 348 additions and 26 deletions
|
@ -1,7 +1,6 @@
|
|||
"""Reolink parent entity class."""
|
||||
from __future__ import annotations
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
@ -11,12 +10,10 @@ from .const import DOMAIN
|
|||
|
||||
|
||||
class ReolinkCoordinatorEntity(CoordinatorEntity):
|
||||
"""Parent class for Reolink Entities."""
|
||||
"""Parent class for Reolink hardware camera entities."""
|
||||
|
||||
def __init__(
|
||||
self, reolink_data: ReolinkData, config_entry: ConfigEntry, channel: int | None
|
||||
) -> None:
|
||||
"""Initialize ReolinkCoordinatorEntity."""
|
||||
def __init__(self, reolink_data: ReolinkData, channel: int) -> None:
|
||||
"""Initialize ReolinkCoordinatorEntity for a hardware camera."""
|
||||
coordinator = reolink_data.device_coordinator
|
||||
super().__init__(coordinator)
|
||||
|
||||
|
@ -25,7 +22,7 @@ class ReolinkCoordinatorEntity(CoordinatorEntity):
|
|||
|
||||
http_s = "https" if self._host.api.use_https else "http"
|
||||
conf_url = f"{http_s}://{self._host.api.host}:{self._host.api.port}"
|
||||
if self._host.api.is_nvr and self._channel is not None:
|
||||
if self._host.api.is_nvr:
|
||||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={(DOMAIN, f"{self._host.unique_id}_ch{self._channel}")},
|
||||
via_device=(DOMAIN, self._host.unique_id),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue