diff --git a/custom_components/eufy_security/eufy_security_api/camera.py b/custom_components/eufy_security/eufy_security_api/camera.py index e700ad5..777d0be 100644 --- a/custom_components/eufy_security/eufy_security_api/camera.py +++ b/custom_components/eufy_security/eufy_security_api/camera.py @@ -136,16 +136,18 @@ async def _initiate_start_stream(self, stream_type) -> bool: return False async def check_live_stream(self): - if self.p2p_streamer.retry is not None: - _LOGGER.debug(f"async_restart_livestream - start - {self.p2p_streamer.retry}") - if self.stream_status != StreamStatus.IDLE: - await self.stop_livestream() - if self.p2p_streamer.retry is True: - _LOGGER.debug(f"async_restart_livestream - sleep - {self.p2p_streamer.retry}") - await asyncio.sleep(1) - _LOGGER.debug(f"async_restart_livestream - start live stream finish - {self.p2p_streamer.retry}") - await self.start_livestream() - _LOGGER.debug(f"async_restart_livestream - start live stream end - {self.p2p_streamer.retry}") + while self.p2p_streamer.retry is None: + await asyncio.sleep(1) + + _LOGGER.debug(f"async_restart_livestream - start - {self.p2p_streamer.retry}") + if self.stream_status != StreamStatus.IDLE: + await self.stop_livestream() + if self.p2p_streamer.retry is True: + _LOGGER.debug(f"async_restart_livestream - sleep - {self.p2p_streamer.retry}") + await asyncio.sleep(1) + _LOGGER.debug(f"async_restart_livestream - start live stream finish - {self.p2p_streamer.retry}") + await self.start_livestream() + _LOGGER.debug(f"async_restart_livestream - start live stream end - {self.p2p_streamer.retry}") async def start_livestream(self) -> bool: """Process start p2p livestream call"""