python-openevse-http 0.1.76__tar.gz → 0.1.78__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python_openevse_http
3
- Version: 0.1.76
3
+ Version: 0.1.78
4
4
  Summary: Python wrapper for OpenEVSE HTTP API
5
5
  Home-page: https://github.com/firstof9/python-openevse-http
6
6
  Author: firstof9
@@ -15,6 +15,7 @@ Classifier: Programming Language :: Python :: 3
15
15
  Classifier: Programming Language :: Python :: 3.10
16
16
  Classifier: Programming Language :: Python :: 3.11
17
17
  Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
18
19
  Requires-Python: >=3.10
19
20
  Description-Content-Type: text/markdown
20
21
 
@@ -242,8 +242,8 @@ class OpenEVSE:
242
242
 
243
243
  if not self._ws_listening:
244
244
  _LOGGER.debug("Setting up websocket ping...")
245
- self._loop.create_task(self.repeat(300, self.websocket.keepalive))
246
245
  self._loop.create_task(self.websocket.listen())
246
+ self._loop.create_task(self.repeat(300, self.websocket.keepalive))
247
247
  pending = asyncio.all_tasks()
248
248
  self._ws_listening = True
249
249
  try:
@@ -268,7 +268,7 @@ class OpenEVSE:
268
268
  # Stopped websockets without errors are expected during shutdown
269
269
  # and ignored
270
270
  elif data == STATE_STOPPED and error:
271
- _LOGGER.error(
271
+ _LOGGER.debug(
272
272
  "Websocket to %s failed, aborting [Error: %s]",
273
273
  self.websocket.uri,
274
274
  error,
@@ -296,11 +296,6 @@ class OpenEVSE:
296
296
  self._ws_listening = False
297
297
  assert self.websocket
298
298
  await self.websocket.close()
299
- if self._loop:
300
- try:
301
- self._loop.cancel()
302
- except AttributeError:
303
- pass
304
299
 
305
300
  def is_coroutine_function(self, callback):
306
301
  """Check if a callback is a coroutine function."""
@@ -320,7 +315,7 @@ class OpenEVSE:
320
315
 
321
316
  *args and **kwargs are passed as the arguments to func.
322
317
  """
323
- while True:
318
+ while self.ws_state != "stopped":
324
319
  await asyncio.sleep(interval)
325
320
  await func(*args, **kwargs)
326
321
 
@@ -964,7 +959,9 @@ class OpenEVSE:
964
959
  except UnsupportedFeature:
965
960
  pass
966
961
  if claims is not None and "charge_current" in claims["properties"].keys():
967
- return claims["properties"]["charge_current"]
962
+ return min(
963
+ claims["properties"]["charge_current"], self._config["max_current_hard"]
964
+ )
968
965
  if self._config is not None and "max_current_soft" in self._config:
969
966
  return self._config["max_current_soft"]
970
967
  return self._status["pilot"]
@@ -2,7 +2,6 @@
2
2
 
3
3
  import asyncio
4
4
  import datetime
5
- import json
6
5
  import logging
7
6
 
8
7
  import aiohttp # type: ignore
@@ -154,14 +153,19 @@ class OpenEVSEWebsocket:
154
153
  self._error_reason = ERROR_PING_TIMEOUT
155
154
  await OpenEVSEWebsocket.state.fset(self, STATE_DISCONNECTED)
156
155
 
157
- data = json.dumps({"ping": 1})
156
+ data = {"ping": 1}
158
157
  _LOGGER.debug("Sending message: %s to websocket.", data)
159
158
  try:
160
- await self._client.send_str(data)
159
+ await self._client.send_json(data)
161
160
  self._ping = datetime.datetime.now()
162
161
  _LOGGER.debug("Ping message sent.")
163
162
  except TypeError as err:
164
163
  _LOGGER.error("Attempt to send ping data failed: %s", err)
164
+ except ValueError as err:
165
+ _LOGGER.error("Error parsing data: %s", err)
166
+ except RuntimeError as err:
167
+ _LOGGER.debug("Websocket connection issue: %s", err)
168
+ await OpenEVSEWebsocket.state.fset(self, STATE_DISCONNECTED)
165
169
  except Exception as err: # pylint: disable=broad-exception-caught
166
- _LOGGER.error("Problem sending ping request: %s", err)
170
+ _LOGGER.debug("Problem sending ping request: %s", err)
167
171
  await OpenEVSEWebsocket.state.fset(self, STATE_DISCONNECTED)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-openevse-http
3
- Version: 0.1.76
3
+ Version: 0.1.78
4
4
  Summary: Python wrapper for OpenEVSE HTTP API
5
5
  Home-page: https://github.com/firstof9/python-openevse-http
6
6
  Author: firstof9
@@ -15,6 +15,7 @@ Classifier: Programming Language :: Python :: 3
15
15
  Classifier: Programming Language :: Python :: 3.10
16
16
  Classifier: Programming Language :: Python :: 3.11
17
17
  Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
18
19
  Requires-Python: >=3.10
19
20
  Description-Content-Type: text/markdown
20
21
 
@@ -6,7 +6,7 @@ from setuptools import find_packages, setup
6
6
 
7
7
  PROJECT_DIR = Path(__file__).parent.resolve()
8
8
  README_FILE = PROJECT_DIR / "README.md"
9
- VERSION = "0.1.76"
9
+ VERSION = "0.1.78"
10
10
 
11
11
  setup(
12
12
  name="python_openevse_http",
@@ -32,5 +32,6 @@ setup(
32
32
  "Programming Language :: Python :: 3.10",
33
33
  "Programming Language :: Python :: 3.11",
34
34
  "Programming Language :: Python :: 3.12",
35
+ "Programming Language :: Python :: 3.13",
35
36
  ],
36
37
  )