python-openevse-http 1.4.0__py3-none-any.whl → 1.5.0__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 CHANGED
@@ -667,3 +667,23 @@ class CommandsMixin:
667
667
 
668
668
  new_state = not bool(shaper_active)
669
669
  await self.set_shaper(new_state)
670
+
671
+ async def set_mqtt_vehicle_range_miles(self, enable: bool = True) -> None:
672
+ """Set mqtt_vehicle_range_miles configuration setting.
673
+
674
+ Dynamically changing this setting will affect future evaluations of
675
+ the vehicle_range_with_unit property.
676
+ """
677
+ if not isinstance(enable, bool):
678
+ raise TypeError("Value must be a boolean.")
679
+
680
+ url = f"{self.url}config"
681
+ data = {"mqtt_vehicle_range_miles": enable}
682
+
683
+ _LOGGER.debug("Setting mqtt_vehicle_range_miles to %s", enable)
684
+ response = await self.process_request(url=url, method="post", data=data)
685
+ response = self._normalize_response(response)
686
+ msg = response.get("msg") if isinstance(response, Mapping) else None
687
+ if msg not in SUCCESS_ANSWERS:
688
+ _LOGGER.error("Problem issuing command: %s", response)
689
+ raise UnknownError
@@ -3,6 +3,7 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  import logging
6
+ import warnings
6
7
  from collections.abc import Mapping
7
8
  from datetime import datetime, timedelta, timezone
8
9
  from typing import Any, cast
@@ -458,11 +459,33 @@ class PropertiesMixin:
458
459
  @property
459
460
  def vehicle_range(self) -> int | None:
460
461
  """Return battery range."""
462
+ warnings.warn(
463
+ "vehicle_range is deprecated, use vehicle_range_with_unit instead",
464
+ DeprecationWarning,
465
+ stacklevel=2,
466
+ )
461
467
  return cast(
462
468
  "int | None",
463
469
  self._status.get("vehicle_range", self._status.get("battery_range", None)),
464
470
  )
465
471
 
472
+ @property
473
+ def vehicle_range_with_unit(self) -> tuple[int, str] | None:
474
+ """Return battery range and its unit."""
475
+ value = cast(
476
+ "int | None",
477
+ self._status.get("vehicle_range", self._status.get("battery_range", None)),
478
+ )
479
+ if value is None:
480
+ return None
481
+ unit = "miles" if self.mqtt_vehicle_range_miles else "km"
482
+ return (value, unit)
483
+
484
+ @property
485
+ def mqtt_vehicle_range_miles(self) -> bool:
486
+ """Return True if mqtt vehicle range is in miles, False if km."""
487
+ return bool(self._config.get("mqtt_vehicle_range_miles", False))
488
+
466
489
  @property
467
490
  def vehicle_eta(self) -> datetime | None:
468
491
  """Return time to full charge."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python_openevse_http
3
- Version: 1.4.0
3
+ Version: 1.5.0
4
4
  Summary: Python wrapper for OpenEVSE HTTP API
5
5
  Home-page: https://github.com/firstof9/python-openevse-http
6
6
  Download-URL: https://github.com/firstof9/python-openevse-http
@@ -1,17 +1,19 @@
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=bySzhJ9SKU0IN7-QQfW7_ZrKNw-EoPV4RvnRBXtmCQ8,19326
4
- openevsehttp/commands.py,sha256=OFPreBlsXUViwvjbVsD_0bmLv9ZSWqHnwdo2lBqdrSs,27278
4
+ openevsehttp/commands.py,sha256=G6KjZpwRhjhdxFBh5Sa8jm_jjGQdoFzSf9kTMZfBhGk,28162
5
5
  openevsehttp/const.py,sha256=-frkFduu8hxEBab9FnwA3D65XHrsyH0W7P9miYsWh90,1726
6
6
  openevsehttp/exceptions.py,sha256=bqz-tHTW1AYJMKcm0s5M6z5tA6XZgjnCiBLW1XrZ_70,672
7
7
  openevsehttp/managers.py,sha256=EtQMQziwhoZeqKe2zWY-0yS7zedhuYjYtL5j9xBBCZ0,5380
8
- openevsehttp/properties.py,sha256=xbQfx256FZwNPPn9ryWWOMKliyCChq4ZaTH9NDQVR_8,17968
8
+ openevsehttp/properties.py,sha256=9AJeKatU4fVknLigdrF2n6Ny3DpvOQgbZgc5qpHVbnA,18785
9
9
  openevsehttp/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  openevsehttp/sensors.py,sha256=zhQSToY_Zp2rOhPnUXT40xS5ZnUavqNGLm4zAFiUUrY,5717
11
11
  openevsehttp/utils.py,sha256=fPUWL64gFTRw4TtV4WITDAFMJ75VjNhPBaU6diwVlv0,2019
12
12
  openevsehttp/websocket.py,sha256=yMuLNsB2qYZLtfYRW7-D7NH7rv-qaSTp7F79OajKm_0,10790
13
- python_openevse_http-1.4.0.dist-info/licenses/LICENSE,sha256=hSB6TOQ7rmwSGb6XzqRjDGMvmUj5_GlacqQin3tegtA,11341
14
- python_openevse_http-1.4.0.dist-info/METADATA,sha256=uQBdZBdNAnWvyuwoWpgJYjBDlxUAoDxot4LANe6TZTY,5411
15
- python_openevse_http-1.4.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
16
- python_openevse_http-1.4.0.dist-info/top_level.txt,sha256=u8RUkoEIE33Cjn6gmqiEoVpZ0VZ59WJ3FXBwwOg0CPE,13
17
- python_openevse_http-1.4.0.dist-info/RECORD,,
13
+ python_openevse_http-1.5.0.dist-info/licenses/LICENSE,sha256=hSB6TOQ7rmwSGb6XzqRjDGMvmUj5_GlacqQin3tegtA,11341
14
+ python_openevse_http-1.5.0.dist-info/METADATA,sha256=XvBR5zmlCjmOAg3TKzCnPoU_ekbRVA4sZq7MJLmcopo,5411
15
+ python_openevse_http-1.5.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
16
+ python_openevse_http-1.5.0.dist-info/scm_file_list.json,sha256=KTMxbP5zijLSBJD3NZtpfxkBeLpQgSO29uMi_dGoiEQ,2264
17
+ python_openevse_http-1.5.0.dist-info/scm_version.json,sha256=4_Kgqqqxd2ojwG9gdRVIBboF5UHJBn44SJHF9gqAcBw,160
18
+ python_openevse_http-1.5.0.dist-info/top_level.txt,sha256=u8RUkoEIE33Cjn6gmqiEoVpZ0VZ59WJ3FXBwwOg0CPE,13
19
+ python_openevse_http-1.5.0.dist-info/RECORD,,
@@ -0,0 +1,70 @@
1
+ {
2
+ "files": [
3
+ ".pre-commit-config.yaml",
4
+ ".yamllint",
5
+ "README.md",
6
+ "EXTERNAL_SESSION.md",
7
+ "tox.ini",
8
+ "requirements_lint.txt",
9
+ "requirements_test.txt",
10
+ "LICENSE",
11
+ "setup.py",
12
+ "pyproject.toml",
13
+ "requirements.txt",
14
+ "codecov.yml",
15
+ ".gitignore",
16
+ "example_external_session.py",
17
+ "openevsehttp/py.typed",
18
+ "openevsehttp/__init__.py",
19
+ "openevsehttp/const.py",
20
+ "openevsehttp/exceptions.py",
21
+ "openevsehttp/utils.py",
22
+ "openevsehttp/client.py",
23
+ "openevsehttp/websocket.py",
24
+ "openevsehttp/managers.py",
25
+ "openevsehttp/properties.py",
26
+ "openevsehttp/sensors.py",
27
+ "openevsehttp/commands.py",
28
+ "openevsehttp/__main__.py",
29
+ "tests/__init__.py",
30
+ "tests/test_managers.py",
31
+ "tests/test_client.py",
32
+ "tests/test_main_edge_cases.py",
33
+ "tests/test_shaper.py",
34
+ "tests/test_commands.py",
35
+ "tests/conftest.py",
36
+ "tests/test_external_session.py",
37
+ "tests/test_mixins.py",
38
+ "tests/test_websocket.py",
39
+ "tests/test_properties.py",
40
+ "tests/test_sensors.py",
41
+ "tests/common.py",
42
+ "tests/fixtures/github_v4.json",
43
+ "tests/fixtures/github_v2.json",
44
+ "tests/fixtures/websocket.json",
45
+ "tests/fixtures/v2_json/config.json",
46
+ "tests/fixtures/v2_json/status.json",
47
+ "tests/fixtures/v4_json/config-broken-semver.json",
48
+ "tests/fixtures/v4_json/status-new.json",
49
+ "tests/fixtures/v4_json/status-broken.json",
50
+ "tests/fixtures/v4_json/config-broken.json",
51
+ "tests/fixtures/v4_json/config-dev.json",
52
+ "tests/fixtures/v4_json/schedule.json",
53
+ "tests/fixtures/v4_json/config.json",
54
+ "tests/fixtures/v4_json/config-unknown-semver.json",
55
+ "tests/fixtures/v4_json/config-new.json",
56
+ "tests/fixtures/v4_json/config-extra-version.json",
57
+ "tests/fixtures/v4_json/status.json",
58
+ ".github/release-drafter.yml",
59
+ ".github/pull_request_template.md",
60
+ ".github/dependabot.yml",
61
+ ".github/ISSUE_TEMPLATE/bug_report.yml",
62
+ ".github/ISSUE_TEMPLATE/config.yml",
63
+ ".github/ISSUE_TEMPLATE/feature_request.yml",
64
+ ".github/workflows/test.yml",
65
+ ".github/workflows/autolabeler.yml",
66
+ ".github/workflows/release-drafter.yml",
67
+ ".github/workflows/links.yml",
68
+ ".github/workflows/publish-to-pypi.yml"
69
+ ]
70
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "tag": "1.5.0",
3
+ "distance": 0,
4
+ "node": "g1f850ad2b147d75315538154ce50b42e8ad81319",
5
+ "dirty": false,
6
+ "branch": "HEAD",
7
+ "node_date": "2026-06-23"
8
+ }