From 17e84e214a8cb3efd73fbae212090b939ca98165 Mon Sep 17 00:00:00 2001 From: Manuel Date: Thu, 21 Sep 2023 11:39:38 +0200 Subject: [PATCH] fixes LLT/JBD SOC > 100% https://github.com/Louisvdw/dbus-serialbattery/issues/769 --- etc/dbus-serialbattery/bms/lltjbd.py | 3 ++- etc/dbus-serialbattery/utils.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/etc/dbus-serialbattery/bms/lltjbd.py b/etc/dbus-serialbattery/bms/lltjbd.py index 0d1bbfd9..5c658fac 100644 --- a/etc/dbus-serialbattery/bms/lltjbd.py +++ b/etc/dbus-serialbattery/bms/lltjbd.py @@ -552,7 +552,8 @@ def read_gen_data(self): ) = unpack_from(">HhHHHHhHHBBBBB", gen_data) self.voltage = voltage / 100 self.current = current / 100 - if not self.cycle_capacity: + # https://github.com/Louisvdw/dbus-serialbattery/issues/769#issuecomment-1720805325 + if not self.cycle_capacity or self.cycle_capacity < capacity_remain: self.cycle_capacity = capacity self.soc = round(100 * capacity_remain / self.cycle_capacity, 2) self.capacity_remain = capacity_remain / 100 diff --git a/etc/dbus-serialbattery/utils.py b/etc/dbus-serialbattery/utils.py index e9220e2a..69481ca9 100644 --- a/etc/dbus-serialbattery/utils.py +++ b/etc/dbus-serialbattery/utils.py @@ -38,7 +38,7 @@ def _get_list_from_config( # Constants -DRIVER_VERSION = "1.0.20230919dev" +DRIVER_VERSION = "1.0.20230921dev" zero_char = chr(48) degree_sign = "\N{DEGREE SIGN}"