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
def available(self) -> bool:
"""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:
"""Register callback for TCP push events."""

View File

@ -465,8 +465,9 @@ class ReolinkHost:
wake = True
self.last_wake = time()
if self._api.baichuan.privacy_mode():
await self._api.baichuan.get_privacy_mode()
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():
return # API is shutdown, no need to check states