Skip to content

Commit

Permalink
Fix JKBMS not starting if BMS manuf. date is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-manuel committed Sep 27, 2023
1 parent 36ff1b0 commit d37721c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
* Changed: Improved battery voltage handling in linear absorption mode by @ogurevich
* Changed: Improved driver disable script by @md-manuel
* Changed: Improved driver reinstall when multiple Bluetooth BMS are enabled by @mr-manuel
* Changed: JKBMS - Driver do not start if manufacturer date in BMS is empty https://github.com/Louisvdw/dbus-serialbattery/issues/823 by @mr-manuel
* Changed: JKBMS_BLE BMS - Improved driver by @seidler2547 & @mr-manuel
* Changed: LLT/JBD BMS - Fix cycle capacity with https://github.com/Louisvdw/dbus-serialbattery/pull/762 by @idstein
* Changed: LLT/JBD BMS - Fixed https://github.com/Louisvdw/dbus-serialbattery/issues/730 by @mr-manuel
Expand Down
13 changes: 8 additions & 5 deletions etc/dbus-serialbattery/bms/jkbms.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,14 @@ def read_status_data(self):
self.custom_field = tmp if tmp != "Input Us" else None

# production date
offset = cellbyte_count + 164
tmp = unpack_from(">4s", self.get_data(status_data, b"\xB5", offset, 4))[
0
].decode()
self.production = "20" + tmp + "01" if tmp and tmp != "" else None
try:
offset = cellbyte_count + 164
tmp = unpack_from(">4s", self.get_data(status_data, b"\xB5", offset, 4))[
0
].decode()
self.production = "20" + tmp + "01" if tmp and tmp != "" else None
except UnicodeEncodeError:
self.production = None

offset = cellbyte_count + 174
self.version = unpack_from(
Expand Down

0 comments on commit d37721c

Please sign in to comment.