diff --git a/packages/modules/devices/sonnen/sonnenbatterie/api.py b/packages/modules/devices/sonnen/sonnenbatterie/api.py index f43b336347..3ce3ecf450 100644 --- a/packages/modules/devices/sonnen/sonnenbatterie/api.py +++ b/packages/modules/devices/sonnen/sonnenbatterie/api.py @@ -341,10 +341,12 @@ def update_battery(self, sim_counter: SimCounter) -> BatState: # this is not correct, but we have no other way to get the currents # the current is calculated as apparent power / voltage battery_ac_voltage = battery_state["Uac"] - currents = [battery_state[f"Sac{phase}"] / battery_ac_voltage for phase in range(1, 4)] + currents = [float(battery_state[f"Sac{phase}"]) / battery_ac_voltage + if battery_state[f"Sac{phase}"] else None + for phase in range(1, 4)] imported, exported = sim_counter.sim_count(battery_power) return BatState(power=battery_power, - currents=currents, + currents=currents if None not in currents else None, soc=battery_soc, imported=imported, exported=exported)