Skip to main content

An async implementation of PyAcaia

Project description

aioacaia

Async implementation of pyacaia, based on asyncio and bleak

Usage

import asyncio
from aioacaia import AcaiaScale
from aioacaia.helpers import find_acaia_devices

async def main()
  addresses = await find_acaia_devices()
  address = addresses[0]
  scale = await AcaiaScale.create(mac=address, is_new_style_scale=False)
  await scale.tare()
  await scale.startStopTimer()
  await scale.resetTimer()

asyncio.run(main())

Callback

Weight and settings are available, if you pass a callback function to the constructor. In that callback you will either receive objects of type Message or Settings. A sample notification handler can look like this and can also be found in decode.py

def notification_handler(sender, data) -> None:
    msg = decode(data)[0]
    if isinstance(msg, Settings):
        print(f"Battery: {msg.battery}")
        print(f"Unit: {msg.units}")
    elif isinstance(msg, Message):
        print(f"Weight: {msg.value}")

scale = await AcaiaScale.create(mac=address, callback=notification_handler)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aioacaia-0.1.18.tar.gz (22.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aioacaia-0.1.18-py3-none-any.whl (23.4 kB view details)

Uploaded Python 3

File details

Details for the file aioacaia-0.1.18.tar.gz.

File metadata

  • Download URL: aioacaia-0.1.18.tar.gz
  • Upload date:
  • Size: 22.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for aioacaia-0.1.18.tar.gz
Algorithm Hash digest
SHA256 2a30810c0fa349ca8cc3d6abb5373290ac6c1a446d3ad92f3a78acb7476fb2a7
MD5 cd318833cf198942c2a0aa3df7016ec8
BLAKE2b-256 d402df2536f8514c32ebf6e20a9cbd5b1bb71092b2ad3d6db425ffa127827e53

See more details on using hashes here.

Provenance

The following attestation bundles were made for aioacaia-0.1.18.tar.gz:

Publisher: pypi.yaml on zweckj/aioacaia

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aioacaia-0.1.18-py3-none-any.whl.

File metadata

  • Download URL: aioacaia-0.1.18-py3-none-any.whl
  • Upload date:
  • Size: 23.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for aioacaia-0.1.18-py3-none-any.whl
Algorithm Hash digest
SHA256 29f8d2ca4cd290d9db451b53da8dc41eaf185c167680cb46b9ab301f8e6559a1
MD5 fc7b4603c935d2f3c3332699dc910ae8
BLAKE2b-256 bd92c6fe82103c4082e7d515ca8f20fb6bf4e72c61f5d94c8faa07b72c6dd9ad

See more details on using hashes here.

Provenance

The following attestation bundles were made for aioacaia-0.1.18-py3-none-any.whl:

Publisher: pypi.yaml on zweckj/aioacaia

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page