From f53c4ee8dda6d690b1d463dd4b24f814647af514 Mon Sep 17 00:00:00 2001 From: Josef Zweck <24647999+zweckj@users.noreply.github.com> Date: Tue, 28 Nov 2023 09:09:43 +0100 Subject: [PATCH] add timer running to Message --- pyacaia_async/acaiascale.py | 1 + pyacaia_async/decode.py | 3 +++ setup.py | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pyacaia_async/acaiascale.py b/pyacaia_async/acaiascale.py index b620010..3619420 100644 --- a/pyacaia_async/acaiascale.py +++ b/pyacaia_async/acaiascale.py @@ -338,6 +338,7 @@ async def on_bluetooth_data_received( elif isinstance(msg, Message): self._data[WEIGHT] = msg.value + self._timer_running = msg.timer_running _LOGGER.debug("Got weight %s", str(msg.value)) if self._notify_callback is not None: diff --git a/pyacaia_async/decode.py b/pyacaia_async/decode.py index cc31e85..a7c8f3f 100644 --- a/pyacaia_async/decode.py +++ b/pyacaia_async/decode.py @@ -17,6 +17,7 @@ def __init__(self, msg_type: int, payload: bytearray | list[int]) -> None: self.value = None self.button = None self.time = None + self.timer_running = False if self.msg_type == 5: self.value = self._decode_weight(payload) @@ -41,6 +42,7 @@ def __init__(self, msg_type: int, payload: bytearray | list[int]) -> None: _LOGGER.debug("tare (weight: %s)", self.value) elif payload[0] == 8 and payload[1] == 5: self.button = "start" + self.timer_running = True self.value = self._decode_weight(payload[2:]) _LOGGER.debug("start (weight: %s)", self.value) elif (payload[0] == 10 and payload[1] == 7) or ( @@ -48,6 +50,7 @@ def __init__(self, msg_type: int, payload: bytearray | list[int]) -> None: ): self.button = "stop" self.time = self._decode_time(payload[2:]) + self.timer_running = False self.value = self._decode_weight(payload[6:]) _LOGGER.debug("stop time: %s, weight: %s", self.time, self.value) diff --git a/setup.py b/setup.py index dbd60cf..5c49f26 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="pyacaia_async", - version="0.0.11b5", + version="0.0.11b6", description="An async implementation of PyAcaia", long_description=readme, long_description_content_type="text/markdown",