Open KevinEeckman opened 2 years ago
fixes #28
Hi thanks for investing the effort to create the PR. I like your changes and also that you've created some tests.
Regarding your open question about the max_responses
, I have two reasons to believe that the old values are a good choice:
Each unit voltage of 2 byte, according to the actual number of units sent, a maximum of 96 byte, divided into 16 frames sent
self.logger.debug("got %s" % result)
in daly_bms_bluetooth.py
, it gives me 16 bytearrays:got [bytearray(b'\x01\x0f\xa2\x0f\xf7\x0f\xec\xed'), bytearray(b'\x02\x0f\xd7\x0f\xc2\x0f\xdb\xed'), bytearray(b'\x03\x0f\xd4\x0f\xe1\x10*\xed'), bytearray(b'\x04\x0f\xb1\x0f\x9a\x0f\xb3\xed'), bytearray(b'\x05\x0f\xcc\x0f\xb5\x00\x00\xed'), bytearray(b'\x06\x00\x00\x00\x00\x00\x00\xed'), bytearray(b'\x07\x00\x00\x00\x00\x00\x00\xed'), bytearray(b'\x08\x00\x00\x00\x00\x00\x00\xed'), bytearray(b'\t\x00\x00\x00\x00\x00\x00\xed'), bytearray(b'\n\x00\x00\x00\x00\x00\x00\xed'), bytearray(b'\x0b\x00\x00\x00\x00\x00\x00\xed'), bytearray(b'\x0c\x00\x00\x00\x00\x00\x00\xed'), bytearray(b'\r\x00\x00\x00\x00\x00\x00\xed'), bytearray(b'\x0e\x00\x00\x00\x00\x00\x00\xed'), bytearray(b'\x0f\x00\x00\x00\x00\x00\x00\xed'), bytearray(b'\x10\x00\x00\x00\x00\x00\x00\xed')]
When it doesn't cause any delays or other issues for you, I would prefer to keep the old values. Otherwise we have to make it a configurable option.
Hi Interestingly enough, this is the output I get on my BMS :
[bytearray(b'\x01\x0c\xce\x0c\xd9\x0c\xd6@'), bytearray(b'\x02\x0c\xd9\x0c\xd4\x0c\xd9@'), bytearray(b'\x03\x0c\xd4\x0c\xd7\x0c\xd6@'), bytearray(b'\x04\x0c\xd9\x0c\xd4\x0c\xd9@'), bytearray(b'\x05\x0c\xd4\x0c\xd9\x0c\xd6@'), bytearray(b'\x06\x0c\xd7\x00\x00\x00\x00@'), bytearray(b'\x07\x00\x00\x00\x00\x00\x00@'), bytearray(b'\x08\x00\x00\x00\x00\x00\x00@'), bytearray(b'\t\x00\x00\x00\x00\x00\x00@'), bytearray(b'\n\x00\x00\x00\x00\x00\x00@'), bytearray(b'\x0b\x00\x00\x00\x00\x00\x00@'), bytearray(b'\x0f\x00\x00\x00\x00\x00\x00@')]
ie I only have 12 frames. How many cells do you have on your battery ?
I will try to come up with a way to autodetect this value. @dreadnought could you send me a raw output sample from your BMS ? For example, this is the raw data that matches the output above :
b'\xa5\x01\x95\x08\x01\r7\r6\r4\x9b\xa7\xa5\x01\x95\x08\x02\r5\r5\r5\x9b\xa6' b'\xa5\x01\x95\x08\x03\r4\r>\r6\x9b\xb0\xa5\x01\x95\x08\x04\r7\r6\r7\x9b\xad' b'\xa5\x01\x95\x08\x05\r4\r5\r4\x9b\xa7\xa5\x01\x95\x08\x06\r7\x00\x00\x00\x00' b'\x9b(\xa5\x01\x95\x08\x07\x00\x00\x00\x00\x00\x00\x9b\xe5\xa5\x01\x95\x08\x08' b'\x00\x00\x00\x00\x00\x00\x9b\xe6\xa5\x01\x95\x08\t\x00\x00\x00\x00\x00\x00' b'\x9b\xe7\xa5\x01\x95\x08\n\x00\x00\x00\x00\x00\x00\x9b\xe8\xa5\x01\x95\x08' b'\x0b\x00\x00\x00\x00\x00\x00\x9b\xe9\xa5\xa8\x00@\x00p$@\x00\r0\x00\x00p$' b'@\x008\xa7\x00\x00m2\x00\x00p$@\x00S1\x00\x00\x00\x00\x00\x00\xa8\x00\xa5\x01' b'\x95\x08\x0f\x00\x00\x00\x00\x00\x00\x9b\xed\xa5\x01\x95\x08\x10')
…ytes frames