diff --git a/pyvlx/heartbeat.py b/pyvlx/heartbeat.py index e9e10794..93bbdc85 100644 --- a/pyvlx/heartbeat.py +++ b/pyvlx/heartbeat.py @@ -24,6 +24,7 @@ def __del__(self): def start(self): """Create loop task.""" + self.stopped = False self.run_task = self.pyvlx.loop.create_task(self.loop()) async def stop(self): @@ -42,7 +43,10 @@ async def loop(self): await self.loop_event.wait() if not self.stopped: self.loop_event.clear() - await self.pulse() + try: + await self.pulse() + except PyVLXException as e: + pass self.cancel_loop_timeout() self.stopped_event.set()