11# Getting started
22
3+ This guide will help you install the library, connect to your hub, and perform your first actions.
4+
35## Prerequisites
46
57- Python 3.10+
68- An OverKiz-compatible hub and account
79
8- ## Install pyOverkiz from PyPi
9-
10+ ## Install pyOverkiz from PyPI
1011
11- ### With UV <small >recommended</small > { #with-uv data-toc-label="with uv" }
12+ ### With UV <small >recommended</small >
1213
1314``` bash
1415uv add pyoverkiz
@@ -27,78 +28,88 @@ Use a cloud server when you want to connect through the vendor’s public API. U
2728- Cloud servers use the ` Server ` enum.
2829- Local servers use ` create_local_server_config ` with a hostname or IP address.
2930
30- ## First login (cloud)
31+ ## Authentication
3132
32- ``` python
33- import asyncio
33+ === "Somfy (cloud)"
3434
35- from pyoverkiz.auth.credentials import UsernamePasswordCredentials
36- from pyoverkiz.client import OverkizClient
37- from pyoverkiz.enums import Server
35+ Cloud authentication uses a vendor server from `Server` plus `UsernamePasswordCredentials`.
3836
37+ ```python
38+ import asyncio
3939
40- async def main () -> None :
41- async with OverkizClient(
42- server = Server.SOMFY_EUROPE ,
43- credentials = UsernamePasswordCredentials(" you@example.com" , " password" ),
44- ) as client:
45- await client.login()
46- print (await client.get_setup())
40+ from pyoverkiz.auth.credentials import UsernamePasswordCredentials
41+ from pyoverkiz.client import OverkizClient
42+ from pyoverkiz.enums import Server
4743
4844
49- asyncio.run(main())
50- ```
45+ async def main() -> None:
46+ async with OverkizClient(
47+ server=Server.SOMFY_EUROPE,
48+ credentials=UsernamePasswordCredentials("you@example.com", "password"),
49+ ) as client:
50+ await client.login()
5151
52- ## First login (local)
52+ asyncio.run(main())
53+ ```
5354
54- ``` python
55- import asyncio
55+ === "Somfy (local)"
5656
57- from pyoverkiz.auth.credentials import LocalTokenCredentials
58- from pyoverkiz.client import OverkizClient
59- from pyoverkiz.utils import create_local_server_config
57+ Local authentication requires a token generated by the official mobile app and a local user on the OverKiz API platform.
6058
59+ ```python
60+ import asyncio
6161
62- async def main () -> None :
63- async with OverkizClient(
64- server = create_local_server_config(host = " gateway-xxxx.local" ),
65- credentials = LocalTokenCredentials(" local-token" ),
66- verify_ssl = False ,
67- ) as client:
68- await client.login()
69- print (await client.get_setup())
62+ from pyoverkiz.auth.credentials import LocalTokenCredentials
63+ from pyoverkiz.client import OverkizClient
64+ from pyoverkiz.utils import create_local_server_config
7065
7166
72- asyncio.run(main())
73- ```
67+ async def main() -> None:
68+ async with OverkizClient(
69+ server=create_local_server_config(host="gateway-xxxx.local"),
70+ credentials=LocalTokenCredentials("local-token"),
71+ verify_ssl=True, # disable if you connect via IP
72+ ) as client:
73+ await client.login()
7474
75- ## Sanity check: list devices
75+ asyncio.run(main())
76+ ```
7677
77- ``` python
78- import asyncio
78+ === "Cozytouch (cloud)"
7979
80- from pyoverkiz.auth.credentials import UsernamePasswordCredentials
81- from pyoverkiz.client import OverkizClient
82- from pyoverkiz.enums import Server
80+ ```python
81+ import asyncio
8382
83+ from pyoverkiz.auth.credentials import UsernamePasswordCredentials
84+ from pyoverkiz.client import OverkizClient
85+ from pyoverkiz.enums import Server
8486
85- async def main () -> None :
86- async with OverkizClient(
87- server = Server.SOMFY_EUROPE ,
88- credentials = UsernamePasswordCredentials(" you@example.com" , " password" ),
89- ) as client:
90- await client.login()
91- devices = await client.get_devices()
92- for device in devices:
93- print (f " { device.label} ( { device.id} ) -> { device.widget} " )
9487
88+ async def main() -> None:
89+ async with OverkizClient(
90+ server=Server.SOMFY_EUROPE,
91+ credentials=UsernamePasswordCredentials("you@example.com", "password"),
92+ ) as client:
93+ await client.login()
9594
96- asyncio.run(main())
95+ asyncio.run(main())
96+ ```
9797
98- # # Next steps
98+ === "Rexel (cloud)"
9999
100- - Learn about authentication flows in [docs/ authentication.md](docs/ authentication.md).
101- - Control devices and run actions in [docs/ device- control.md](docs/ device- control.md).
102- - Handle events in [docs/ event- handling.md](docs/ event- handling.md).
103- - Understand errors in [docs/ error- handling.md](docs/ error- handling.md).
104- ```
100+ ```python
101+ import asyncio
102+
103+ from pyoverkiz.auth.credentials import UsernamePasswordCredentials
104+ from pyoverkiz.client import OverkizClient
105+ from pyoverkiz.enums import Server
106+
107+ async def main() -> None:
108+ async with OverkizClient(
109+ server=Server.SOMFY_EUROPE,
110+ credentials=UsernamePasswordCredentials("you@example.com", "password"),
111+ ) as client:
112+ await client.login()
113+
114+ asyncio.run(main())
115+ ```
0 commit comments