diff --git a/etc/dbus-serialbattery/bms/renogy.py b/etc/dbus-serialbattery/bms/renogy.py index a1a94628..f4ee3aab 100644 --- a/etc/dbus-serialbattery/bms/renogy.py +++ b/etc/dbus-serialbattery/bms/renogy.py @@ -41,6 +41,10 @@ def __init__(self, port, baud, address): ) # BMS warning and protection config + + def unique_identifier(self) -> str: + return self.serial_number + def test_connection(self): # call a function that will connect to the battery, send a command and retrieve the result. # The result or call should be unique to this BMS. Battery name or version, etc. @@ -125,6 +129,9 @@ def read_gen_data(self): capacity = self.read_serial_data_renogy(self.command_capacity) self.capacity = unpack(">L", capacity)[0] / 1000.0 + serial_number = self.read_serial_data_renogy(self.command_serial_number) + self.serial_number = unpack("16s", serial_number)[0].decode("utf-8") + return True def read_soc_data(self):