On startup, I had sometimes errors that I can't really explain. I thought the receive-logic would suppress such issues, but I got:
2024-03-10 20:16:45.816699500 Traceback (most recent call last):
2024-03-10 20:16:45.816704500 File "/opt/victronenergy/dbus-serialbattery/dbushelper.py", line 756, in publish_battery
2024-03-10 20:16:45.816708500 result = self.battery.refresh_data()
2024-03-10 20:16:45.816711500 File "/opt/victronenergy/dbus-serialbattery/bms/daly.py", line 124, in refresh_data
2024-03-10 20:16:45.816715500 result = self.read_fed_data(ser) and result
2024-03-10 20:16:45.816718500 File "/opt/victronenergy/dbus-serialbattery/bms/daly.py", line 499, in read_fed_data
2024-03-10 20:16:45.816790500 fed_data = self.request_data(ser, self.command_fet)
2024-03-10 20:16:45.816794500 File "/opt/victronenergy/dbus-serialbattery/bms/daly.py", line 724, in request_data
2024-03-10 20:16:45.816798500 next = self.read_sentence(ser, command)
2024-03-10 20:16:45.816801500 File "/opt/victronenergy/dbus-serialbattery/bms/daly.py", line 760, in readsentence
2024-03-10 20:16:45.816805500 , id, cmd, length = unpack_from(">BBBB", reply)
2024-03-10 20:16:45.816832500 struct.error: unpack_from requires a buffer of at least 4 bytes for unpacking 4 bytes at offset 0 (actual buffer size is 1)
On startup, I had sometimes errors that I can't really explain. I thought the receive-logic would suppress such issues, but I got:
2024-03-10 20:16:45.816699500 Traceback (most recent call last): 2024-03-10 20:16:45.816704500 File "/opt/victronenergy/dbus-serialbattery/dbushelper.py", line 756, in publish_battery 2024-03-10 20:16:45.816708500 result = self.battery.refresh_data() 2024-03-10 20:16:45.816711500 File "/opt/victronenergy/dbus-serialbattery/bms/daly.py", line 124, in refresh_data 2024-03-10 20:16:45.816715500 result = self.read_fed_data(ser) and result 2024-03-10 20:16:45.816718500 File "/opt/victronenergy/dbus-serialbattery/bms/daly.py", line 499, in read_fed_data 2024-03-10 20:16:45.816790500 fed_data = self.request_data(ser, self.command_fet) 2024-03-10 20:16:45.816794500 File "/opt/victronenergy/dbus-serialbattery/bms/daly.py", line 724, in request_data 2024-03-10 20:16:45.816798500 next = self.read_sentence(ser, command) 2024-03-10 20:16:45.816801500 File "/opt/victronenergy/dbus-serialbattery/bms/daly.py", line 760, in readsentence 2024-03-10 20:16:45.816805500 , id, cmd, length = unpack_from(">BBBB", reply) 2024-03-10 20:16:45.816832500 struct.error: unpack_from requires a buffer of at least 4 bytes for unpacking 4 bytes at offset 0 (actual buffer size is 1)
so I just added a try/except here.