Skip to content

Commit 96d5683

Browse files
committed
Split login logic
1 parent acba99d commit 96d5683

File tree

8 files changed

+522
-407
lines changed

8 files changed

+522
-407
lines changed

foo.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import asyncio
2+
import time
3+
4+
from pyoverkiz.client import OverkizClient
5+
from pyoverkiz.const import SUPPORTED_SERVERS
6+
7+
USERNAME = "[email protected]"
8+
PASSWORD = "Etiennt001"
9+
10+
11+
async def main() -> None:
12+
async with OverkizClient(
13+
USERNAME, PASSWORD, server=SUPPORTED_SERVERS["somfy_europe"]
14+
) as client:
15+
try:
16+
await client.login()
17+
except Exception as exception: # pylint: disable=broad-except
18+
print(exception)
19+
return
20+
21+
devices = await client.get_devices()
22+
23+
for device in devices:
24+
print(f"{device.label} ({device.id}) - {device.controllable_name}")
25+
print(f"{device.widget} - {device.ui_class}")
26+
27+
while True:
28+
events = await client.fetch_events()
29+
print(events)
30+
31+
time.sleep(2)
32+
33+
34+
asyncio.run(main())

0 commit comments

Comments
 (0)