Skip to content

Commit 3616ea4

Browse files
committed
Undo case, not backward compatible
1 parent f4ccafb commit 3616ea4

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

pyhilo/event.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ def __init__(self, **event: dict[str, Any]):
2828
params: dict[str, Any] = event.get("parameters", {})
2929
devices: list[dict[str, Any]] = params.get("devices", [])
3030
consumption: dict[str, Any] = event.get("consumption", {})
31-
allowed_Wh: int = consumption.get("baselineWh", 0) or 0
32-
used_Wh: int = consumption.get("currentWh", 0) or 0
31+
allowed_wH: int = consumption.get("baselineWh", 0) or 0
32+
used_wH: int = consumption.get("currentWh", 0) or 0
3333
self.participating: bool = cast(bool, event.get("isParticipating", False))
3434
self.configurable: bool = cast(bool, event.get("isConfigurable", False))
3535
self.period: str = cast(str, event.get("period", ""))
@@ -39,12 +39,12 @@ def __init__(self, **event: dict[str, Any]):
3939
self.pre_heat_devices: int = len([x for x in devices if x["preheat"]])
4040
self.progress: str = cast(str, event.get("progress", "unknown"))
4141
self.mode: str = cast(str, params.get("mode", "Unknown"))
42-
self.allowed_kWh: float = round(allowed_Wh / 1000, 2)
43-
self.used_kWh: float = round(used_Wh / 1000, 2)
42+
self.allowed_kWh: float = round(allowed_wH / 1000, 2)
43+
self.used_kWh: float = round(used_wH / 1000, 2)
4444
self.used_percentage: float = 0
4545
self.last_update = datetime.now(timezone.utc).astimezone()
46-
if allowed_Wh > 0:
47-
self.used_percentage = round(used_Wh / allowed_Wh * 100, 2)
46+
if allowed_wH > 0:
47+
self.used_percentage = round(used_wH / allowed_wH * 100, 2)
4848
self._phase_time_mapping = {
4949
"pre_heat": "preheat",
5050
}
@@ -63,10 +63,10 @@ def __init__(self, **event: dict[str, Any]):
6363
"last_update",
6464
]
6565

66-
def update_wh(self, used_Wh: float) -> None:
66+
def update_wh(self, used_wH: float) -> None:
6767
"""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)
68+
LOG.debug(f"Updating Wh: {used_wH}")
69+
self.used_kWh = round(used_wH / 1000, 2)
7070
self.last_update = datetime.now(timezone.utc).astimezone()
7171

7272
def should_check_for_allowed_wh(self) -> bool:

0 commit comments

Comments
 (0)