Reolink fix privacy mode availability for NVR IPC cams (#144569)

* Correct "available" for IPC cams

* Check privacy mode when updating
This commit is contained in:
starkillerOG 2025-05-09 18:46:32 +02:00 committed by GitHub
parent 356775c19b
commit e892744328
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 4 deletions

View File

@ -198,7 +198,14 @@ class ReolinkChannelCoordinatorEntity(ReolinkHostCoordinatorEntity):
@property @property
def available(self) -> bool: def available(self) -> bool:
"""Return True if entity is available.""" """Return True if entity is available."""
return super().available and self._host.api.camera_online(self._channel) if self.entity_description.always_available:
return True
return (
super().available
and self._host.api.camera_online(self._channel)
and not self._host.api.baichuan.privacy_mode(self._channel)
)
def register_callback(self, callback_id: str, cmd_id: int) -> None: def register_callback(self, callback_id: str, cmd_id: int) -> None:
"""Register callback for TCP push events.""" """Register callback for TCP push events."""

View File

@ -465,10 +465,11 @@ class ReolinkHost:
wake = True wake = True
self.last_wake = time() self.last_wake = time()
for channel in self._api.channels:
if self._api.baichuan.privacy_mode(channel):
await self._api.baichuan.get_privacy_mode(channel)
if self._api.baichuan.privacy_mode(): if self._api.baichuan.privacy_mode():
await self._api.baichuan.get_privacy_mode() return # API is shutdown, no need to check states
if self._api.baichuan.privacy_mode():
return # API is shutdown, no need to check states
await self._api.get_states(cmd_list=self.update_cmd, wake=wake) await self._api.get_states(cmd_list=self.update_cmd, wake=wake)