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 @@ -341,10 +341,12 @@ def update_battery(self, sim_counter: SimCounter) -> BatState:
341341 # this is not correct, but we have no other way to get the currents
342342 # the current is calculated as apparent power / voltage
343343 battery_ac_voltage = battery_state ["Uac" ]
344- currents = [battery_state [f"Sac{ phase } " ] / battery_ac_voltage for phase in range (1 , 4 )]
344+ currents = [float (battery_state [f"Sac{ phase } " ]) / battery_ac_voltage
345+ if battery_state [f"Sac{ phase } " ] else None
346+ for phase in range (1 , 4 )]
345347 imported , exported = sim_counter .sim_count (battery_power )
346348 return BatState (power = battery_power ,
347- currents = currents ,
349+ currents = currents if None not in currents else None ,
348350 soc = battery_soc ,
349351 imported = imported ,
350352 exported = exported )
You can’t perform that action at this time.
0 commit comments