1
1
"""Ariston module"""
2
+
2
3
import asyncio
3
4
import logging
4
- from typing import Any , Optional
5
+ from typing import Any , Optional , Type
5
6
6
7
from .ariston_api import AristonAPI , ConnectionException
7
8
from .const import (
21
22
from .lydos_hybrid_device import AristonLydosHybridDevice
22
23
from .nuos_split_device import AristonNuosSplitDevice
23
24
from .base_device import AristonBaseDevice
25
+ from .velis_base_device import AristonVelisBaseDevice
24
26
25
27
_LOGGER = logging .getLogger (__name__ )
26
28
27
- _MAP_WHE_TYPES_TO_CLASS = {
29
+ _MAP_WHE_TYPES_TO_CLASS : dict [ int , Type [ AristonVelisBaseDevice ]] = {
28
30
WheType .Evo .value : AristonEvoOneDevice ,
29
31
WheType .LydosHybrid .value : AristonLydosHybridDevice ,
30
32
WheType .Lydos .value : AristonEvoDevice ,
@@ -43,7 +45,11 @@ def __init__(self) -> None:
43
45
self .cloud_devices : list [dict [str , Any ]] = []
44
46
45
47
async def async_connect (
46
- self , username : str , password : str , api_url : str = ARISTON_API_URL , user_agent : str = ARISTON_USER_AGENT
48
+ self ,
49
+ username : str ,
50
+ password : str ,
51
+ api_url : str = ARISTON_API_URL ,
52
+ user_agent : str = ARISTON_USER_AGENT ,
47
53
) -> bool :
48
54
"""Connect to the ariston cloud"""
49
55
self .api = AristonAPI (username , password , api_url , user_agent )
@@ -115,7 +121,12 @@ def _get_device(
115
121
return None
116
122
117
123
118
- def _connect (username : str , password : str , api_url : str = ARISTON_API_URL , user_agent : str = ARISTON_USER_AGENT ) -> AristonAPI :
124
+ def _connect (
125
+ username : str ,
126
+ password : str ,
127
+ api_url : str = ARISTON_API_URL ,
128
+ user_agent : str = ARISTON_USER_AGENT ,
129
+ ) -> AristonAPI :
119
130
"""Connect to ariston api"""
120
131
api = AristonAPI (username , password , api_url , user_agent )
121
132
api .connect ()
@@ -131,7 +142,9 @@ def _discover(api: AristonAPI) -> list[dict[str, Any]]:
131
142
return cloud_devices
132
143
133
144
134
- def discover (username : str , password : str , api_url : str = ARISTON_API_URL ) -> list [dict [str , Any ]]:
145
+ def discover (
146
+ username : str , password : str , api_url : str = ARISTON_API_URL
147
+ ) -> list [dict [str , Any ]]:
135
148
"""Retreive ariston devices from the cloud"""
136
149
api = _connect (username , password , api_url )
137
150
return _discover (api )
@@ -151,7 +164,12 @@ def hello(
151
164
return _get_device (cloud_devices , api , gateway , is_metric , language_tag )
152
165
153
166
154
- async def _async_connect (username : str , password : str , api_url : str = ARISTON_API_URL , user_agent : str = ARISTON_USER_AGENT ) -> AristonAPI :
167
+ async def _async_connect (
168
+ username : str ,
169
+ password : str ,
170
+ api_url : str = ARISTON_API_URL ,
171
+ user_agent : str = ARISTON_USER_AGENT ,
172
+ ) -> AristonAPI :
155
173
"""Async connect to ariston api"""
156
174
api = AristonAPI (username , password , api_url , user_agent )
157
175
if not await api .async_connect ():
@@ -174,7 +192,9 @@ async def _async_discover(api: AristonAPI) -> list[dict[str, Any]]:
174
192
return cloud_devices
175
193
176
194
177
- async def async_discover (username : str , password : str , api_url : str = ARISTON_API_URL ) -> list [dict [str , Any ]]:
195
+ async def async_discover (
196
+ username : str , password : str , api_url : str = ARISTON_API_URL
197
+ ) -> list [dict [str , Any ]]:
178
198
"""Retreive ariston devices from the cloud"""
179
199
api = await _async_connect (username , password , api_url )
180
200
return await _async_discover (api )
0 commit comments