python-openevse-http 1.7.0__py3-none-any.whl → 1.7.1__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/client.py +6 -4
- openevsehttp/commands_core.py +19 -5
- {python_openevse_http-1.7.0.dist-info → python_openevse_http-1.7.1.dist-info}/METADATA +1 -1
- {python_openevse_http-1.7.0.dist-info → python_openevse_http-1.7.1.dist-info}/RECORD +7 -7
- {python_openevse_http-1.7.0.dist-info → python_openevse_http-1.7.1.dist-info}/WHEEL +0 -0
- {python_openevse_http-1.7.0.dist-info → python_openevse_http-1.7.1.dist-info}/licenses/LICENSE +0 -0
- {python_openevse_http-1.7.0.dist-info → python_openevse_http-1.7.1.dist-info}/top_level.txt +0 -0
openevsehttp/client.py
CHANGED
|
@@ -26,6 +26,7 @@ from .const import (
|
|
|
26
26
|
from .exceptions import (
|
|
27
27
|
AlreadyListening,
|
|
28
28
|
AuthenticationError,
|
|
29
|
+
CommandFailedError,
|
|
29
30
|
MissingMethod,
|
|
30
31
|
MissingSerial,
|
|
31
32
|
ParseJSONError,
|
|
@@ -186,15 +187,16 @@ class OpenEVSE(CommandsMixin, ManagersMixin, SensorsMixin, PropertiesMixin):
|
|
|
186
187
|
|
|
187
188
|
if resp.status == 400:
|
|
188
189
|
if isinstance(response_content, dict) and "msg" in response_content:
|
|
189
|
-
|
|
190
|
+
msg = str(response_content["msg"])
|
|
190
191
|
elif (
|
|
191
192
|
isinstance(response_content, dict)
|
|
192
193
|
and "error" in response_content
|
|
193
194
|
):
|
|
194
|
-
|
|
195
|
+
msg = str(response_content["error"])
|
|
195
196
|
else:
|
|
196
|
-
|
|
197
|
-
|
|
197
|
+
msg = str(response_content)
|
|
198
|
+
_LOGGER.error("Error 400: %s", msg)
|
|
199
|
+
raise CommandFailedError(msg)
|
|
198
200
|
if resp.status == 401:
|
|
199
201
|
_LOGGER.error("Authentication error: %s", response_content)
|
|
200
202
|
raise AuthenticationError
|
openevsehttp/commands_core.py
CHANGED
|
@@ -271,17 +271,31 @@ class CoreCommandsMixin(BaseCommandMixin):
|
|
|
271
271
|
|
|
272
272
|
# Strict success check:
|
|
273
273
|
# 1. Must be a Mapping
|
|
274
|
-
# 2. Must have
|
|
275
|
-
# 3. Must
|
|
276
|
-
#
|
|
274
|
+
# 2. Must NOT have an "error" key
|
|
275
|
+
# 3. Must have "result" in ("OK", "ok", True) OR "success" is True
|
|
276
|
+
# OR "msg" indicating restart acknowledgment ("restart gateway", "ok")
|
|
277
277
|
success = (
|
|
278
278
|
isinstance(response, Mapping)
|
|
279
|
-
and (response.get("result") == "OK" or response.get("success") is True)
|
|
280
279
|
and not response.get("error")
|
|
280
|
+
and (
|
|
281
|
+
response.get("result") in ("OK", "ok", True)
|
|
282
|
+
or response.get("success") is True
|
|
283
|
+
or (
|
|
284
|
+
isinstance(response.get("msg"), str)
|
|
285
|
+
and any(
|
|
286
|
+
val in response["msg"].lower()
|
|
287
|
+
for val in ("ok", "restart gateway")
|
|
288
|
+
)
|
|
289
|
+
)
|
|
290
|
+
)
|
|
281
291
|
)
|
|
282
292
|
if success and isinstance(response, Mapping) and "msg" in response:
|
|
283
293
|
msg_val = str(response["msg"]).lower()
|
|
284
|
-
if
|
|
294
|
+
if (
|
|
295
|
+
msg_val != "ok"
|
|
296
|
+
and "ok" not in msg_val
|
|
297
|
+
and "restart gateway" not in msg_val
|
|
298
|
+
):
|
|
285
299
|
success = False
|
|
286
300
|
|
|
287
301
|
if not success:
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
openevsehttp/__init__.py,sha256=QeXl80ozsK6J9PN-jB_83Bde31YXFGgLuUdmArpZAMM,1363
|
|
2
2
|
openevsehttp/__main__.py,sha256=EHmSdT7GjAVvHQxvLBTjZXsj_V5SB6B2_kpgUAT7mPM,146
|
|
3
|
-
openevsehttp/client.py,sha256=
|
|
3
|
+
openevsehttp/client.py,sha256=DRiFOtXEznthZCfD5AGwI6isHMkCd7iiwFgo1W_nux8,22482
|
|
4
4
|
openevsehttp/commands.py,sha256=l9mxdfgpeYzM1M6NPr0KLIaTtTsU10vzcKG1S7Z6O1M,918
|
|
5
5
|
openevsehttp/commands_base.py,sha256=DnHnB-rAI7zLDIMkL66epct6KnjLsm9OhlRFlOojREI,1934
|
|
6
|
-
openevsehttp/commands_core.py,sha256=
|
|
6
|
+
openevsehttp/commands_core.py,sha256=jZZJpD9XolKW0A_1eeec_nB5Kzfbcjih18N7WI_uLvI,18941
|
|
7
7
|
openevsehttp/commands_diagnostics.py,sha256=j23LX0cB9lb2UBkOpmJjNSBQm87AQijlP6qxotAmiTw,9894
|
|
8
8
|
openevsehttp/commands_firmware.py,sha256=Ej_EdO8z4arA8wkqfORC0Q_zO9qi7SlC2NmPme03Llg,10308
|
|
9
9
|
openevsehttp/commands_schedule.py,sha256=kBZp6hPt1qNjoZUVkhRhzB9pXlA--W1UQkQYzxEFQgw,5995
|
|
@@ -17,8 +17,8 @@ openevsehttp/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
17
17
|
openevsehttp/sensors.py,sha256=XrAaL66jkZqh2IjYXpQI5SJc84GduanBmnbCpbta8lA,5797
|
|
18
18
|
openevsehttp/utils.py,sha256=fPUWL64gFTRw4TtV4WITDAFMJ75VjNhPBaU6diwVlv0,2019
|
|
19
19
|
openevsehttp/websocket.py,sha256=yMuLNsB2qYZLtfYRW7-D7NH7rv-qaSTp7F79OajKm_0,10790
|
|
20
|
-
python_openevse_http-1.7.
|
|
21
|
-
python_openevse_http-1.7.
|
|
22
|
-
python_openevse_http-1.7.
|
|
23
|
-
python_openevse_http-1.7.
|
|
24
|
-
python_openevse_http-1.7.
|
|
20
|
+
python_openevse_http-1.7.1.dist-info/licenses/LICENSE,sha256=hSB6TOQ7rmwSGb6XzqRjDGMvmUj5_GlacqQin3tegtA,11341
|
|
21
|
+
python_openevse_http-1.7.1.dist-info/METADATA,sha256=5Ymc7plftTfZ9tmIhBRTJws0s9kpIU7KDrVzdYWLQQo,7011
|
|
22
|
+
python_openevse_http-1.7.1.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
23
|
+
python_openevse_http-1.7.1.dist-info/top_level.txt,sha256=u8RUkoEIE33Cjn6gmqiEoVpZ0VZ59WJ3FXBwwOg0CPE,13
|
|
24
|
+
python_openevse_http-1.7.1.dist-info/RECORD,,
|
|
File without changes
|
{python_openevse_http-1.7.0.dist-info → python_openevse_http-1.7.1.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
|
File without changes
|