Skip to content

Commit

Permalink
add timer running to Message
Browse files Browse the repository at this point in the history
  • Loading branch information
zweckj committed Nov 28, 2023
1 parent 4531093 commit f53c4ee
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions pyacaia_async/acaiascale.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions pyacaia_async/decode.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -41,13 +42,15 @@ 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 (
payload[0] == 10 and payload[1] == 5
):
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)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit f53c4ee

Please sign in to comment.