Skip to content

Commit 4fad5c2

Browse files
committed
Add usage example and requirements to README.md
1 parent 4803491 commit 4fad5c2

File tree

1 file changed

+56
-2
lines changed

1 file changed

+56
-2
lines changed

README.md

+56-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,63 @@ Aioaquarea
33

44
Asynchronous library to control Panasonic Aquarea devices
55

6-
> :warning: This library is under development!
6+
## Requirements
77

8-
Requires Python >= 3.9 and uses asyncio and aiohttp.
8+
This library requires:
9+
10+
- Python >= 3.9
11+
- asyncio
12+
- aiohttp
13+
14+
## Usage
15+
The library supports the production environment of the Panasonic Aquarea Smart Cloud API and also the Demo environment. One of the main usages of this library is to integrate the Panasonic Aquarea Smart Cloud API with Home Assistant via [home-assistant-aquarea](https://github.com/cjaliaga/home-assistant-aquarea)
16+
17+
Here is a simple example of how to use the library via getting a device object to interact with it:
18+
19+
```python
20+
from aioaquarea import (
21+
Client,
22+
AquareaEnvironment,
23+
UpdateOperationMode
24+
)
25+
26+
import aiohttp
27+
import asyncio
28+
import logging
29+
from datetime import timedelta
30+
31+
async def main():
32+
async with aiohttp.ClientSession() as session:
33+
client = Client(
34+
username="USERNAME",
35+
password="PASSWORD",
36+
session=session,
37+
device_direct=True,
38+
refresh_login=True,
39+
environment=AquareaEnvironment.PRODUCTION,
40+
)
41+
42+
# The library is designed to retrieve a device object and interact with it:
43+
devices = await client.get_devices(include_long_id=True)
44+
45+
# Picking the first device associated with the account:
46+
device_info = devices[0]
47+
48+
device = await client.get_device(
49+
device_info=device_info, consumption_refresh_interval=timedelta(minutes=1)
50+
)
51+
52+
# Or the device can also be retrieved by its long id if we know it:
53+
device = await client.get_device(
54+
device_id="LONG ID", consumption_refresh_interval=timedelta(minutes=1)
55+
)
56+
57+
# Then we can interact with the device:
58+
await device.set_mode(UpdateOperationMode.HEAT)
59+
60+
# The device can automatically refresh its data:
61+
await device.refresh_data()
62+
```
963

1064
## Acknowledgements
1165

0 commit comments

Comments
 (0)