cyrils / renogy-bt

Python library to read Renogy compatible BT-1 or BT-2 bluetooth modules
GNU General Public License v3.0
93 stars 39 forks source link

Possible to get error codes from battery? #93

Open nowcodingaway opened 5 days ago

nowcodingaway commented 5 days ago

Is it possible to get any errors that the battery might encounter?

E.g. over current protection, under current protection, low temperature shut off etc?

The intention is to replace the Renogy M1 / OneCore devices, but currently they would be the only way to know about an error and the battery can't be connected to more than one device at a time.

I didn't see anywhere that errors could be collected and reported on in the debug lots or code.

Would something like this work? Are these the correct registers?

 {'register': 5030, 'words': 1, 'parser': self.parse_battery_status},
 {'register': 5031, 'words': 1, 'parser': self.parse_alarm_status}

  def parse_battery_status(self, bs):
        status = bytes_to_int(bs, 0, 2)
        # Interpret the status bits as needed
        self.data['battery_status'] = status

    def parse_alarm_status(self, bs):
        alarm = bytes_to_int(bs, 0, 2)
        # Interpret the alarm bits as needed
        self.data['alarm_status'] = alarm
cyrils commented 5 days ago

Is this for RoverClient or BatteryClient?

nowcodingaway commented 5 days ago

For the battery. Specifically RBT200LFP12-BT

cyrils commented 5 days ago

Its more complicated than that. Each cell has alarm code. And two bits each represent code for a cell:

{'register': 5100, 'words': 2, 'parser': self.parse_cell_voltage_alarm}

Then each of those bits need to be parsed. Ex:

def parse_cell_voltage_alarm(self, bs):
       alarm_bytes = bs[3:4]
       # Interpret the alarm bits as needed
       # Bit0-Bit1: Cell 1 voltage alarm
       # Bit2-Bit3: Cell 2 voltage alarm
nowcodingaway commented 5 days ago

Thank you for at least taking some time to look into it and let me know.

Quite a bit above my beginner skills, so I will just make do without the errors for now, and if anything stops working, fire up the DC Home app and do a direct connection.