Skip to content

Commit 9bf575a

Browse files
committed
New allowed_wh function
1 parent 5feba11 commit 9bf575a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pyhilo/event.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ def update_wh(self, used_wH: float) -> None:
7171
self.used_kWh = round(used_wH / 1000, 2)
7272
self.last_update = datetime.now(timezone.utc).astimezone()
7373

74+
def update_allowed_wh(self, allowed_wH: float) -> None:
75+
"""This function is used to update the allowed_kWh attribute during a Hilo Challenge Event"""
76+
LOG.debug("Updating allowed Wh: %s", allowed_wH)
77+
self.allowed_kWh = round(allowed_wH / 1000, 2)
78+
self.last_update = datetime.now(timezone.utc).astimezone()
79+
7480
def should_check_for_allowed_wh(self) -> bool:
7581
"""This function is used to authorize subscribing to a specific event in Hilo to receive the allowed_kWh
7682
that is made available in the pre_heat phase"""

0 commit comments

Comments
 (0)