Metadata-Version: 2.4
Name: atomberg-api
Version: 0.1.1
Summary: Async Python client for the Atomberg public cloud API (fans, water purifiers, smart locks)
Author: Ratul BMG
License-Expression: MIT
Project-URL: Homepage, https://github.com/ratulbmg/atomberg-api
Project-URL: Issues, https://github.com/ratulbmg/atomberg-api/issues
Keywords: atomberg,home-assistant,smart-home,iot
Classifier: Development Status :: 4 - Beta
Classifier: Framework :: AsyncIO
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Typing :: Typed
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: aiohttp>=3.9
Provides-Extra: test
Requires-Dist: pytest>=8; extra == "test"
Requires-Dist: pytest-asyncio>=0.23; extra == "test"
Dynamic: license-file

# atomberg-api

Async Python client for the [Atomberg public cloud API](https://developer.atomberg-iot.com/).
It supports Atomberg fans, water purifiers, and smart locks, and is used by the
Home Assistant `atomberg` integration.

This is an unofficial community library. It is not affiliated with or endorsed by Atomberg.

## Installation

```bash
pip install atomberg-api
```

## Usage

You need an API key and a refresh token, which you generate in the Atomberg Home app
(see the [developer portal](https://developer.atomberg-iot.com/)). Keep them private.

```python
import asyncio

import aiohttp

from atomberg_api import AtombergClient


async def main() -> None:
    async with aiohttp.ClientSession() as session:
        client = AtombergClient(session, "YOUR_API_KEY", "YOUR_REFRESH_TOKEN")
        for device in await client.async_get_devices():
            print(device.name, device.device_type)
        states = await client.async_get_states()
        print(states)


asyncio.run(main())
```

## API limits

The public API allows 100 requests per day per account, shared with the Atomberg Home app
and any other tools using the same account. One call to `async_get_states()` returns the
state of every device.

## Errors

- `AtombergAuthError`: the API key or refresh token was rejected.
- `AtombergConnectionError`: a network or server error.
- `AtombergError`: any other unexpected response. The two errors above inherit from it.

## Development

```bash
pip install -e ".[test]"
pytest
```

## License

MIT
