Skip to content

Commit fecd647

Browse files
committed
Merge remote-tracking branch 'origin/v2/main' into feature/optional-boto3
2 parents 0311a1e + dc914c8 commit fecd647

10 files changed

Lines changed: 292 additions & 256 deletions

File tree

pyoverkiz/client.py

Lines changed: 70 additions & 48 deletions
Large diffs are not rendered by default.

pyoverkiz/const.py

Lines changed: 117 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from __future__ import annotations
44

55
from importlib.metadata import version
6+
from types import MappingProxyType
67

78
from pyoverkiz.enums import Server
89
from pyoverkiz.enums.server import APIType
@@ -45,117 +46,119 @@
4546
Server.SOMFY_AMERICA,
4647
]
4748

48-
SUPPORTED_SERVERS: dict[str, ServerConfig] = {
49-
Server.ATLANTIC_COZYTOUCH: ServerConfig(
50-
server=Server.ATLANTIC_COZYTOUCH,
51-
name="Atlantic Cozytouch",
52-
endpoint="https://ha110-1.overkiz.com/enduser-mobile-web/enduserAPI/",
53-
manufacturer="Atlantic",
54-
api_type=APIType.CLOUD,
55-
),
56-
Server.BRANDT: ServerConfig(
57-
server=Server.BRANDT,
58-
name="Brandt Smart Control",
59-
endpoint="https://ha3-1.overkiz.com/enduser-mobile-web/enduserAPI/",
60-
manufacturer="Brandt",
61-
api_type=APIType.CLOUD,
62-
),
63-
Server.FLEXOM: ServerConfig(
64-
server=Server.FLEXOM,
65-
name="Flexom",
66-
endpoint="https://ha108-1.overkiz.com/enduser-mobile-web/enduserAPI/",
67-
manufacturer="Bouygues",
68-
api_type=APIType.CLOUD,
69-
),
70-
Server.HEXAOM_HEXACONNECT: ServerConfig(
71-
server=Server.HEXAOM_HEXACONNECT,
72-
name="Hexaom HexaConnect",
73-
endpoint="https://ha5-1.overkiz.com/enduser-mobile-web/enduserAPI/",
74-
manufacturer="Hexaom",
75-
api_type=APIType.CLOUD,
76-
),
77-
Server.HI_KUMO_ASIA: ServerConfig(
78-
server=Server.HI_KUMO_ASIA,
79-
name="Hitachi Hi Kumo (Asia)",
80-
endpoint="https://ha203-1.overkiz.com/enduser-mobile-web/enduserAPI/",
81-
manufacturer="Hitachi",
82-
api_type=APIType.CLOUD,
83-
),
84-
Server.HI_KUMO_EUROPE: ServerConfig(
85-
server=Server.HI_KUMO_EUROPE,
86-
name="Hitachi Hi Kumo (Europe)",
87-
endpoint="https://ha117-1.overkiz.com/enduser-mobile-web/enduserAPI/",
88-
manufacturer="Hitachi",
89-
api_type=APIType.CLOUD,
90-
),
91-
Server.HI_KUMO_OCEANIA: ServerConfig(
92-
server=Server.HI_KUMO_OCEANIA,
93-
name="Hitachi Hi Kumo (Oceania)",
94-
endpoint="https://ha203-1.overkiz.com/enduser-mobile-web/enduserAPI/",
95-
manufacturer="Hitachi",
96-
api_type=APIType.CLOUD,
97-
),
98-
Server.NEXITY: ServerConfig(
99-
server=Server.NEXITY,
100-
name="Nexity Eugénie",
101-
endpoint="https://ha106-1.overkiz.com/enduser-mobile-web/enduserAPI/",
102-
manufacturer="Nexity",
103-
api_type=APIType.CLOUD,
104-
),
105-
Server.REXEL: ServerConfig(
106-
server=Server.REXEL,
107-
name="Rexel Energeasy Connect",
108-
endpoint=REXEL_BACKEND_API,
109-
manufacturer="Rexel",
110-
api_type=APIType.CLOUD,
111-
),
112-
Server.SAUTER_COZYTOUCH: ServerConfig( # duplicate of Atlantic Cozytouch
113-
server=Server.SAUTER_COZYTOUCH,
114-
name="Sauter Cozytouch",
115-
endpoint="https://ha110-1.overkiz.com/enduser-mobile-web/enduserAPI/",
116-
manufacturer="Sauter",
117-
api_type=APIType.CLOUD,
118-
),
119-
Server.SIMU_LIVEIN2: ServerConfig( # alias of https://tahomalink.com
120-
server=Server.SIMU_LIVEIN2,
121-
name="SIMU (LiveIn2)",
122-
endpoint="https://ha101-1.overkiz.com/enduser-mobile-web/enduserAPI/",
123-
manufacturer="Somfy",
124-
api_type=APIType.CLOUD,
125-
),
126-
Server.SOMFY_EUROPE: ServerConfig( # alias of https://tahomalink.com
127-
server=Server.SOMFY_EUROPE,
128-
name="Somfy (Europe)",
129-
endpoint="https://ha101-1.overkiz.com/enduser-mobile-web/enduserAPI/",
130-
manufacturer="Somfy",
131-
api_type=APIType.CLOUD,
132-
),
133-
Server.SOMFY_AMERICA: ServerConfig(
134-
server=Server.SOMFY_AMERICA,
135-
name="Somfy (North America)",
136-
endpoint="https://ha401-1.overkiz.com/enduser-mobile-web/enduserAPI/",
137-
manufacturer="Somfy",
138-
api_type=APIType.CLOUD,
139-
),
140-
Server.SOMFY_OCEANIA: ServerConfig(
141-
server=Server.SOMFY_OCEANIA,
142-
name="Somfy (Oceania)",
143-
endpoint="https://ha201-1.overkiz.com/enduser-mobile-web/enduserAPI/",
144-
manufacturer="Somfy",
145-
api_type=APIType.CLOUD,
146-
),
147-
Server.THERMOR_COZYTOUCH: ServerConfig( # duplicate of Atlantic Cozytouch
148-
server=Server.THERMOR_COZYTOUCH,
149-
name="Thermor Cozytouch",
150-
endpoint="https://ha110-1.overkiz.com/enduser-mobile-web/enduserAPI/",
151-
manufacturer="Thermor",
152-
api_type=APIType.CLOUD,
153-
),
154-
Server.UBIWIZZ: ServerConfig(
155-
server=Server.UBIWIZZ,
156-
name="Ubiwizz",
157-
endpoint="https://ha129-1.overkiz.com/enduser-mobile-web/enduserAPI/",
158-
manufacturer="Decelect",
159-
api_type=APIType.CLOUD,
160-
),
161-
}
49+
SUPPORTED_SERVERS: MappingProxyType[str, ServerConfig] = MappingProxyType(
50+
{
51+
Server.ATLANTIC_COZYTOUCH: ServerConfig(
52+
server=Server.ATLANTIC_COZYTOUCH,
53+
name="Atlantic Cozytouch",
54+
endpoint="https://ha110-1.overkiz.com/enduser-mobile-web/enduserAPI/",
55+
manufacturer="Atlantic",
56+
api_type=APIType.CLOUD,
57+
),
58+
Server.BRANDT: ServerConfig(
59+
server=Server.BRANDT,
60+
name="Brandt Smart Control",
61+
endpoint="https://ha3-1.overkiz.com/enduser-mobile-web/enduserAPI/",
62+
manufacturer="Brandt",
63+
api_type=APIType.CLOUD,
64+
),
65+
Server.FLEXOM: ServerConfig(
66+
server=Server.FLEXOM,
67+
name="Flexom",
68+
endpoint="https://ha108-1.overkiz.com/enduser-mobile-web/enduserAPI/",
69+
manufacturer="Bouygues",
70+
api_type=APIType.CLOUD,
71+
),
72+
Server.HEXAOM_HEXACONNECT: ServerConfig(
73+
server=Server.HEXAOM_HEXACONNECT,
74+
name="Hexaom HexaConnect",
75+
endpoint="https://ha5-1.overkiz.com/enduser-mobile-web/enduserAPI/",
76+
manufacturer="Hexaom",
77+
api_type=APIType.CLOUD,
78+
),
79+
Server.HI_KUMO_ASIA: ServerConfig(
80+
server=Server.HI_KUMO_ASIA,
81+
name="Hitachi Hi Kumo (Asia)",
82+
endpoint="https://ha203-1.overkiz.com/enduser-mobile-web/enduserAPI/",
83+
manufacturer="Hitachi",
84+
api_type=APIType.CLOUD,
85+
),
86+
Server.HI_KUMO_EUROPE: ServerConfig(
87+
server=Server.HI_KUMO_EUROPE,
88+
name="Hitachi Hi Kumo (Europe)",
89+
endpoint="https://ha117-1.overkiz.com/enduser-mobile-web/enduserAPI/",
90+
manufacturer="Hitachi",
91+
api_type=APIType.CLOUD,
92+
),
93+
Server.HI_KUMO_OCEANIA: ServerConfig(
94+
server=Server.HI_KUMO_OCEANIA,
95+
name="Hitachi Hi Kumo (Oceania)",
96+
endpoint="https://ha203-1.overkiz.com/enduser-mobile-web/enduserAPI/",
97+
manufacturer="Hitachi",
98+
api_type=APIType.CLOUD,
99+
),
100+
Server.NEXITY: ServerConfig(
101+
server=Server.NEXITY,
102+
name="Nexity Eugénie",
103+
endpoint="https://ha106-1.overkiz.com/enduser-mobile-web/enduserAPI/",
104+
manufacturer="Nexity",
105+
api_type=APIType.CLOUD,
106+
),
107+
Server.REXEL: ServerConfig(
108+
server=Server.REXEL,
109+
name="Rexel Energeasy Connect",
110+
endpoint=REXEL_BACKEND_API,
111+
manufacturer="Rexel",
112+
api_type=APIType.CLOUD,
113+
),
114+
Server.SAUTER_COZYTOUCH: ServerConfig( # duplicate of Atlantic Cozytouch
115+
server=Server.SAUTER_COZYTOUCH,
116+
name="Sauter Cozytouch",
117+
endpoint="https://ha110-1.overkiz.com/enduser-mobile-web/enduserAPI/",
118+
manufacturer="Sauter",
119+
api_type=APIType.CLOUD,
120+
),
121+
Server.SIMU_LIVEIN2: ServerConfig( # alias of https://tahomalink.com
122+
server=Server.SIMU_LIVEIN2,
123+
name="SIMU (LiveIn2)",
124+
endpoint="https://ha101-1.overkiz.com/enduser-mobile-web/enduserAPI/",
125+
manufacturer="Somfy",
126+
api_type=APIType.CLOUD,
127+
),
128+
Server.SOMFY_EUROPE: ServerConfig( # alias of https://tahomalink.com
129+
server=Server.SOMFY_EUROPE,
130+
name="Somfy (Europe)",
131+
endpoint="https://ha101-1.overkiz.com/enduser-mobile-web/enduserAPI/",
132+
manufacturer="Somfy",
133+
api_type=APIType.CLOUD,
134+
),
135+
Server.SOMFY_AMERICA: ServerConfig(
136+
server=Server.SOMFY_AMERICA,
137+
name="Somfy (North America)",
138+
endpoint="https://ha401-1.overkiz.com/enduser-mobile-web/enduserAPI/",
139+
manufacturer="Somfy",
140+
api_type=APIType.CLOUD,
141+
),
142+
Server.SOMFY_OCEANIA: ServerConfig(
143+
server=Server.SOMFY_OCEANIA,
144+
name="Somfy (Oceania)",
145+
endpoint="https://ha201-1.overkiz.com/enduser-mobile-web/enduserAPI/",
146+
manufacturer="Somfy",
147+
api_type=APIType.CLOUD,
148+
),
149+
Server.THERMOR_COZYTOUCH: ServerConfig( # duplicate of Atlantic Cozytouch
150+
server=Server.THERMOR_COZYTOUCH,
151+
name="Thermor Cozytouch",
152+
endpoint="https://ha110-1.overkiz.com/enduser-mobile-web/enduserAPI/",
153+
manufacturer="Thermor",
154+
api_type=APIType.CLOUD,
155+
),
156+
Server.UBIWIZZ: ServerConfig(
157+
server=Server.UBIWIZZ,
158+
name="Ubiwizz",
159+
endpoint="https://ha129-1.overkiz.com/enduser-mobile-web/enduserAPI/",
160+
manufacturer="Decelect",
161+
api_type=APIType.CLOUD,
162+
),
163+
}
164+
)

pyoverkiz/converter.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import attr
1010
import cattrs
1111

12+
from pyoverkiz._case import decamelize
1213
from pyoverkiz.models import (
1314
CommandDefinition,
1415
CommandDefinitions,
@@ -65,3 +66,8 @@ def _structure_command_definitions(val: Any, _: type) -> CommandDefinitions:
6566

6667

6768
converter = _make_converter()
69+
70+
71+
def structure_response[T](data: Any, cls: type[T]) -> T:
72+
"""Decamelize an API response and structure it into the target type."""
73+
return converter.structure(decamelize(data), cls)

0 commit comments

Comments
 (0)