|
1 | 1 | from __future__ import annotations |
2 | 2 |
|
| 3 | +from typing import Callable |
| 4 | + |
| 5 | +from aiohttp import ClientSession |
| 6 | + |
3 | 7 | from pyoverkiz.servers.atlantic_cozytouch import AtlanticCozytouch |
4 | 8 | from pyoverkiz.servers.default import DefaultServer |
5 | 9 | from pyoverkiz.servers.nexity import NexityServer |
6 | 10 | from pyoverkiz.servers.overkiz_server import OverkizServer |
7 | 11 | from pyoverkiz.servers.somfy import SomfyServer |
8 | 12 |
|
9 | | -SUPPORTED_SERVERS: dict[str, OverkizServer] = { |
10 | | - "atlantic_cozytouch": AtlanticCozytouch( |
| 13 | +SUPPORTED_SERVERS: dict[str, Callable[[ClientSession], OverkizServer]] = { |
| 14 | + "atlantic_cozytouch": lambda session: AtlanticCozytouch( |
11 | 15 | name="Atlantic Cozytouch", |
12 | 16 | endpoint="https://ha110-1.overkiz.com/enduser-mobile-web/enduserAPI/", |
13 | 17 | manufacturer="Atlantic", |
14 | 18 | configuration_url=None, |
| 19 | + session=session, |
15 | 20 | ), |
16 | | - "brandt": DefaultServer( |
| 21 | + "brandt": lambda session: DefaultServer( |
17 | 22 | name="Brandt Smart Control", |
18 | 23 | endpoint="https://ha3-1.overkiz.com/enduser-mobile-web/enduserAPI/", |
19 | 24 | manufacturer="Brandt", |
20 | 25 | configuration_url=None, |
| 26 | + session=session, |
21 | 27 | ), |
22 | | - "flexom": DefaultServer( |
| 28 | + "flexom": lambda session: DefaultServer( |
23 | 29 | name="Flexom", |
24 | 30 | endpoint="https://ha108-1.overkiz.com/enduser-mobile-web/enduserAPI/", |
25 | 31 | manufacturer="Bouygues", |
26 | 32 | configuration_url=None, |
| 33 | + session=session, |
27 | 34 | ), |
28 | | - "hexaom_hexaconnect": DefaultServer( |
| 35 | + "hexaom_hexaconnect": lambda session: DefaultServer( |
29 | 36 | name="Hexaom HexaConnect", |
30 | 37 | endpoint="https://ha5-1.overkiz.com/enduser-mobile-web/enduserAPI/", |
31 | 38 | manufacturer="Hexaom", |
32 | 39 | configuration_url=None, |
| 40 | + session=session, |
33 | 41 | ), |
34 | | - "hi_kumo_asia": DefaultServer( |
| 42 | + "hi_kumo_asia": lambda session: DefaultServer( |
35 | 43 | name="Hitachi Hi Kumo (Asia)", |
36 | 44 | endpoint="https://ha203-1.overkiz.com/enduser-mobile-web/enduserAPI/", |
37 | 45 | manufacturer="Hitachi", |
38 | 46 | configuration_url=None, |
| 47 | + session=session, |
39 | 48 | ), |
40 | | - "hi_kumo_europe": DefaultServer( |
| 49 | + "hi_kumo_europe": lambda session: DefaultServer( |
41 | 50 | name="Hitachi Hi Kumo (Europe)", |
42 | 51 | endpoint="https://ha117-1.overkiz.com/enduser-mobile-web/enduserAPI/", |
43 | 52 | manufacturer="Hitachi", |
44 | 53 | configuration_url=None, |
| 54 | + session=session, |
45 | 55 | ), |
46 | | - "hi_kumo_oceania": DefaultServer( |
| 56 | + "hi_kumo_oceania": lambda session: DefaultServer( |
47 | 57 | name="Hitachi Hi Kumo (Oceania)", |
48 | 58 | endpoint="https://ha203-1.overkiz.com/enduser-mobile-web/enduserAPI/", |
49 | 59 | manufacturer="Hitachi", |
50 | 60 | configuration_url=None, |
| 61 | + session=session, |
51 | 62 | ), |
52 | | - "nexity": NexityServer( |
| 63 | + "nexity": lambda session: NexityServer( |
53 | 64 | name="Nexity Eugénie", |
54 | 65 | endpoint="https://ha106-1.overkiz.com/enduser-mobile-web/enduserAPI/", |
55 | 66 | manufacturer="Nexity", |
56 | 67 | configuration_url=None, |
| 68 | + session=session, |
57 | 69 | ), |
58 | | - "rexel": DefaultServer( |
| 70 | + "rexel": lambda session: DefaultServer( |
59 | 71 | name="Rexel Energeasy Connect", |
60 | 72 | endpoint="https://ha112-1.overkiz.com/enduser-mobile-web/enduserAPI/", |
61 | 73 | manufacturer="Rexel", |
62 | 74 | configuration_url="https://utilisateur.energeasyconnect.com/user/#/zone/equipements", |
| 75 | + session=session, |
63 | 76 | ), |
64 | | - "simu_livein2": DefaultServer( # alias of https://tahomalink.com |
| 77 | + "simu_livein2": lambda session: DefaultServer( # alias of https://tahomalink.com |
65 | 78 | name="SIMU (LiveIn2)", |
66 | 79 | endpoint="https://ha101-1.overkiz.com/enduser-mobile-web/enduserAPI/", |
67 | 80 | manufacturer="Somfy", |
68 | 81 | configuration_url=None, |
| 82 | + session=session, |
69 | 83 | ), |
70 | | - "somfy_europe": SomfyServer( # alias of https://tahomalink.com |
| 84 | + "somfy_europe": lambda session: SomfyServer( # alias of https://tahomalink.com |
71 | 85 | name="Somfy (Europe)", |
72 | 86 | endpoint="https://ha101-1.overkiz.com/enduser-mobile-web/enduserAPI/", |
73 | 87 | manufacturer="Somfy", |
74 | 88 | configuration_url="https://www.tahomalink.com", |
| 89 | + session=session, |
75 | 90 | ), |
76 | | - "somfy_america": DefaultServer( |
| 91 | + "somfy_america": lambda session: DefaultServer( |
77 | 92 | name="Somfy (North America)", |
78 | 93 | endpoint="https://ha401-1.overkiz.com/enduser-mobile-web/enduserAPI/", |
79 | 94 | manufacturer="Somfy", |
80 | 95 | configuration_url=None, |
| 96 | + session=session, |
81 | 97 | ), |
82 | | - "somfy_oceania": DefaultServer( |
| 98 | + "somfy_oceania": lambda session: DefaultServer( |
83 | 99 | name="Somfy (Oceania)", |
84 | 100 | endpoint="https://ha201-1.overkiz.com/enduser-mobile-web/enduserAPI/", |
85 | 101 | manufacturer="Somfy", |
86 | 102 | configuration_url=None, |
| 103 | + session=session, |
87 | 104 | ), |
88 | | - "ubiwizz": DefaultServer( |
| 105 | + "ubiwizz": lambda session: DefaultServer( |
89 | 106 | name="Ubiwizz", |
90 | 107 | endpoint="https://ha129-1.overkiz.com/enduser-mobile-web/enduserAPI/", |
91 | 108 | manufacturer="Decelect", |
92 | 109 | configuration_url=None, |
| 110 | + session=session, |
93 | 111 | ), |
94 | 112 | } |
0 commit comments