Skip to content

Commit

Permalink
Merge pull request #1017 from sstoops/master
Browse files Browse the repository at this point in the history
Add `Renogy.unique_identifier` method to allow multiple batteries
  • Loading branch information
mr-manuel authored Mar 22, 2024
2 parents 9dd5747 + 3cdf3db commit 50d7595
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions etc/dbus-serialbattery/bms/renogy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 50d7595

Please sign in to comment.