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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file aioacaia-0.1.8.tar.gz
.
File metadata
- Download URL: aioacaia-0.1.8.tar.gz
- Upload date:
- Size: 22.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33e163bbadbfd4c0f226e59de61869498754d9377500fb61bd48aea5285c7a4a |
|
MD5 | 6329ed0addc3c743b20f8de8123cf7c2 |
|
BLAKE2b-256 | 2df8225a1a7a5ced016ffd28cc27681a155798ee8b3aec0a6249605beac3185e |
Provenance
The following attestation bundles were made for aioacaia-0.1.8.tar.gz
:
Publisher:
pypi.yaml
on zweckj/aioacaia
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
aioacaia-0.1.8.tar.gz
- Subject digest:
33e163bbadbfd4c0f226e59de61869498754d9377500fb61bd48aea5285c7a4a
- Sigstore transparency entry: 149907240
- Sigstore integration time:
- Predicate type:
File details
Details for the file aioacaia-0.1.8-py3-none-any.whl
.
File metadata
- Download URL: aioacaia-0.1.8-py3-none-any.whl
- Upload date:
- Size: 23.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 307ac0ff04b0acef14b31d5ba30f0b6002187153317df36b95cbfbd1ba3e7727 |
|
MD5 | db1a5f57686f9cc6ca8bca88b82435a2 |
|
BLAKE2b-256 | 3d0776e86aca2287fae72eb2bc4e71094438523a4a647c4989efaeeadc7e7a38 |
Provenance
The following attestation bundles were made for aioacaia-0.1.8-py3-none-any.whl
:
Publisher:
pypi.yaml
on zweckj/aioacaia
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
aioacaia-0.1.8-py3-none-any.whl
- Subject digest:
307ac0ff04b0acef14b31d5ba30f0b6002187153317df36b95cbfbd1ba3e7727
- Sigstore transparency entry: 149907243
- Sigstore integration time:
- Predicate type: