Skip to content

Commit

Permalink
feat: abstract the need to check pubnub since it yale will use websoc…
Browse files Browse the repository at this point in the history
…kets
  • Loading branch information
bdraco committed Jun 18, 2024
1 parent 49b88db commit 8ebb7aa
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions yalexs/manager/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,14 +222,21 @@ async def refresh_camera_by_id(self, device_id: str) -> None:
self._api.async_get_doorbell_detail,
)

@property

Check warning on line 225 in yalexs/manager/data.py

View check run for this annotation

Codecov / codecov/patch

yalexs/manager/data.py#L225

Added line #L225 was not covered by tests
def push_updates_connected(self) -> bool:
"""Return if the push updates are connected."""
return (

Check warning on line 228 in yalexs/manager/data.py

View check run for this annotation

Codecov / codecov/patch

yalexs/manager/data.py#L228

Added line #L228 was not covered by tests
self.activity_stream is not None and self.activity_stream.pubnub.connected
)

async def _async_refresh_device_detail_by_id(self, device_id: str) -> None:
if device_id in self._locks_by_id:
if self.activity_stream and self.activity_stream.pubnub.connected:
if self.activity_stream and self.push_updates_connected:
saved_attrs = _save_live_attrs(self._device_detail_by_id[device_id])
await self._async_update_device_detail(
self._locks_by_id[device_id], self._api.async_get_lock_detail
)
if self.activity_stream and self.activity_stream.pubnub.connected:
if self.activity_stream and self.push_updates_connected:
_restore_live_attrs(self._device_detail_by_id[device_id], saved_attrs)
# keypads are always attached to locks
if (
Expand Down

0 comments on commit 8ebb7aa

Please sign in to comment.