-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathexample.py
More file actions
27 lines (19 loc) · 710 Bytes
/
Copy pathexample.py
File metadata and controls
27 lines (19 loc) · 710 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"""Small async read-only example for the Danfoss Ally client."""
from __future__ import annotations
import asyncio
from os import environ
from pprint import pprint
from pydanfossally import DanfossAlly
async def main() -> None:
"""Run a simple read-only session against the Danfoss Ally API."""
async with DanfossAlly(
refresh_device_concurrency=5,
refresh_device_min_interval=0.10,
) as ally:
authorized = await ally.initialize(environ["KEY"], environ["SECRET"])
if not authorized:
raise RuntimeError("Error in authorization")
devices = await ally.get_devices()
pprint(devices)
if __name__ == "__main__":
asyncio.run(main())