python-openevse-http 1.0.0__py3-none-any.whl → 1.0.2__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 CHANGED
@@ -50,13 +50,13 @@ class OpenEVSE(CommandsMixin, ManagersMixin, SensorsMixin, PropertiesMixin):
50
50
  def __init__(
51
51
  self,
52
52
  host: str,
53
- user: str = "",
54
- pwd: str = "",
53
+ user: str | None = None,
54
+ pwd: str | None = None,
55
55
  session: aiohttp.ClientSession | None = None,
56
56
  ) -> None:
57
57
  """Connect to an OpenEVSE charger equipped with wifi or ethernet."""
58
- self._user = user
59
- self._pwd = pwd
58
+ self._user = user or ""
59
+ self._pwd = pwd or ""
60
60
  self.url = f"http://{host}/"
61
61
  self._status: dict[str, Any] = {}
62
62
  self._config: dict[str, Any] = {}
@@ -84,9 +84,12 @@ class PropertiesMixin:
84
84
  return bool(self._config.get("relayt", False))
85
85
 
86
86
  @property
87
- def service_level(self) -> int | str | None:
88
- """Return the service level (1, 2, or 'A')."""
89
- return self._config.get("service")
87
+ def service_level(self) -> str | None:
88
+ """Return the service level ('1', '2', or 'A')."""
89
+ value = self._config.get("service")
90
+ if value is None:
91
+ return value
92
+ return str(value)
90
93
 
91
94
  @property
92
95
  def openevse_firmware(self) -> str | None:
openevsehttp/utils.py CHANGED
@@ -18,8 +18,34 @@ def normalize_version(version: str) -> str:
18
18
 
19
19
 
20
20
  def get_awesome_version(version: str) -> AwesomeVersion:
21
- """Parse and normalize the version string, returning an AwesomeVersion."""
22
- if "master" in version:
21
+ """Parse and normalize the version string, returning an AwesomeVersion.
22
+
23
+ Development and custom firmware versions (e.g. branch builds ending in a commit hash,
24
+ or standalone 'main'/'master' builds) are normalized to 'dev' to bypass feature flags
25
+ and version-checks.
26
+
27
+ Non-dev version strings are normalized by extracting the first stable 'X.Y.Z' match,
28
+ meaning pre-release, build, or other trailing tags (such as '_rc1' or '_alpha') are
29
+ removed and not preserved in the returned version.
30
+ """
31
+ # Match non-numeric git branch names (e.g. 'main', 'master', 'develop', or 'feature-x_abc123456')
32
+ # We use custom word boundary checks to avoid false positives like 'domain' matching 'main'
33
+ # or 'webmaster' matching 'master'.
34
+ is_dev = False
35
+ if re.search(
36
+ r"(?:^|[^a-zA-Z0-9])(master|main)(?:[^a-zA-Z0-9]|$)", version, re.IGNORECASE
37
+ ):
38
+ is_dev = True
39
+ elif re.search(r"_[a-fA-F0-9]{7,40}$", version):
40
+ is_dev = True
41
+ elif re.search(
42
+ r"(?:^|[^a-zA-Z0-9])(dev|feature|fix|main|master)(?:[^a-zA-Z0-9].*?)?_[a-fA-F0-9]{6}$",
43
+ version,
44
+ re.IGNORECASE,
45
+ ):
46
+ is_dev = True
47
+
48
+ if is_dev:
23
49
  version = "dev"
24
50
  value = normalize_version(version)
25
51
  if "dev" not in version:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python_openevse_http
3
- Version: 1.0.0
3
+ Version: 1.0.2
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,17 @@
1
1
  openevsehttp/__init__.py,sha256=I6a1mjOZHYiWb_qfCuDuFLOOncrkkB_7uwybtOIujfY,1165
2
2
  openevsehttp/__main__.py,sha256=EHmSdT7GjAVvHQxvLBTjZXsj_V5SB6B2_kpgUAT7mPM,146
3
- openevsehttp/client.py,sha256=tw8MGwraUVn5ERbQCR6JRWEvMRc7KnUgJvf_0viOQHo,18983
3
+ openevsehttp/client.py,sha256=dSvlotG7xxgnDxkI_o2KtIddVw58y6ZgIdJa9gu-WnU,19013
4
4
  openevsehttp/commands.py,sha256=JGxjmGvE2-eUJ1gD76y_701Qk3Kzab-6XtGeaXXDSb0,27243
5
5
  openevsehttp/const.py,sha256=9jVzW4CZz7uP7VKbGQT4v0jNeP5PPC55tR-jnG11ODA,1646
6
6
  openevsehttp/exceptions.py,sha256=bqz-tHTW1AYJMKcm0s5M6z5tA6XZgjnCiBLW1XrZ_70,672
7
7
  openevsehttp/managers.py,sha256=EtQMQziwhoZeqKe2zWY-0yS7zedhuYjYtL5j9xBBCZ0,5380
8
- openevsehttp/properties.py,sha256=psGGiRacHYs1YYmagiWSlpfua-SnpU2nCviEYDZX0V8,17892
8
+ openevsehttp/properties.py,sha256=xbQfx256FZwNPPn9ryWWOMKliyCChq4ZaTH9NDQVR_8,17968
9
9
  openevsehttp/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  openevsehttp/sensors.py,sha256=yO4Q1sgJkvmfOi5dpoTwEoldsrpqgGz0k9fC7mFWass,4680
11
- openevsehttp/utils.py,sha256=e3HH_jwZgb1iBWJgIoMOM0JPrQNwXyVdOx5vTWOh4T0,858
11
+ openevsehttp/utils.py,sha256=Q4I_rmh8UdD-DVAZxfb95VBdUl5jtSEE1DHqRxkktUE,1938
12
12
  openevsehttp/websocket.py,sha256=dOSemvm7CM5pFb9RaoJSTIM6Tf5xtWMLEBEccKlBUKI,10517
13
- python_openevse_http-1.0.0.dist-info/licenses/LICENSE,sha256=hSB6TOQ7rmwSGb6XzqRjDGMvmUj5_GlacqQin3tegtA,11341
14
- python_openevse_http-1.0.0.dist-info/METADATA,sha256=fYgJfqxD6zmc8b540T6jStiE1AKNUmkqSC2vmHHHRjo,4417
15
- python_openevse_http-1.0.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
16
- python_openevse_http-1.0.0.dist-info/top_level.txt,sha256=u8RUkoEIE33Cjn6gmqiEoVpZ0VZ59WJ3FXBwwOg0CPE,13
17
- python_openevse_http-1.0.0.dist-info/RECORD,,
13
+ python_openevse_http-1.0.2.dist-info/licenses/LICENSE,sha256=hSB6TOQ7rmwSGb6XzqRjDGMvmUj5_GlacqQin3tegtA,11341
14
+ python_openevse_http-1.0.2.dist-info/METADATA,sha256=aTPqaY0mhzUFNc0Z_uBCSnxlX4azB0YFEAupqd8KbFw,4417
15
+ python_openevse_http-1.0.2.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
16
+ python_openevse_http-1.0.2.dist-info/top_level.txt,sha256=u8RUkoEIE33Cjn6gmqiEoVpZ0VZ59WJ3FXBwwOg0CPE,13
17
+ python_openevse_http-1.0.2.dist-info/RECORD,,