diff --git a/dbus-serialbattery/battery.py b/dbus-serialbattery/battery.py index fcdc9273..3fd1db74 100644 --- a/dbus-serialbattery/battery.py +++ b/dbus-serialbattery/battery.py @@ -1641,6 +1641,8 @@ def get_midvoltage(self) -> Tuple[Union[float, None], Union[float, None]]: extra = 0 if self.cell_count % 2 == 0 else self.cells[halfcount].voltage / 2 # get the midpoint of the battery midpoint = half1voltage + extra + if (half2voltage + half1voltage) == 0: + return None, None return ( abs(midpoint), abs((half2voltage - half1voltage) / (half2voltage + half1voltage) * 100),