python-hilo 2025.2.1__tar.gz → 2025.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.
- {python_hilo-2025.2.1 → python_hilo-2025.2.2}/PKG-INFO +2 -2
- {python_hilo-2025.2.1 → python_hilo-2025.2.2}/pyhilo/api.py +1 -1
- {python_hilo-2025.2.1 → python_hilo-2025.2.2}/pyhilo/const.py +1 -1
- {python_hilo-2025.2.1 → python_hilo-2025.2.2}/pyhilo/event.py +18 -0
- {python_hilo-2025.2.1 → python_hilo-2025.2.2}/pyhilo/util/__init__.py +0 -4
- {python_hilo-2025.2.1 → python_hilo-2025.2.2}/pyproject.toml +2 -2
- {python_hilo-2025.2.1 → python_hilo-2025.2.2}/LICENSE +0 -0
- {python_hilo-2025.2.1 → python_hilo-2025.2.2}/README.md +0 -0
- {python_hilo-2025.2.1 → python_hilo-2025.2.2}/pyhilo/__init__.py +0 -0
- {python_hilo-2025.2.1 → python_hilo-2025.2.2}/pyhilo/device/__init__.py +0 -0
- {python_hilo-2025.2.1 → python_hilo-2025.2.2}/pyhilo/device/climate.py +0 -0
- {python_hilo-2025.2.1 → python_hilo-2025.2.2}/pyhilo/device/light.py +0 -0
- {python_hilo-2025.2.1 → python_hilo-2025.2.2}/pyhilo/device/sensor.py +0 -0
- {python_hilo-2025.2.1 → python_hilo-2025.2.2}/pyhilo/device/switch.py +0 -0
- {python_hilo-2025.2.1 → python_hilo-2025.2.2}/pyhilo/devices.py +0 -0
- {python_hilo-2025.2.1 → python_hilo-2025.2.2}/pyhilo/exceptions.py +0 -0
- {python_hilo-2025.2.1 → python_hilo-2025.2.2}/pyhilo/oauth2.py +0 -0
- {python_hilo-2025.2.1 → python_hilo-2025.2.2}/pyhilo/util/state.py +0 -0
- {python_hilo-2025.2.1 → python_hilo-2025.2.2}/pyhilo/websocket.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: python-hilo
|
|
3
|
-
Version: 2025.2.
|
|
3
|
+
Version: 2025.2.2
|
|
4
4
|
Summary: A Python3, async interface to the Hilo API
|
|
5
5
|
License: MIT
|
|
6
6
|
Author: David Vallee Delisle
|
|
@@ -29,7 +29,7 @@ Requires-Dist: backoff (>=1.11.1)
|
|
|
29
29
|
Requires-Dist: python-dateutil (>=2.8.2)
|
|
30
30
|
Requires-Dist: ruyaml (>=0.91.0)
|
|
31
31
|
Requires-Dist: voluptuous (>=0.13.1)
|
|
32
|
-
Requires-Dist: websockets (>=8.1,<
|
|
32
|
+
Requires-Dist: websockets (>=8.1,<16.0)
|
|
33
33
|
Project-URL: Repository, https://github.com/dvd-dev/python-hilo
|
|
34
34
|
Description-Content-Type: text/markdown
|
|
35
35
|
|
|
@@ -385,7 +385,7 @@ class API:
|
|
|
385
385
|
# instantiate differently
|
|
386
386
|
self.websocket_devices = WebsocketClient(self.websocket_manager.devicehub)
|
|
387
387
|
|
|
388
|
-
# For backward compatibility during the transition to challengehub websocket
|
|
388
|
+
# For backward compatibility during the transition to challengehub websocket
|
|
389
389
|
self.websocket = self.websocket_devices
|
|
390
390
|
self.websocket_challenges = WebsocketClient(self.websocket_manager.challengehub)
|
|
391
391
|
|
|
@@ -8,7 +8,7 @@ import homeassistant.core
|
|
|
8
8
|
LOG: Final = logging.getLogger(__package__)
|
|
9
9
|
DEFAULT_STATE_FILE: Final = "hilo_state.yaml"
|
|
10
10
|
REQUEST_RETRY: Final = 9
|
|
11
|
-
PYHILO_VERSION: Final = "2025.2.
|
|
11
|
+
PYHILO_VERSION: Final = "2025.2.02"
|
|
12
12
|
# TODO: Find a way to keep previous line in sync with pyproject.toml automatically
|
|
13
13
|
|
|
14
14
|
CONTENT_TYPE_FORM: Final = "application/x-www-form-urlencoded"
|
|
@@ -10,6 +10,7 @@ LOG = logging.getLogger(__package__)
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
class Event:
|
|
13
|
+
"""This class is used to populate the data of a Hilo Challenge Event, contains datetime info and consumption data"""
|
|
13
14
|
setting_deadline: datetime
|
|
14
15
|
pre_cold_start: datetime
|
|
15
16
|
pre_cold_end: datetime
|
|
@@ -62,6 +63,20 @@ class Event:
|
|
|
62
63
|
"last_update",
|
|
63
64
|
]
|
|
64
65
|
|
|
66
|
+
def update_wh(self, used_wH: float) -> None:
|
|
67
|
+
"""This function is used to update the used_kWh attribute during a Hilo Challenge Event"""
|
|
68
|
+
LOG.debug(f"Updating Wh: {used_wH}")
|
|
69
|
+
self.used_kWh = round(used_wH / 1000, 2)
|
|
70
|
+
self.last_update = datetime.now(timezone.utc).astimezone()
|
|
71
|
+
|
|
72
|
+
def should_check_for_allowed_wh(self) -> bool:
|
|
73
|
+
"""This function is used to authorize subscribing to a specific event in Hilo to receive the allowed_kWh
|
|
74
|
+
that is made available in the pre_heat phase"""
|
|
75
|
+
now = datetime.now(self.preheat_start.tzinfo)
|
|
76
|
+
time_since_preheat_start = (self.preheat_start - now).total_seconds()
|
|
77
|
+
already_has_allowed_wh = self.allowed_kWh > 0
|
|
78
|
+
return 1800 <= time_since_preheat_start <= 2700 and not already_has_allowed_wh
|
|
79
|
+
|
|
65
80
|
def as_dict(self) -> dict[str, Any]:
|
|
66
81
|
rep = {k: getattr(self, k) for k in self.dict_items}
|
|
67
82
|
rep["phases"] = {k: getattr(self, k) for k in self.phases_list}
|
|
@@ -69,6 +84,7 @@ class Event:
|
|
|
69
84
|
return rep
|
|
70
85
|
|
|
71
86
|
def _convert_phases(self, phases: dict[str, Any]) -> None:
|
|
87
|
+
"""Formats phase times for later use"""
|
|
72
88
|
self.phases_list = []
|
|
73
89
|
for key, value in phases.items():
|
|
74
90
|
phase_match = re.match(r"(.*)(DateUTC|Utc)", key)
|
|
@@ -89,6 +105,7 @@ class Event:
|
|
|
89
105
|
def _create_phases(
|
|
90
106
|
self, hours: int, phase_name: str, parent_phase: str
|
|
91
107
|
) -> datetime:
|
|
108
|
+
"""Creates optional "appreciation" and "pre_cold" phases according to Hilo phases datetimes"""
|
|
92
109
|
parent_start = getattr(self, f"{parent_phase}_start")
|
|
93
110
|
phase_start = f"{phase_name}_start"
|
|
94
111
|
phase_end = f"{phase_name}_end"
|
|
@@ -128,6 +145,7 @@ class Event:
|
|
|
128
145
|
|
|
129
146
|
@property
|
|
130
147
|
def state(self) -> str:
|
|
148
|
+
"""Defines state in the next_event attribute"""
|
|
131
149
|
now = datetime.now(self.preheat_start.tzinfo)
|
|
132
150
|
if self.pre_cold_start and self.pre_cold_start <= now < self.pre_cold_end:
|
|
133
151
|
return "pre_cold"
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"""Define utility modules."""
|
|
2
2
|
import asyncio
|
|
3
3
|
from datetime import datetime, timedelta
|
|
4
|
-
import logging
|
|
5
4
|
import re
|
|
6
5
|
from typing import Any, Callable
|
|
7
6
|
|
|
@@ -10,9 +9,6 @@ from dateutil.parser import parse
|
|
|
10
9
|
|
|
11
10
|
from pyhilo.const import LOG # noqa: F401
|
|
12
11
|
|
|
13
|
-
LOG = logging.getLogger(__package__)
|
|
14
|
-
|
|
15
|
-
|
|
16
12
|
CAMEL_REX_1 = re.compile("(.)([A-Z][a-z]+)")
|
|
17
13
|
CAMEL_REX_2 = re.compile("([a-z0-9])([A-Z])")
|
|
18
14
|
|
|
@@ -40,7 +40,7 @@ exclude = ".venv/.*"
|
|
|
40
40
|
|
|
41
41
|
[tool.poetry]
|
|
42
42
|
name = "python-hilo"
|
|
43
|
-
version = "2025.2.
|
|
43
|
+
version = "2025.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>"]
|
|
@@ -74,7 +74,7 @@ python-dateutil = ">=2.8.2"
|
|
|
74
74
|
ruyaml = ">=0.91.0"
|
|
75
75
|
python = "^3.9.0"
|
|
76
76
|
voluptuous = ">=0.13.1"
|
|
77
|
-
websockets = ">=8.1,<
|
|
77
|
+
websockets = ">=8.1,<16.0"
|
|
78
78
|
|
|
79
79
|
[tool.poetry.dev-dependencies]
|
|
80
80
|
Sphinx = "^7.1.2"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|