Skip to content

Commit cea0b3f

Browse files
authored
fix satellite: phases in use (#2969)
1 parent 7da0665 commit cea0b3f

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

packages/modules/chargepoints/openwb_series2_satellit/chargepoint_module.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ def __init__(self, config: OpenWBseries2Satellit) -> None:
4242
f"openWB/set/chargepoint/{self.config.id}/get/error_timestamp", CP_ERROR, hide_exception=True)
4343
self._create_client()
4444
self._validate_version()
45+
self.old_phases_in_use = 3
4546

4647
def delay_second_cp(self, delay: float):
4748
if self.config.configuration.duo_num == 0:
@@ -82,12 +83,15 @@ def get_values(self) -> None:
8283
if self.version is False:
8384
self._validate_version()
8485

85-
currents = counter_state.currents
86-
phases_in_use = sum(1 for current in currents if current > 3)
86+
phases_in_use = sum(1 for current in counter_state.currents if current > 3)
87+
if phases_in_use == 0:
88+
phases_in_use = self.old_phases_in_use
89+
else:
90+
self.old_phases_in_use = phases_in_use
8791

8892
chargepoint_state = ChargepointState(
8993
power=counter_state.power,
90-
currents=currents,
94+
currents=counter_state.currents,
9195
imported=counter_state.imported,
9296
exported=0,
9397
voltages=counter_state.voltages,
@@ -106,7 +110,7 @@ def get_values(self) -> None:
106110
chargepoint_state = ChargepointState(
107111
plug_state=None, charge_state=False, imported=None,
108112
# bei im-/exported None werden keine Werte gepublished
109-
exported=None, phases_in_use=0, power=0, currents=[0]*3)
113+
exported=None, phases_in_use=self.old_phases_in_use, power=0, currents=[0]*3)
110114
self.store.set(chargepoint_state)
111115
except AttributeError:
112116
self._create_client()

0 commit comments

Comments
 (0)