From 45310933e15031f0c8a456096a2b8f27cbdd0cea Mon Sep 17 00:00:00 2001 From: Josef Zweck <24647999+zweckj@users.noreply.github.com> Date: Thu, 23 Nov 2023 09:02:24 +0100 Subject: [PATCH] save tasks --- pyacaia_async/acaiascale.py | 14 ++++++++------ setup.py | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/pyacaia_async/acaiascale.py b/pyacaia_async/acaiascale.py index 0a95559..b620010 100644 --- a/pyacaia_async/acaiascale.py +++ b/pyacaia_async/acaiascale.py @@ -224,13 +224,15 @@ async def connect( except BleakDeviceNotFoundError as ex: raise AcaiaDeviceNotFound("Device not found") from ex - asyncio.create_task( - self._send_heartbeats( - interval=HEARTBEAT_INTERVAL if not self._is_new_style_scale else 1, - new_style_heartbeat=self._is_new_style_scale, + if not self._heartbeat_task: + self._heartbeat_task = asyncio.create_task( + self._send_heartbeats( + interval=HEARTBEAT_INTERVAL if not self._is_new_style_scale else 1, + new_style_heartbeat=self._is_new_style_scale, + ) ) - ) - asyncio.create_task(self._process_queue()) + if not self._process_queue_task: + self._process_queue_task = asyncio.create_task(self._process_queue()) async def auth(self) -> None: """Send auth message to scale, if subscribed to notifications returns Settings object""" diff --git a/setup.py b/setup.py index 7129496..dbd60cf 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="pyacaia_async", - version="0.0.11b4", + version="0.0.11b5", description="An async implementation of PyAcaia", long_description=readme, long_description_content_type="text/markdown",