@@ -20,7 +20,7 @@ def __init__(self, config: SmartWB) -> None:
2020 "Ladepunkt" , "chargepoint" ))
2121 self .client_error_context = ErrorTimerContext (
2222 f"openWB/set/chargepoint/{ self .config .id } /get/error_timestamp" , CP_ERROR , hide_exception = True )
23- self .phases_in_use = 1
23+ self .old_phases_in_use = 1
2424 self .session = req .get_http_session ()
2525
2626 def set_current (self , current : float ) -> None :
@@ -55,12 +55,11 @@ def get_values(self) -> None:
5555
5656 currents = [json_rsp ["currentP1" ], json_rsp ["currentP2" ], json_rsp ["currentP3" ]]
5757
58- if currents [2 ] > 3 :
59- self .phases_in_use = 3
60- elif currents [1 ] > 3 :
61- self .phases_in_use = 2
62- elif currents [0 ] > 3 :
63- self .phases_in_use = 1
58+ phases_in_use = sum (1 for current in currents if current > 3 )
59+ if phases_in_use == 0 :
60+ phases_in_use = self .old_phases_in_use
61+ else :
62+ self .old_phases_in_use = phases_in_use
6463
6564 if json_rsp .get ("voltageP1" ):
6665 voltages = [json_rsp ["voltageP1" ], json_rsp ["voltageP2" ], json_rsp ["voltageP3" ]]
@@ -86,7 +85,7 @@ def get_values(self) -> None:
8685 imported = json_rsp ["meterReading" ] * 1000 ,
8786 plug_state = plug_state ,
8887 charge_state = charge_state ,
89- phases_in_use = self . phases_in_use ,
88+ phases_in_use = phases_in_use ,
9089 voltages = voltages ,
9190 rfid = tag ,
9291 serial_number = mac ,
0 commit comments