Skip to content

Commit

Permalink
feat: recover p2p?
Browse files Browse the repository at this point in the history
  • Loading branch information
fuatakgun committed Nov 25, 2023
1 parent 657ef84 commit fb81459
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
10 changes: 9 additions & 1 deletion custom_components/eufy_security/eufy_security_api/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,17 @@ async def start_livestream(self) -> bool:
self.stream_status = StreamStatus.STREAMING
return True

async def check_and_stop_livestream(self):
async def check_and_stop_livestream(self, retry: bool):
_LOGGER.debug(f"check_and_stop_livestream - start - {retry}")
if self.stream_status != StreamStatus.IDLE:
await self.stop_livestream()
_LOGGER.debug(f"check_and_stop_livestream - cont - {retry}")
if retry is True:
_LOGGER.debug(f"check_and_stop_livestream - sleep 5 seconds - {retry}")
await asyncio.sleep(5)
_LOGGER.debug(f"check_and_stop_livestream - start live stream finish - {retry}")
await self.start_livestream()
_LOGGER.debug(f"check_and_stop_livestream - start live stream end - {retry}")

async def stop_livestream(self):
"""Process stop p2p livestream call"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,7 @@ async def start(self):
p2p_thread.start()
#asyncio.new_event_loop().create_task(self.write_bytes(self.camera.audio_queue))


async def stop(self):
await self.camera.check_and_stop_livestream()

async def stop(self, retry: boolean):
await self.camera.check_and_stop_livestream()
await asyncio.sleep(5)
if retry is True:
await self.camera.start_livestream()
async def stop(self, retry):
_LOGGER.debug(f"p2p - initiate stop - {retry}")
await self.camera.check_and_stop_livestream(retry)

0 comments on commit fb81459

Please sign in to comment.