|
1 | 1 | from __future__ import annotations
|
2 | 2 |
|
3 |
| -from typing import Callable |
| 3 | +from enum import Enum, unique |
4 | 4 |
|
5 |
| -from aiohttp import ClientSession |
6 | 5 |
|
7 |
| -from pyoverkiz.clients.atlantic_cozytouch import AtlanticCozytouchClient |
8 |
| -from pyoverkiz.clients.default import DefaultClient |
9 |
| -from pyoverkiz.clients.nexity import NexityClient |
10 |
| -from pyoverkiz.clients.overkiz import OverkizClient |
11 |
| -from pyoverkiz.clients.somfy import SomfyClient |
12 |
| -from pyoverkiz.clients.somfy_local import SomfyLocalClient |
13 |
| - |
14 |
| -SUPPORTED_SERVERS: dict[str, Callable[[str, str, ClientSession], OverkizClient]] = { |
15 |
| - "atlantic_cozytouch": lambda username, password, session: AtlanticCozytouchClient( |
16 |
| - name="Atlantic Cozytouch", |
17 |
| - endpoint="https://ha110-1.overkiz.com/enduser-mobile-web/enduserAPI/", |
18 |
| - manufacturer="Atlantic", |
19 |
| - configuration_url=None, |
20 |
| - session=session, |
21 |
| - username=username, |
22 |
| - password=password, |
23 |
| - ), |
24 |
| - "brandt": lambda username, password, session: DefaultClient( |
25 |
| - name="Brandt Smart Control", |
26 |
| - endpoint="https://ha3-1.overkiz.com/enduser-mobile-web/enduserAPI/", |
27 |
| - manufacturer="Brandt", |
28 |
| - configuration_url=None, |
29 |
| - session=session, |
30 |
| - username=username, |
31 |
| - password=password, |
32 |
| - ), |
33 |
| - "flexom": lambda username, password, session: DefaultClient( |
34 |
| - name="Flexom", |
35 |
| - endpoint="https://ha108-1.overkiz.com/enduser-mobile-web/enduserAPI/", |
36 |
| - manufacturer="Bouygues", |
37 |
| - configuration_url=None, |
38 |
| - session=session, |
39 |
| - username=username, |
40 |
| - password=password, |
41 |
| - ), |
42 |
| - "hexaom_hexaconnect": lambda username, password, session: DefaultClient( |
43 |
| - name="Hexaom HexaConnect", |
44 |
| - endpoint="https://ha5-1.overkiz.com/enduser-mobile-web/enduserAPI/", |
45 |
| - manufacturer="Hexaom", |
46 |
| - configuration_url=None, |
47 |
| - session=session, |
48 |
| - username=username, |
49 |
| - password=password, |
50 |
| - ), |
51 |
| - "hi_kumo_asia": lambda username, password, session: DefaultClient( |
52 |
| - name="Hitachi Hi Kumo (Asia)", |
53 |
| - endpoint="https://ha203-1.overkiz.com/enduser-mobile-web/enduserAPI/", |
54 |
| - manufacturer="Hitachi", |
55 |
| - configuration_url=None, |
56 |
| - session=session, |
57 |
| - username=username, |
58 |
| - password=password, |
59 |
| - ), |
60 |
| - "hi_kumo_europe": lambda username, password, session: DefaultClient( |
61 |
| - name="Hitachi Hi Kumo (Europe)", |
62 |
| - endpoint="https://ha117-1.overkiz.com/enduser-mobile-web/enduserAPI/", |
63 |
| - manufacturer="Hitachi", |
64 |
| - configuration_url=None, |
65 |
| - session=session, |
66 |
| - username=username, |
67 |
| - password=password, |
68 |
| - ), |
69 |
| - "hi_kumo_oceania": lambda username, password, session: DefaultClient( |
70 |
| - name="Hitachi Hi Kumo (Oceania)", |
71 |
| - endpoint="https://ha203-1.overkiz.com/enduser-mobile-web/enduserAPI/", |
72 |
| - manufacturer="Hitachi", |
73 |
| - configuration_url=None, |
74 |
| - session=session, |
75 |
| - username=username, |
76 |
| - password=password, |
77 |
| - ), |
78 |
| - "nexity": lambda username, password, session: NexityClient( |
79 |
| - name="Nexity Eugénie", |
80 |
| - endpoint="https://ha106-1.overkiz.com/enduser-mobile-web/enduserAPI/", |
81 |
| - manufacturer="Nexity", |
82 |
| - configuration_url=None, |
83 |
| - session=session, |
84 |
| - username=username, |
85 |
| - password=password, |
86 |
| - ), |
87 |
| - "rexel": lambda username, password, session: DefaultClient( |
88 |
| - name="Rexel Energeasy Connect", |
89 |
| - endpoint="https://ha112-1.overkiz.com/enduser-mobile-web/enduserAPI/", |
90 |
| - manufacturer="Rexel", |
91 |
| - configuration_url="https://utilisateur.energeasyconnect.com/user/#/zone/equipements", |
92 |
| - session=session, |
93 |
| - username=username, |
94 |
| - password=password, |
95 |
| - ), |
96 |
| - "simu_livein2": lambda username, password, session: DefaultClient( # alias of https://tahomalink.com |
97 |
| - name="SIMU (LiveIn2)", |
98 |
| - endpoint="https://ha101-1.overkiz.com/enduser-mobile-web/enduserAPI/", |
99 |
| - manufacturer="Somfy", |
100 |
| - configuration_url=None, |
101 |
| - session=session, |
102 |
| - username=username, |
103 |
| - password=password, |
104 |
| - ), |
105 |
| - "somfy_europe": lambda username, password, session: SomfyClient( # alias of https://tahomalink.com |
106 |
| - name="Somfy (Europe)", |
107 |
| - endpoint="https://ha101-1.overkiz.com/enduser-mobile-web/enduserAPI/", |
108 |
| - manufacturer="Somfy", |
109 |
| - configuration_url="https://www.tahomalink.com", |
110 |
| - session=session, |
111 |
| - username=username, |
112 |
| - password=password, |
113 |
| - ), |
114 |
| - "somfy_europe_local": lambda gateway_id, token, session: SomfyLocalClient( |
115 |
| - name="Somfy Local(Europe)", |
116 |
| - endpoint=f"https://gateway-{gateway_id}.local:8443/enduser-mobile-web/1/enduserAPI/", |
117 |
| - manufacturer="Somfy", |
118 |
| - configuration_url=None, |
119 |
| - session=session, |
120 |
| - username=gateway_id, # not used |
121 |
| - password=token, |
122 |
| - ), |
123 |
| - "somfy_america": lambda username, password, session: DefaultClient( |
124 |
| - name="Somfy (North America)", |
125 |
| - endpoint="https://ha401-1.overkiz.com/enduser-mobile-web/enduserAPI/", |
126 |
| - manufacturer="Somfy", |
127 |
| - configuration_url=None, |
128 |
| - session=session, |
129 |
| - username=username, |
130 |
| - password=password, |
131 |
| - ), |
132 |
| - "somfy_oceania": lambda username, password, session: DefaultClient( |
133 |
| - name="Somfy (Oceania)", |
134 |
| - endpoint="https://ha201-1.overkiz.com/enduser-mobile-web/enduserAPI/", |
135 |
| - manufacturer="Somfy", |
136 |
| - configuration_url=None, |
137 |
| - session=session, |
138 |
| - username=username, |
139 |
| - password=password, |
140 |
| - ), |
141 |
| - "ubiwizz": lambda username, password, session: DefaultClient( |
142 |
| - name="Ubiwizz", |
143 |
| - endpoint="https://ha129-1.overkiz.com/enduser-mobile-web/enduserAPI/", |
144 |
| - manufacturer="Decelect", |
145 |
| - configuration_url=None, |
146 |
| - session=session, |
147 |
| - username=username, |
148 |
| - password=password, |
149 |
| - ), |
150 |
| -} |
| 6 | +@unique |
| 7 | +class Server(str, Enum): |
| 8 | + ATLANTIC_COZYTOUCH = "atlantic_cozytouch" |
| 9 | + BRANDT = "brandt" |
| 10 | + FLEXOM = "flexom" |
| 11 | + HEXAOM_HEXACONNECT = "hexaom_hexaconnect" |
| 12 | + HI_KUMO_ASIA = "hi_kumo_asia" |
| 13 | + HI_KUMO_EUROPE = "hi_kumo_europe" |
| 14 | + HI_KUMO_OCEANIA = "hi_kumo_oceania" |
| 15 | + NEXITY = "nexity" |
| 16 | + REXEL = "rexel" |
| 17 | + SIMU_LIVEIN2 = "simu_livein2" |
| 18 | + SOMFY_EUROPE = "somfy_europe" |
| 19 | + SOMFY_DEV_MODE = "somfy_dev_mode" |
| 20 | + SOMFY_AMERICA = "somfy_america" |
| 21 | + SOMFY_OCEANIA = "somfy_oceania" |
| 22 | + UBIWIZZ = "ubiwizz" |
0 commit comments