python-openevse-http 0.3.4__py3-none-any.whl → 0.3.5__py3-none-any.whl
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.
- openevsehttp/commands.py +19 -26
- openevsehttp/const.py +2 -0
- {python_openevse_http-0.3.4.dist-info → python_openevse_http-0.3.5.dist-info}/METADATA +1 -1
- {python_openevse_http-0.3.4.dist-info → python_openevse_http-0.3.5.dist-info}/RECORD +7 -7
- {python_openevse_http-0.3.4.dist-info → python_openevse_http-0.3.5.dist-info}/WHEEL +1 -1
- {python_openevse_http-0.3.4.dist-info → python_openevse_http-0.3.5.dist-info}/licenses/LICENSE +0 -0
- {python_openevse_http-0.3.4.dist-info → python_openevse_http-0.3.5.dist-info}/top_level.txt +0 -0
openevsehttp/commands.py
CHANGED
|
@@ -12,7 +12,7 @@ from aiohttp.client_exceptions import ContentTypeError, ServerTimeoutError
|
|
|
12
12
|
from awesomeversion import AwesomeVersion
|
|
13
13
|
from awesomeversion.exceptions import AwesomeVersionCompareException
|
|
14
14
|
|
|
15
|
-
from .const import MAX_AMPS, MIN_AMPS, RAPI_ERRORS, divert_mode
|
|
15
|
+
from .const import MAX_AMPS, MIN_AMPS, RAPI_ERRORS, SUCCESS_ANSWERS, divert_mode
|
|
16
16
|
from .exceptions import UnknownError, UnsupportedFeature
|
|
17
17
|
from .utils import get_awesome_version
|
|
18
18
|
|
|
@@ -68,7 +68,7 @@ class CommandsMixin:
|
|
|
68
68
|
response = await self.process_request(url=url, method="post", data=data)
|
|
69
69
|
response = self._normalize_response(response)
|
|
70
70
|
msg = response.get("msg") if isinstance(response, Mapping) else None
|
|
71
|
-
if msg not in
|
|
71
|
+
if msg not in SUCCESS_ANSWERS:
|
|
72
72
|
_LOGGER.error("Problem issuing command: %s", response)
|
|
73
73
|
raise UnknownError
|
|
74
74
|
|
|
@@ -95,11 +95,10 @@ class CommandsMixin:
|
|
|
95
95
|
response = await self.process_request(url=url, method="post", data=data)
|
|
96
96
|
_LOGGER.debug("divert_mode response: %s", response)
|
|
97
97
|
normalized_response = self._normalize_response(response)
|
|
98
|
-
if
|
|
99
|
-
|
|
100
|
-
"
|
|
101
|
-
|
|
102
|
-
]:
|
|
98
|
+
if (
|
|
99
|
+
isinstance(normalized_response, dict)
|
|
100
|
+
and normalized_response.get("msg") in SUCCESS_ANSWERS
|
|
101
|
+
):
|
|
103
102
|
self._config["divert_enabled"] = mode
|
|
104
103
|
return normalized_response
|
|
105
104
|
|
|
@@ -172,11 +171,10 @@ class CommandsMixin:
|
|
|
172
171
|
response = await self.process_request(url=url, method="patch")
|
|
173
172
|
response = self._normalize_response(response)
|
|
174
173
|
_LOGGER.debug("Toggle response: %s", response)
|
|
175
|
-
if
|
|
176
|
-
|
|
177
|
-
"
|
|
178
|
-
|
|
179
|
-
]:
|
|
174
|
+
if (
|
|
175
|
+
not isinstance(response, Mapping)
|
|
176
|
+
or response.get("msg") not in SUCCESS_ANSWERS
|
|
177
|
+
):
|
|
180
178
|
_LOGGER.error("Problem toggling override: %s", response)
|
|
181
179
|
raise RuntimeError(f"Failed to toggle override: {response}")
|
|
182
180
|
else:
|
|
@@ -210,7 +208,7 @@ class CommandsMixin:
|
|
|
210
208
|
response = self._normalize_response(response)
|
|
211
209
|
msg = response.get("msg") if isinstance(response, Mapping) else None
|
|
212
210
|
_LOGGER.debug("Clear override response: %s", msg)
|
|
213
|
-
if msg not in
|
|
211
|
+
if msg not in SUCCESS_ANSWERS:
|
|
214
212
|
_LOGGER.error("Problem clearing override: %s", response)
|
|
215
213
|
raise RuntimeError(f"Failed to clear override: {response}")
|
|
216
214
|
|
|
@@ -236,11 +234,10 @@ class CommandsMixin:
|
|
|
236
234
|
_LOGGER.debug("Setting current limit to %s", amps)
|
|
237
235
|
response = await self.set_override(charge_current=amps)
|
|
238
236
|
_LOGGER.debug("Set current response: %s", response)
|
|
239
|
-
if
|
|
240
|
-
|
|
241
|
-
"
|
|
242
|
-
|
|
243
|
-
]:
|
|
237
|
+
if (
|
|
238
|
+
not isinstance(response, Mapping)
|
|
239
|
+
or response.get("msg") not in SUCCESS_ANSWERS
|
|
240
|
+
):
|
|
244
241
|
_LOGGER.error("Problem setting current limit: %s", response)
|
|
245
242
|
raise UnknownError
|
|
246
243
|
|
|
@@ -275,7 +272,7 @@ class CommandsMixin:
|
|
|
275
272
|
response = self._normalize_response(response)
|
|
276
273
|
_LOGGER.debug("service response: %s", response)
|
|
277
274
|
msg = response.get("msg") if isinstance(response, Mapping) else None
|
|
278
|
-
if msg not in
|
|
275
|
+
if msg not in SUCCESS_ANSWERS:
|
|
279
276
|
_LOGGER.error("Problem issuing command: %s", response)
|
|
280
277
|
raise UnknownError
|
|
281
278
|
|
|
@@ -448,7 +445,7 @@ class CommandsMixin:
|
|
|
448
445
|
response = await self.process_request(url=url, method="post", data=data)
|
|
449
446
|
response = self._normalize_response(response)
|
|
450
447
|
msg = response.get("msg") if isinstance(response, Mapping) else None
|
|
451
|
-
if msg not in
|
|
448
|
+
if msg not in SUCCESS_ANSWERS:
|
|
452
449
|
_LOGGER.error("Problem issuing command: %s", response)
|
|
453
450
|
raise UnknownError
|
|
454
451
|
|
|
@@ -470,11 +467,7 @@ class CommandsMixin:
|
|
|
470
467
|
res_lower = response.lower()
|
|
471
468
|
if "divert" in res_lower and "changed" in res_lower:
|
|
472
469
|
success = True
|
|
473
|
-
elif isinstance(response, dict) and response.get("msg") in
|
|
474
|
-
"OK",
|
|
475
|
-
"done",
|
|
476
|
-
"no change",
|
|
477
|
-
]:
|
|
470
|
+
elif isinstance(response, dict) and response.get("msg") in SUCCESS_ANSWERS:
|
|
478
471
|
success = True
|
|
479
472
|
|
|
480
473
|
if not success:
|
|
@@ -497,7 +490,7 @@ class CommandsMixin:
|
|
|
497
490
|
response = await self.process_request(url=url, method="post", rapi=data)
|
|
498
491
|
response = self._normalize_response(response)
|
|
499
492
|
msg = response.get("msg") if isinstance(response, Mapping) else None
|
|
500
|
-
if msg not in
|
|
493
|
+
if msg not in SUCCESS_ANSWERS and msg != "Current Shaper state changed":
|
|
501
494
|
_LOGGER.error("Problem issuing command: %s", response)
|
|
502
495
|
raise UnknownError
|
|
503
496
|
|
openevsehttp/const.py
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
openevsehttp/__init__.py,sha256=I6a1mjOZHYiWb_qfCuDuFLOOncrkkB_7uwybtOIujfY,1165
|
|
2
2
|
openevsehttp/__main__.py,sha256=EHmSdT7GjAVvHQxvLBTjZXsj_V5SB6B2_kpgUAT7mPM,146
|
|
3
3
|
openevsehttp/client.py,sha256=JBAC1jJGdzOabVAqHv8x6EJDVjhaW4t7Iwqn4lDWhwE,17502
|
|
4
|
-
openevsehttp/commands.py,sha256=
|
|
5
|
-
openevsehttp/const.py,sha256=
|
|
4
|
+
openevsehttp/commands.py,sha256=lANhgVhtJJlQxLwFlMrxk3DrmnY2bXK5h4z3o9o6ZEk,20617
|
|
5
|
+
openevsehttp/const.py,sha256=y-2hGv_PCal_-VCSGC7IIyzQYtfeVdq3MjOhBWIdZvc,1440
|
|
6
6
|
openevsehttp/exceptions.py,sha256=bqz-tHTW1AYJMKcm0s5M6z5tA6XZgjnCiBLW1XrZ_70,672
|
|
7
7
|
openevsehttp/managers.py,sha256=kEX1ZD9u-FY0UEZJsxeFEGBSGzSlkbBc0kmxCiMJtJw,5373
|
|
8
8
|
openevsehttp/properties.py,sha256=QVSyn_5a7vI1b4TdnnToRdw6veVCfnp7a19VYit95hg,17107
|
|
9
9
|
openevsehttp/sensors.py,sha256=sJP2FPnU1Lk5S3VUyFT14JM1nKEBQPsjl-DiZI-pZrs,4673
|
|
10
10
|
openevsehttp/utils.py,sha256=e3HH_jwZgb1iBWJgIoMOM0JPrQNwXyVdOx5vTWOh4T0,858
|
|
11
11
|
openevsehttp/websocket.py,sha256=Mi_WFmlT3-9i6bbHIN6ua09SD8CpIle2vRXB3HyWzmM,10066
|
|
12
|
-
python_openevse_http-0.3.
|
|
13
|
-
python_openevse_http-0.3.
|
|
14
|
-
python_openevse_http-0.3.
|
|
15
|
-
python_openevse_http-0.3.
|
|
16
|
-
python_openevse_http-0.3.
|
|
12
|
+
python_openevse_http-0.3.5.dist-info/licenses/LICENSE,sha256=hSB6TOQ7rmwSGb6XzqRjDGMvmUj5_GlacqQin3tegtA,11341
|
|
13
|
+
python_openevse_http-0.3.5.dist-info/METADATA,sha256=3VxDib4FCHGZ3QODauCoWzXQiPggRx_7q8yRvCwa7G8,4363
|
|
14
|
+
python_openevse_http-0.3.5.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
15
|
+
python_openevse_http-0.3.5.dist-info/top_level.txt,sha256=u8RUkoEIE33Cjn6gmqiEoVpZ0VZ59WJ3FXBwwOg0CPE,13
|
|
16
|
+
python_openevse_http-0.3.5.dist-info/RECORD,,
|
{python_openevse_http-0.3.4.dist-info → python_openevse_http-0.3.5.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
|
File without changes
|