@@ -28,8 +28,8 @@ def __init__(self, **event: dict[str, Any]):
28
28
params : dict [str , Any ] = event .get ("parameters" , {})
29
29
devices : list [dict [str , Any ]] = params .get ("devices" , [])
30
30
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
33
33
self .participating : bool = cast (bool , event .get ("isParticipating" , False ))
34
34
self .configurable : bool = cast (bool , event .get ("isConfigurable" , False ))
35
35
self .period : str = cast (str , event .get ("period" , "" ))
@@ -39,12 +39,12 @@ def __init__(self, **event: dict[str, Any]):
39
39
self .pre_heat_devices : int = len ([x for x in devices if x ["preheat" ]])
40
40
self .progress : str = cast (str , event .get ("progress" , "unknown" ))
41
41
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 )
44
44
self .used_percentage : float = 0
45
45
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 )
48
48
self ._phase_time_mapping = {
49
49
"pre_heat" : "preheat" ,
50
50
}
@@ -63,10 +63,10 @@ def __init__(self, **event: dict[str, Any]):
63
63
"last_update" ,
64
64
]
65
65
66
- def update_wh (self , used_Wh : float ) -> None :
66
+ def update_wh (self , used_wH : float ) -> None :
67
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 )
68
+ LOG .debug (f"Updating Wh: { used_wH } " )
69
+ self .used_kWh = round (used_wH / 1000 , 2 )
70
70
self .last_update = datetime .now (timezone .utc ).astimezone ()
71
71
72
72
def should_check_for_allowed_wh (self ) -> bool :
0 commit comments