Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Renogy.unique_identifier method to allow multiple batteries #1017

Merged
merged 1 commit into from
Mar 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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