Skip to content

Commit

Permalink
Prevent keepalive loop watchdog from triggering when protocol is None…
Browse files Browse the repository at this point in the history
… due to connection errors
  • Loading branch information
starkillerOG committed Dec 11, 2024
1 parent ef91716 commit 31f75f8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions reolink_aio/baichuan/baichuan.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,8 @@ async def _keepalive_loop(self) -> None:
if sleep_t < 0.5:
break
await asyncio.sleep(sleep_t)

self._time_keepalive_loop = time_now()
_LOGGER.debug("Baichuan host %s: sending keepalive for event subscription", self._host)
try:
if self._events_active:
Expand Down Expand Up @@ -529,6 +531,7 @@ async def subscribe_events(self) -> None:
_LOGGER.debug("Baichuan host %s: already subscribed to events", self._host)
return
self._subscribed = True
self._time_keepalive_loop = time_now()
try:
await self.send(cmd_id=31)
except Exception as err:
Expand Down

0 comments on commit 31f75f8

Please sign in to comment.