Skip to content

Commit

Permalink
rename package
Browse files Browse the repository at this point in the history
  • Loading branch information
zweckj committed Nov 9, 2024
1 parent 39320e0 commit 41234e6
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 12 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# pyacaia_async
# aioacaia

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

# Usage

```python
import asyncio
from pyacaia_async import AcaiaScale
from pyacaia_async.helpers import find_acaia_devices
from aioacaia import AcaiaScale
from aioacaia.helpers import find_acaia_devices

async def main()
addresses = await find_acaia_devices()
Expand All @@ -18,7 +21,8 @@ asyncio.run(main())
```

# Callback
Weight and settings are available, if you pass a callback function to the constructor.

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
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion pyacaia_async/acaiascale.py → aioacaia/acaiascale.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ async def connect(
address_or_ble_device=self.address_or_ble_device,
disconnected_callback=self.device_disconnected_handler,
)

self._client.get_services()
try:
await self._client.connect()
except BleakError as ex:
Expand Down
2 changes: 1 addition & 1 deletion pyacaia_async/const.py → aioacaia/const.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Constants for pyacaia_async."""
"""Constants for aioacaia."""

from typing import Final
from enum import StrEnum
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion pyacaia_async/exceptions.py → aioacaia/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Exceptions for pyacaia_async."""
"""Exceptions for aioacaia."""

from bleak.exc import BleakDeviceNotFoundError, BleakError

Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions run.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import asyncio

from pyacaia_async import AcaiaScale
from pyacaia_async.decode import notification_handler
from aioacaia import AcaiaScale
from aioacaia.decode import notification_handler


async def main():
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
readme = f.read()

setuptools.setup(
name="pyacaia_async",
name="aioacaia",
version="0.1.2",
description="An async implementation of PyAcaia",
long_description=readme,
long_description_content_type="text/markdown",
url="https://github.com/zweckj/pyacaia_async",
url="https://github.com/zweckj/aioacaia",
author="Josef Zweck",
author_email="[email protected]",
license="MIT",
Expand All @@ -25,6 +25,6 @@
packages=setuptools.find_packages(),
install_requires=["bleak>=0.20.2"],
package_data={
"pyacaia_async": ["py.typed"],
"aioacaia": ["py.typed"],
},
)

0 comments on commit 41234e6

Please sign in to comment.