alphaess-aio 0.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 zeguramente
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,70 @@
1
+ Metadata-Version: 2.1
2
+ Name: alphaess-aio
3
+ Version: 0.0.0
4
+ Summary: Sends get and post requests to available AlphaCloud API endpoints.
5
+ Author-email: Markus Ziegler <frage_n@web.de>
6
+ Maintainer-email: Markus Ziegler <frage_n@web.de>
7
+ License: MIT License
8
+
9
+ Copyright (c) 2024 zeguramente
10
+
11
+ Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ of this software and associated documentation files (the "Software"), to deal
13
+ in the Software without restriction, including without limitation the rights
14
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ copies of the Software, and to permit persons to whom the Software is
16
+ furnished to do so, subject to the following conditions:
17
+
18
+ The above copyright notice and this permission notice shall be included in all
19
+ copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ SOFTWARE.
28
+
29
+ Project-URL: Repository, https://github.com/zeguramente/alphaess-aio
30
+ Keywords: alphaess,api
31
+ Classifier: Development Status :: 4 - Beta
32
+ Classifier: Programming Language :: Python
33
+ Requires-Python: >=3.10
34
+ Description-Content-Type: text/markdown
35
+ License-File: LICENSE
36
+ Requires-Dist: aiohttp==3.9.3
37
+ Requires-Dist: pydantic==2.6.4
38
+ Provides-Extra: test
39
+ Requires-Dist: pytest; extra == "test"
40
+ Requires-Dist: pytest-mock; extra == "test"
41
+ Requires-Dist: pytest-asyncio; extra == "test"
42
+ Requires-Dist: pytest-aiohttp; extra == "test"
43
+ Provides-Extra: lint
44
+ Requires-Dist: ruff>=0.4.2; extra == "lint"
45
+
46
+ # Alphaess-aio - a Alpha Open API client
47
+
48
+ ## About
49
+
50
+ Sends get and post requests to available AlphaCloud API endpoints and retrieves data about you AlphaESS system.
51
+ Code generated out of API description.
52
+
53
+ ## Prerequisites
54
+
55
+ Register account at https://open.alphaess.com/. You will recieve an AppID and AppSecret needed for authentification.
56
+
57
+ ## How to use
58
+
59
+ ```python
60
+ import asyncio
61
+ from alphaessaio import AlphaEssAPI, AlphaEssAuth
62
+
63
+ # setup auth
64
+ auth = AlphaEssAuth(appid="your_app_id", appsecret="your_app_secret")
65
+
66
+ #init api
67
+ alphaess_api = AlphaEssAPI(auth)
68
+
69
+ ess_list = asyncio.run(alphaess_api.get_ess_list())
70
+ ```
@@ -0,0 +1,25 @@
1
+ # Alphaess-aio - a Alpha Open API client
2
+
3
+ ## About
4
+
5
+ Sends get and post requests to available AlphaCloud API endpoints and retrieves data about you AlphaESS system.
6
+ Code generated out of API description.
7
+
8
+ ## Prerequisites
9
+
10
+ Register account at https://open.alphaess.com/. You will recieve an AppID and AppSecret needed for authentification.
11
+
12
+ ## How to use
13
+
14
+ ```python
15
+ import asyncio
16
+ from alphaessaio import AlphaEssAPI, AlphaEssAuth
17
+
18
+ # setup auth
19
+ auth = AlphaEssAuth(appid="your_app_id", appsecret="your_app_secret")
20
+
21
+ #init api
22
+ alphaess_api = AlphaEssAPI(auth)
23
+
24
+ ess_list = asyncio.run(alphaess_api.get_ess_list())
25
+ ```
@@ -0,0 +1,70 @@
1
+ Metadata-Version: 2.1
2
+ Name: alphaess-aio
3
+ Version: 0.0.0
4
+ Summary: Sends get and post requests to available AlphaCloud API endpoints.
5
+ Author-email: Markus Ziegler <frage_n@web.de>
6
+ Maintainer-email: Markus Ziegler <frage_n@web.de>
7
+ License: MIT License
8
+
9
+ Copyright (c) 2024 zeguramente
10
+
11
+ Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ of this software and associated documentation files (the "Software"), to deal
13
+ in the Software without restriction, including without limitation the rights
14
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ copies of the Software, and to permit persons to whom the Software is
16
+ furnished to do so, subject to the following conditions:
17
+
18
+ The above copyright notice and this permission notice shall be included in all
19
+ copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ SOFTWARE.
28
+
29
+ Project-URL: Repository, https://github.com/zeguramente/alphaess-aio
30
+ Keywords: alphaess,api
31
+ Classifier: Development Status :: 4 - Beta
32
+ Classifier: Programming Language :: Python
33
+ Requires-Python: >=3.10
34
+ Description-Content-Type: text/markdown
35
+ License-File: LICENSE
36
+ Requires-Dist: aiohttp==3.9.3
37
+ Requires-Dist: pydantic==2.6.4
38
+ Provides-Extra: test
39
+ Requires-Dist: pytest; extra == "test"
40
+ Requires-Dist: pytest-mock; extra == "test"
41
+ Requires-Dist: pytest-asyncio; extra == "test"
42
+ Requires-Dist: pytest-aiohttp; extra == "test"
43
+ Provides-Extra: lint
44
+ Requires-Dist: ruff>=0.4.2; extra == "lint"
45
+
46
+ # Alphaess-aio - a Alpha Open API client
47
+
48
+ ## About
49
+
50
+ Sends get and post requests to available AlphaCloud API endpoints and retrieves data about you AlphaESS system.
51
+ Code generated out of API description.
52
+
53
+ ## Prerequisites
54
+
55
+ Register account at https://open.alphaess.com/. You will recieve an AppID and AppSecret needed for authentification.
56
+
57
+ ## How to use
58
+
59
+ ```python
60
+ import asyncio
61
+ from alphaessaio import AlphaEssAPI, AlphaEssAuth
62
+
63
+ # setup auth
64
+ auth = AlphaEssAuth(appid="your_app_id", appsecret="your_app_secret")
65
+
66
+ #init api
67
+ alphaess_api = AlphaEssAPI(auth)
68
+
69
+ ess_list = asyncio.run(alphaess_api.get_ess_list())
70
+ ```
@@ -0,0 +1,12 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ alphaess_aio.egg-info/PKG-INFO
5
+ alphaess_aio.egg-info/SOURCES.txt
6
+ alphaess_aio.egg-info/dependency_links.txt
7
+ alphaess_aio.egg-info/requires.txt
8
+ alphaess_aio.egg-info/top_level.txt
9
+ alphaessaio/__init__.py
10
+ alphaessaio/client.py
11
+ alphaessaio/response.py
12
+ tests/test_client.py
@@ -0,0 +1,11 @@
1
+ aiohttp==3.9.3
2
+ pydantic==2.6.4
3
+
4
+ [lint]
5
+ ruff>=0.4.2
6
+
7
+ [test]
8
+ pytest
9
+ pytest-mock
10
+ pytest-asyncio
11
+ pytest-aiohttp
@@ -0,0 +1 @@
1
+ alphaessaio
@@ -0,0 +1,7 @@
1
+ """Import stuff"""
2
+
3
+ from alphaessaio.client import AlphaEssAPI, AlphaEssAuth
4
+
5
+ __all__ = [AlphaEssAPI, AlphaEssAuth]
6
+
7
+ __version__ = "0.0.0"
@@ -0,0 +1,443 @@
1
+ """Sending requests to AlphaESS API"""
2
+
3
+ import logging
4
+ import time
5
+ import hashlib
6
+ import json
7
+ import aiohttp
8
+ import pydantic
9
+ from alphaessaio import response
10
+
11
+ logger = logging.getLogger(__name__)
12
+
13
+
14
+ class AlphaEssRequestError(Exception):
15
+ def __init__(self, response_data: dict):
16
+ message = f"Error: {response_data}"
17
+ super().__init__(message)
18
+
19
+
20
+ class AlphaEssAuth(pydantic.BaseModel):
21
+ appid: str
22
+ appsecret: pydantic.SecretStr
23
+
24
+ def _get_signature(self, timestamp) -> str:
25
+ return str(
26
+ hashlib.sha512(
27
+ (f"{self.appid}{self.appsecret.get_secret_value()}{timestamp}").encode(
28
+ "ascii"
29
+ )
30
+ ).hexdigest()
31
+ )
32
+
33
+ def create_headers(self):
34
+ timestamp = str(int(time.time()))
35
+ sign = self._get_signature(timestamp)
36
+ return {"appId": self.appid, "timeStamp": timestamp, "sign": sign}
37
+
38
+
39
+ class AlphaEssAPI:
40
+ def __init__(self, auth: AlphaEssAuth):
41
+ self.auth = auth
42
+
43
+ async def _get(self, url, params) -> dict:
44
+ headers = self.auth.create_headers()
45
+ async with aiohttp.ClientSession() as session:
46
+ logger.debug(f"Sending get request to {url=} with {params=}")
47
+ async with session.get(url, headers=headers, params=params) as resp:
48
+ return await self._evaluate_response(resp)
49
+
50
+ async def _post(self, url, params) -> dict:
51
+ headers = self.auth.create_headers()
52
+ async with aiohttp.ClientSession() as session:
53
+ async with session.post(url, headers=headers, json=params) as resp:
54
+ return await self._evaluate_response(resp)
55
+
56
+ @staticmethod
57
+ async def _evaluate_response(resp: aiohttp.ClientResponse) -> dict:
58
+ try:
59
+ data = await resp.json()
60
+ logger.debug(f"api response: {data}")
61
+ except json.JSONDecodeError as json_decode_error:
62
+ raise AlphaEssRequestError(
63
+ {"msg": "returned data is not valid json", "err": json_decode_error}
64
+ )
65
+ if resp.status == 200 and data.get("code", 0) == 200:
66
+ logger.debug(f"Request successful. {resp.url}")
67
+ return data
68
+ logger.error(f"Request error: {data=}")
69
+ raise AlphaEssRequestError(data)
70
+
71
+ @pydantic.validate_call
72
+ async def get_ev_charger_config_list(
73
+ self, sys_sn: str
74
+ ) -> response.EvChargerConfigList:
75
+ """Obtain the SN of the charging pile according to the SN, and set the model
76
+
77
+ Args:
78
+ sys_sn (str): System S/N
79
+
80
+ Returns:
81
+ (response.EvChargerConfigList): response data
82
+ """
83
+
84
+ raw_response: dict = await self._get(
85
+ "https://openapi.alphaess.com/api/getEvChargerConfigList", {"sysSn": sys_sn}
86
+ )
87
+
88
+ return response.EvChargerConfigList(**raw_response)
89
+
90
+ @pydantic.validate_call
91
+ async def get_ev_charger_currents_by_sn(
92
+ self, sys_sn: str
93
+ ) -> response.EvChargerCurrentsBySn:
94
+ """Obtain the current setting of charging pile household according to SN
95
+
96
+ Args:
97
+ sys_sn (str): sys sn
98
+
99
+ Returns:
100
+ (response.EvChargerCurrentsBySn): response data
101
+ """
102
+
103
+ raw_response: dict = await self._get(
104
+ "https://openapi.alphaess.com/api/getEvChargerCurrentsBySn",
105
+ {"sysSn": sys_sn},
106
+ )
107
+
108
+ return response.EvChargerCurrentsBySn(**raw_response)
109
+
110
+ @pydantic.validate_call
111
+ async def set_ev_charger_currents_by_sn(
112
+ self, sys_sn: str, currentsetting: float
113
+ ) -> response.EvChargerCurrentsBySn:
114
+ """Set charging pile household current setting according to SN
115
+
116
+ Args:
117
+ sys_sn (str): SN
118
+ currentsetting (float): Household current setup
119
+
120
+ Returns:
121
+ (response.EvChargerCurrentsBySn): response data
122
+ """
123
+
124
+ raw_response: dict = await self._post(
125
+ "https://openapi.alphaess.com/api/setEvChargerCurrentsBySn",
126
+ {"sysSn": sys_sn, "currentsetting": currentsetting},
127
+ )
128
+
129
+ return response.EvChargerCurrentsBySn(**raw_response)
130
+
131
+ @pydantic.validate_call
132
+ async def get_ev_charger_status_by_sn(
133
+ self, sys_sn: str, evcharger_sn: str
134
+ ) -> response.EvChargerStatusBySn:
135
+ """Obtain charging pile status according to SN+charging pile SN
136
+
137
+ Args:
138
+ sys_sn (str): sys SN
139
+ evcharger_sn (str): EV-charger SN
140
+
141
+ Returns:
142
+ (response.EvChargerStatusBySn): response data
143
+ """
144
+
145
+ raw_response: dict = await self._get(
146
+ "https://openapi.alphaess.com/api/getEvChargerStatusBySn",
147
+ {"sysSn": sys_sn, "evchargerSn": evcharger_sn},
148
+ )
149
+
150
+ return response.EvChargerStatusBySn(**raw_response)
151
+
152
+ @pydantic.validate_call
153
+ async def remote_control_ev_charger(
154
+ self, sys_sn: str, evcharger_sn: str, control_mode: int
155
+ ) -> response.ControlEvCharger:
156
+ """According to SN+ charging pile SN remote control charging pile to start charging/stop charging
157
+
158
+ Args:
159
+ sys_sn (str): sys sn
160
+ evcharger_sn (str): EV-charger SN
161
+ control_mode (int): 0-Stop Charging,1-Start Charging
162
+
163
+ Returns:
164
+ (response.ControlEvCharger): response data
165
+ """
166
+
167
+ raw_response: dict = await self._post(
168
+ "https://openapi.alphaess.com/api/remoteControlEvCharger",
169
+ {"sysSn": sys_sn, "evchargerSn": evcharger_sn, "controlMode": control_mode},
170
+ )
171
+
172
+ return response.ControlEvCharger(**raw_response)
173
+
174
+ @pydantic.validate_call
175
+ async def get_sum_data_for_customer(
176
+ self, sys_sn: str
177
+ ) -> response.SumDataForCustomer:
178
+ """According SN to get System Summary data
179
+
180
+ Args:
181
+ sys_sn (str): System S/N
182
+
183
+ Returns:
184
+ (response.SumDataForCustomer): response data
185
+ """
186
+
187
+ raw_response: dict = await self._get(
188
+ "https://openapi.alphaess.com/api/getSumDataForCustomer", {"sysSn": sys_sn}
189
+ )
190
+
191
+ return response.SumDataForCustomer(**raw_response)
192
+
193
+ @pydantic.validate_call
194
+ async def get_last_power_data(self, sys_sn: str) -> response.LastPowerData:
195
+ """Get real-time power data based on SN
196
+
197
+ Args:
198
+ sys_sn (str): system SN
199
+
200
+ Returns:
201
+ (response.LastPowerData): response data
202
+ """
203
+
204
+ raw_response: dict = await self._get(
205
+ "https://openapi.alphaess.com/api/getLastPowerData", {"sysSn": sys_sn}
206
+ )
207
+
208
+ return response.LastPowerData(**raw_response)
209
+
210
+ @pydantic.validate_call
211
+ async def get_one_day_power_by_sn(
212
+ self, query_date: str, sys_sn: str
213
+ ) -> response.OneDayPowerBySn:
214
+ """According SN to get system power data
215
+
216
+ Args:
217
+ query_date (str): Date,Format:yyyy-MM-dd
218
+ sys_sn (str): System S/N
219
+
220
+ Returns:
221
+ (response.OneDayPowerBySn): response data
222
+ """
223
+
224
+ raw_response: dict = await self._get(
225
+ "https://openapi.alphaess.com/api/getOneDayPowerBySn",
226
+ {"queryDate": query_date, "sysSn": sys_sn},
227
+ )
228
+
229
+ return response.OneDayPowerBySn(**raw_response)
230
+
231
+ @pydantic.validate_call
232
+ async def get_one_date_energy_by_sn(
233
+ self, query_date: str, sys_sn: str
234
+ ) -> response.OneDateEnergyBySn:
235
+ """According SN to get System Energy Data
236
+
237
+ Args:
238
+ query_date (str): Date,Format:yyyy-MM-dd
239
+ sys_sn (str): System S/N
240
+
241
+ Returns:
242
+ (response.OneDateEnergyBySn): response data
243
+ """
244
+
245
+ raw_response: dict = await self._get(
246
+ "https://openapi.alphaess.com/api/getOneDateEnergyBySn",
247
+ {"queryDate": query_date, "sysSn": sys_sn},
248
+ )
249
+
250
+ return response.OneDateEnergyBySn(**raw_response)
251
+
252
+ @pydantic.validate_call
253
+ async def get_charge_config_info(self, sys_sn: str) -> response.ChargeConfigInfo:
254
+ """According SN to get charging setting information
255
+
256
+ Args:
257
+ sys_sn (str): System S/N
258
+
259
+ Returns:
260
+ (response.ChargeConfigInfo): response data
261
+ """
262
+
263
+ raw_response: dict = await self._get(
264
+ "https://openapi.alphaess.com/api/getChargeConfigInfo", {"sysSn": sys_sn}
265
+ )
266
+
267
+ return response.ChargeConfigInfo(**raw_response)
268
+
269
+ @pydantic.validate_call
270
+ async def update_charge_config_info(
271
+ self,
272
+ sys_sn: str,
273
+ bat_high_cap: float,
274
+ grid_charge: int,
275
+ time_chae1: str,
276
+ time_chae2: str,
277
+ time_chaf1: str,
278
+ time_chaf2: str,
279
+ ) -> response.ChargeConfigInfo:
280
+ """According SN to Set charging information,Setting frequency 24 hours, set once a day
281
+
282
+ Args:
283
+ sys_sn (str): System S/N
284
+ bat_high_cap (float): Charging Stops at SOC [%]
285
+ grid_charge (int): Enable Grid Charging Battery
286
+ time_chae1 (str): Charging Period 1 end time, the time format is HH:mm, such as: 00:00, the maximum is 23:45, the minimum is 00:00, and the interval is 15 minutes, such as: 00:15, 00:30, 00:45, otherwise no effect
287
+ time_chae2 (str): Charging Period 2 end time, the time format is HH:mm, such as: 00:00, the maximum is 23:45, the minimum is 00:00, and the interval is 15 minutes, such as: 00:15, 00:30, 00:45, otherwise no effect
288
+ time_chaf1 (str): Charging Period 1 start time, the time format is HH:mm, such as: 00:00, the maximum is 23:45, the minimum is 00:00, and the interval is 15 minutes, such as: 00:15, 00:30, 00:45, otherwise no effect
289
+ time_chaf2 (str): Charging Period 2 start time, the time format is HH:mm, such as: 00:00, the maximum is 23:45, the minimum is 00:00, and the interval is 15 minutes, such as: 00:15, 00:30, 00:45, otherwise no effect
290
+
291
+ Returns:
292
+ (response.ChargeConfigInfo): response data
293
+ """
294
+
295
+ raw_response: dict = await self._post(
296
+ "https://openapi.alphaess.com/api/updateChargeConfigInfo",
297
+ {
298
+ "sysSn": sys_sn,
299
+ "batHighCap": bat_high_cap,
300
+ "gridCharge": grid_charge,
301
+ "timeChae1": time_chae1,
302
+ "timeChae2": time_chae2,
303
+ "timeChaf1": time_chaf1,
304
+ "timeChaf2": time_chaf2,
305
+ },
306
+ )
307
+
308
+ return response.ChargeConfigInfo(**raw_response)
309
+
310
+ @pydantic.validate_call
311
+ async def get_dis_charge_config_info(
312
+ self, sys_sn: str
313
+ ) -> response.DisChargeConfigInfo:
314
+ """According to SN discharge setting information
315
+
316
+ Args:
317
+ sys_sn (str): System S/N
318
+
319
+ Returns:
320
+ (response.DisChargeConfigInfo): response data
321
+ """
322
+
323
+ raw_response: dict = await self._get(
324
+ "https://openapi.alphaess.com/api/getDisChargeConfigInfo", {"sysSn": sys_sn}
325
+ )
326
+
327
+ return response.DisChargeConfigInfo(**raw_response)
328
+
329
+ @pydantic.validate_call
330
+ async def update_dis_charge_config_info(
331
+ self,
332
+ bat_use_cap: float,
333
+ ctr_dis: int,
334
+ time_dise1: str,
335
+ time_dise2: str,
336
+ time_disf1: str,
337
+ time_disf2: str,
338
+ sys_sn: str,
339
+ ) -> response.DisChargeConfigInfo:
340
+ """According to SN Set discharge information,Setting frequency 24 hours, set once a day
341
+
342
+ Args:
343
+ bat_use_cap (float): Discharging Cutoff SOC [%]
344
+ ctr_dis (int): Enable Battery Discharge Time Control
345
+ time_dise1 (str): Discharging Period 1 End time, the time format is HH:mm, such as: 00:00, the maximum is 23:45, the minimum is 00:00, and the interval is 15 minutes, such as: 00:15, 00:30, 00:45, otherwise no effect
346
+ time_dise2 (str): Discharging Period 2 End time, the time format is HH:mm, such as: 00:00, the maximum is 23:45, the minimum is 00:00, and the interval is 15 minutes, such as: 00:15, 00:30, 00:45, otherwise no effect
347
+ time_disf1 (str): Discharging Period 1 Start time, the time format is HH:mm, such as: 00:00, the maximum is 23:45, the minimum is 00:00, and the interval is 15 minutes, such as: 00:15, 00:30, 00:45, otherwise no effect
348
+ time_disf2 (str): Discharging Period 2 Start time, the time format is HH:mm, such as: 00:00, the maximum is 23:45, the minimum is 00:00, and the interval is 15 minutes, such as: 00:15, 00:30, 00:45, otherwise no effect
349
+ sys_sn (str): System S/N
350
+
351
+ Returns:
352
+ (response.DisChargeConfigInfo): response data
353
+ """
354
+
355
+ raw_response: dict = await self._post(
356
+ "https://openapi.alphaess.com/api/updateDisChargeConfigInfo",
357
+ {
358
+ "batUseCap": bat_use_cap,
359
+ "ctrDis": ctr_dis,
360
+ "timeDise1": time_dise1,
361
+ "timeDise2": time_dise2,
362
+ "timeDisf1": time_disf1,
363
+ "timeDisf2": time_disf2,
364
+ "sysSn": sys_sn,
365
+ },
366
+ )
367
+
368
+ return response.DisChargeConfigInfo(**raw_response)
369
+
370
+ @pydantic.validate_call
371
+ async def get_verification_code(
372
+ self, sys_sn: str, check_code: str
373
+ ) -> response.VerificationCode:
374
+ """According to SN get the check code according to SN
375
+
376
+ Args:
377
+ sys_sn (str): System S/N
378
+ check_code (str): checkCode
379
+
380
+ Returns:
381
+ (response.VerificationCode): response data
382
+ """
383
+
384
+ raw_response: dict = await self._get(
385
+ "https://openapi.alphaess.com/api/getVerificationCode",
386
+ {"sysSn": sys_sn, "checkCode": check_code},
387
+ )
388
+
389
+ return response.VerificationCode(**raw_response)
390
+
391
+ @pydantic.validate_call
392
+ async def bind_sn(self, sys_sn: str, code: str) -> response.Sn:
393
+ """According to SN and check code Bind the system bind the system
394
+
395
+ Args:
396
+ sys_sn (str): System S/N
397
+ code (str): Verification Code
398
+
399
+ Returns:
400
+ (response.Sn): response data
401
+ """
402
+
403
+ raw_response: dict = await self._post(
404
+ "https://openapi.alphaess.com/api/bindSn", {"sysSn": sys_sn, "code": code}
405
+ )
406
+
407
+ return response.Sn(**raw_response)
408
+
409
+ @pydantic.validate_call
410
+ async def un_bind_sn(self, sys_sn: str) -> response.BindSn:
411
+ """According to SN and check code Unbind the system
412
+
413
+ Args:
414
+ sys_sn (str): System S/N
415
+
416
+ Returns:
417
+ (response.BindSn): response data
418
+ """
419
+
420
+ raw_response: dict = await self._post(
421
+ "https://openapi.alphaess.com/api/unBindSn", {"sysSn": sys_sn}
422
+ )
423
+
424
+ return response.BindSn(**raw_response)
425
+
426
+ @pydantic.validate_call
427
+ async def get_ess_list(
428
+ self,
429
+ ) -> response.EssList:
430
+ """According to SN to get system list data
431
+
432
+ Args:
433
+
434
+
435
+ Returns:
436
+ (response.EssList): response data
437
+ """
438
+
439
+ raw_response: dict = await self._get(
440
+ "https://openapi.alphaess.com/api/getEssList", {}
441
+ )
442
+
443
+ return response.EssList(**raw_response)