File tree Expand file tree Collapse file tree
packages/modules/devices/sonnen/sonnenbatterie Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -336,8 +336,15 @@ def update_battery(self, sim_counter: SimCounter) -> BatState:
336336 battery_state = self .__read_status ()
337337 battery_power = - battery_state ["Pac_total_W" ]
338338 battery_soc = battery_state ["USOC" ]
339+ # try to calculate the individual line currents as no data is provided by the API
340+ # we assume that the voltage is the same for all three phases
341+ # this is not correct, but we have no other way to get the currents
342+ # the current is calculated as apparent power / voltage
343+ battery_ac_voltage = battery_state ["Uac" ]
344+ currents = [battery_state [f"Sac{ phase } " ] / battery_ac_voltage for phase in range (1 , 4 )]
339345 imported , exported = sim_counter .sim_count (battery_power )
340346 return BatState (power = battery_power ,
347+ currents = currents ,
341348 soc = battery_soc ,
342349 imported = imported ,
343350 exported = exported )
You can’t perform that action at this time.
0 commit comments