python-hilo 2024.1.2__tar.gz → 2024.2.2__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-hilo
3
- Version: 2024.1.2
3
+ Version: 2024.2.2
4
4
  Summary: A Python3, async interface to the Hilo API
5
5
  Home-page: https://github.com/dvd-dev/python-hilo
6
6
  License: MIT
@@ -19,6 +19,7 @@ from pyhilo.const import (
19
19
  ANDROID_CLIENT_HOSTNAME,
20
20
  ANDROID_CLIENT_POST,
21
21
  API_AUTOMATION_ENDPOINT,
22
+ API_CHALLENGE_ENDPOINT,
22
23
  API_EVENTS_ENDPOINT,
23
24
  API_GD_SERVICE_ENDPOINT,
24
25
  API_HOSTNAME,
@@ -379,6 +380,7 @@ class API:
379
380
  gd: bool = False,
380
381
  drms: bool = False,
381
382
  events: bool = False,
383
+ challenge: bool = False,
382
384
  ) -> str:
383
385
  """Generate a path to the requested endpoint.
384
386
 
@@ -390,6 +392,8 @@ class API:
390
392
  :type gd: bool, optional
391
393
  :param drms: Whether or not we should prepend the path with DRMS path, defaults to False
392
394
  :type drms: bool, optional
395
+ :param challenge: Whether or not we should prepend the path with challenge path, defaults to False
396
+ :type challenge: bool, optional
393
397
  :return: Path to the requested endpoint
394
398
  :rtype: str
395
399
  """
@@ -400,6 +404,8 @@ class API:
400
404
  base += "/DRMS"
401
405
  if events:
402
406
  base = API_EVENTS_ENDPOINT + API_NOTIFICATIONS_ENDPOINT
407
+ if challenge:
408
+ base = API_CHALLENGE_ENDPOINT
403
409
  url = base + "/Locations/" + str(location_id)
404
410
  if endpoint:
405
411
  url += "/" + str(endpoint)
@@ -740,7 +746,7 @@ class API:
740
746
 
741
747
  async def get_seasons(self, location_id: int) -> dict[str, Any]:
742
748
  """This will return the rewards and current season total
743
- https://apim.hiloenergie.com/Automation/v1/api/DRMS/Locations/XXXX/Seasons
749
+ https://api.hiloenergie.com/challenge/v1/api/Locations/XXXX/Seasons
744
750
  [
745
751
  {
746
752
  "season": 2021,
@@ -757,7 +763,7 @@ class API:
757
763
  }
758
764
  ]
759
765
  """
760
- url = self._get_url("Seasons", location_id, drms=True)
766
+ url = self._get_url("Seasons", location_id, challenge=True)
761
767
  return cast(dict[str, Any], await self.async_request("get", url))
762
768
 
763
769
  async def get_gateway(self, location_id: int) -> dict[str, Any]:
@@ -34,6 +34,7 @@ SUBSCRIPTION_KEY: Final = "20eeaedcb86945afa3fe792cea89b8bf"
34
34
  API_HOSTNAME: Final = "api.hiloenergie.com"
35
35
  API_END: Final = "v1/api"
36
36
  API_AUTOMATION_ENDPOINT: Final = f"/Automation/{API_END}"
37
+ API_CHALLENGE_ENDPOINT: Final = f"/challenge/{API_END}"
37
38
  API_GD_SERVICE_ENDPOINT: Final = f"/GDService/{API_END}"
38
39
  API_NOTIFICATIONS_ENDPOINT: Final = "/Notifications"
39
40
  API_EVENTS_ENDPOINT: Final = "/Notifications"
@@ -246,6 +247,7 @@ HILO_PROVIDERS: Final = {
246
247
 
247
248
  JASCO_MODELS: Final = [
248
249
  "43082",
250
+ "43076",
249
251
  "43078",
250
252
  "43100",
251
253
  "46199",
@@ -262,3 +264,8 @@ JASCO_OUTLETS: Final = [
262
264
  "43100",
263
265
  "45853",
264
266
  ]
267
+
268
+ UNMONITORED_DEVICES: Final = [
269
+ "43076",
270
+ "43100",
271
+ ]
@@ -5,6 +5,8 @@ from dataclasses import dataclass, field
5
5
  from datetime import datetime
6
6
  from typing import TYPE_CHECKING, Any, Dict, Union, cast
7
7
 
8
+ from homeassistant.const import STATE_UNKNOWN
9
+
8
10
  from pyhilo.const import (
9
11
  HILO_DEVICE_ATTRIBUTES,
10
12
  HILO_LIST_ATTRIBUTES,
@@ -150,7 +152,7 @@ class HiloDevice:
150
152
  return next((True for k in self.supported_attributes if k.attr == attr), False)
151
153
 
152
154
  def get_value(
153
- self, attribute: str, default: Union[str, int, float, None] = None
155
+ self, attribute: str, default: Union[str, int, float, None] = STATE_UNKNOWN
154
156
  ) -> Any:
155
157
  attr = self.get_attribute(attribute)
156
158
  return attr.value if attr else default
@@ -40,7 +40,7 @@ exclude = ".venv/.*"
40
40
 
41
41
  [tool.poetry]
42
42
  name = "python-hilo"
43
- version = "2024.1.2"
43
+ version = "2024.2.2"
44
44
  description = "A Python3, async interface to the Hilo API"
45
45
  readme = "README.md"
46
46
  authors = ["David Vallee Delisle <me@dvd.dev>"]
@@ -80,11 +80,11 @@ Sphinx = "^7.1.2"
80
80
  aresponses = "^3.0.0"
81
81
  asynctest = "^0.13.0"
82
82
  pre-commit = "^3.2.2"
83
- pytest = "^7.2.0"
83
+ pytest = "^8.0.0"
84
84
  pytest-aiohttp = "^1.0.4"
85
85
  pytest-cov = "^4.0.0"
86
86
  sphinx-rtd-theme = "^2.0.0"
87
- types-pytz = "^2023.3.0"
87
+ types-pytz = "^2024.1.0"
88
88
 
89
89
  [tool.pylint.BASIC]
90
90
  expected-line-ending-format = "LF"
File without changes
File without changes