diff --git a/etc/dbus-serialbattery/bms/battery_template.py b/etc/dbus-serialbattery/bms/battery_template.py index 4b308ab7..e6148e65 100644 --- a/etc/dbus-serialbattery/bms/battery_template.py +++ b/etc/dbus-serialbattery/bms/battery_template.py @@ -26,6 +26,9 @@ def test_connection(self): result = False try: result = self.read_status_data() + # get first data to show in startup log + if result: + self.refresh_data() except Exception as err: logger.error(f"Unexpected {err=}, {type(err)=}") result = False diff --git a/etc/dbus-serialbattery/bms/ecs.py b/etc/dbus-serialbattery/bms/ecs.py index 41065b7e..a50e6072 100644 --- a/etc/dbus-serialbattery/bms/ecs.py +++ b/etc/dbus-serialbattery/bms/ecs.py @@ -46,6 +46,9 @@ def test_connection(self): self.find_LiPro_cells() + # get first data to show in startup log + self.refresh_data() + return self.get_settings() except IOError: return False diff --git a/etc/dbus-serialbattery/bms/hlpdatabms4s.py b/etc/dbus-serialbattery/bms/hlpdatabms4s.py index 6fcbc6b0..3f99aa8e 100644 --- a/etc/dbus-serialbattery/bms/hlpdatabms4s.py +++ b/etc/dbus-serialbattery/bms/hlpdatabms4s.py @@ -7,8 +7,8 @@ class HLPdataBMS4S(Battery): - def __init__(self, port, baud): - super(HLPdataBMS4S, self).__init__(port, baud) + def __init__(self, port, baud, address): + super(HLPdataBMS4S, self).__init__(port, baud, address) self.type = self.BATTERYTYPE BATTERYTYPE = "HLPdataBMS4S" diff --git a/etc/dbus-serialbattery/bms/lltjbd.py b/etc/dbus-serialbattery/bms/lltjbd.py index 09486e68..8b34c920 100644 --- a/etc/dbus-serialbattery/bms/lltjbd.py +++ b/etc/dbus-serialbattery/bms/lltjbd.py @@ -67,6 +67,9 @@ def test_connection(self): result = False try: result = self.read_hardware_data() + # get first data to show in startup log + if result: + self.refresh_data() except Exception as err: logger.error(f"Unexpected {err=}, {type(err)=}") result = False @@ -155,7 +158,7 @@ def read_gen_data(self): ) = unpack_from(">HhHHHHhHHBBBBB", gen_data) self.voltage = voltage / 100 self.current = current / 100 - self.soc = 100 * capacity_remain / capacity + self.soc = round(100 * capacity_remain / capacity, 0) self.capacity_remain = capacity_remain / 100 self.capacity = capacity / 100 self.to_cell_bits(balance, balance2) diff --git a/etc/dbus-serialbattery/bms/renogy.py b/etc/dbus-serialbattery/bms/renogy.py index 64dee151..acfe2335 100644 --- a/etc/dbus-serialbattery/bms/renogy.py +++ b/etc/dbus-serialbattery/bms/renogy.py @@ -47,6 +47,9 @@ def test_connection(self): result = False try: result = self.read_gen_data() + # get first data to show in startup log + if result: + self.refresh_data() except Exception as err: logger.error(f"Unexpected {err=}, {type(err)=}") result = False diff --git a/etc/dbus-serialbattery/bms/revov.py b/etc/dbus-serialbattery/bms/revov.py index b0eb65bf..17764989 100755 --- a/etc/dbus-serialbattery/bms/revov.py +++ b/etc/dbus-serialbattery/bms/revov.py @@ -54,8 +54,12 @@ def test_connection(self): result = False try: result = self.read_gen_data() - except: - pass + # get first data to show in startup log + if result: + self.refresh_data() + except Exception as err: + logger.error(f"Unexpected {err=}, {type(err)=}") + result = False return result