aioacaia


Nameaioacaia JSON
Version 0.1.11 PyPI version JSON
download
home_pageNone
SummaryAn async implementation of PyAcaia
upload_time2024-12-10 12:09:19
maintainerNone
docs_urlNone
authorNone
requires_python>=3.12
licenseMIT License
keywords acaia bluetooth api async client
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # aioacaia

Async implementation of [pyacaia](https://github.com/lucapinello/pyacaia/tree/master/pyacaia), based on `asyncio` and `bleak`

# Usage

```python
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`

```python
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)
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "aioacaia",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.12",
    "maintainer_email": "Josef Zweck <24647999+zweckj@users.noreply.github.com>",
    "keywords": "Acaia, Bluetooth, api, async, client",
    "author": null,
    "author_email": "Josef Zweck <24647999+zweckj@users.noreply.github.com>",
    "download_url": "https://files.pythonhosted.org/packages/11/0a/8ca830cefd86b1a4593e0d21be356f6cd11651552f611c78784727e883df/aioacaia-0.1.11.tar.gz",
    "platform": null,
    "description": "# aioacaia\n\nAsync implementation of [pyacaia](https://github.com/lucapinello/pyacaia/tree/master/pyacaia), based on `asyncio` and `bleak`\n\n# Usage\n\n```python\nimport asyncio\nfrom aioacaia import AcaiaScale\nfrom aioacaia.helpers import find_acaia_devices\n\nasync def main()\n  addresses = await find_acaia_devices()\n  address = addresses[0]\n  scale = await AcaiaScale.create(mac=address, is_new_style_scale=False)\n  await scale.tare()\n  await scale.startStopTimer()\n  await scale.resetTimer()\n\nasyncio.run(main())\n```\n\n# Callback\n\nWeight and settings are available, if you pass a callback function to the constructor.\nIn 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`\n\n```python\ndef notification_handler(sender, data) -> None:\n    msg = decode(data)[0]\n    if isinstance(msg, Settings):\n        print(f\"Battery: {msg.battery}\")\n        print(f\"Unit: {msg.units}\")\n    elif isinstance(msg, Message):\n        print(f\"Weight: {msg.value}\")\n\nscale = await AcaiaScale.create(mac=address, callback=notification_handler)\n```\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "An async implementation of PyAcaia",
    "version": "0.1.11",
    "project_urls": {
        "Documentation": "https://github.com/zweckj/aioacaia",
        "Homepage": "https://github.com/zweckj/aioacaia",
        "Repository": "https://github.com/zweckj/aioacaia"
    },
    "split_keywords": [
        "acaia",
        " bluetooth",
        " api",
        " async",
        " client"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "70670302edf62ac805a89cd07b52f97ed8dd108babbe2701912a7fa68d8c64ae",
                "md5": "4c2d5c032d167fd4dfc1d23a0f7c765d",
                "sha256": "34be8c952920a5e3bacb950e7ec2f60ee6237e937b012149f40e8ca728c3c339"
            },
            "downloads": -1,
            "filename": "aioacaia-0.1.11-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4c2d5c032d167fd4dfc1d23a0f7c765d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.12",
            "size": 23217,
            "upload_time": "2024-12-10T12:09:16",
            "upload_time_iso_8601": "2024-12-10T12:09:16.932194Z",
            "url": "https://files.pythonhosted.org/packages/70/67/0302edf62ac805a89cd07b52f97ed8dd108babbe2701912a7fa68d8c64ae/aioacaia-0.1.11-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "110a8ca830cefd86b1a4593e0d21be356f6cd11651552f611c78784727e883df",
                "md5": "44bf7a0bb77de409631f888377ce0556",
                "sha256": "a6b2ce72cf070e9429bab0c7efddc0b1d2ae5b0ce36b841b5fc957535cf8c437"
            },
            "downloads": -1,
            "filename": "aioacaia-0.1.11.tar.gz",
            "has_sig": false,
            "md5_digest": "44bf7a0bb77de409631f888377ce0556",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.12",
            "size": 22337,
            "upload_time": "2024-12-10T12:09:19",
            "upload_time_iso_8601": "2024-12-10T12:09:19.360164Z",
            "url": "https://files.pythonhosted.org/packages/11/0a/8ca830cefd86b1a4593e0d21be356f6cd11651552f611c78784727e883df/aioacaia-0.1.11.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-10 12:09:19",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "zweckj",
    "github_project": "aioacaia",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "aioacaia"
}
        
Elapsed time: 0.45267s