mr-manuel / venus-os_dbus-serialbattery

Battery Monitor driver for serial battery in VenusOS GX systems
https://mr-manuel.github.io/venus-os_dbus-serialbattery_docs/
MIT License
48 stars 18 forks source link

Fixing JK BMS black version. #24

Closed p0l0us closed 8 months ago

p0l0us commented 8 months ago

My previouse change related to https://github.com/Louisvdw/dbus-serialbattery/issues/950 for JK bms can broke older "Black" JK bms devices. See fix in jkbms_can.py.

JK BMS cells are updating very slowly via can bus and cell count can be increased few times before all detected. This causes exception in dbushelpre.py at line self._dbusservice[cellpath % (str(i + 1))] = voltage. In the end the cell voltage values were missing and not updated in VenusOS. So I added option to preset cell count for JK CAN JKBMS_CAN_CELL_COUNT which resolves the issue. Original logic is kept so the parameter is optional and not necessary if it works without.

Last change in this PR fixes the reinstall shell script. It may happen that user has can2, but not can0 used by dbus-serialbattery. The original detection for can0 didn't work in such case. I included same fix for BLE even it may not be necessary.

mr-manuel commented 8 months ago

Could you please make sure that your GitHub Actions are working and completing with success? You find more informations here: https://louisvdw.github.io/dbus-serialbattery/general/supported-bms#add-by-opening-a-pull-request

p0l0us commented 8 months ago

Could you please make sure that your GitHub Actions are working and completing with success? You find more informations here: https://louisvdw.github.io/dbus-serialbattery/general/supported-bms#add-by-opening-a-pull-request

https://github.com/p0l0us/dbus-serialbattery/actions/runs/8324561682/job/22776438759 I fixed my issues, now if I understand correctly actions are failing due:

 /opt/hostedtoolcache/Python/3.8.13/x64/bin/flake8 .
./etc/dbus-serialbattery/bms/daly.py:39:121: E501 line too long (125 > 120 characters)
./etc/dbus-serialbattery/bms/daly.py:762:16: F821 undefined name 'exception'
Error: The process '/opt/hostedtoolcache/Python/3.8.13/x64/bin/flake8' failed with exit code 1

But daly.py changes are not part of this PR. It seems to be caused by those two commits: https://github.com/mr-manuel/venus-os_dbus-serialbattery/commit/87e99aee5ef2e68565f67bab4cb878a839d86bce. https://github.com/mr-manuel/venus-os_dbus-serialbattery/commit/ff9bcbe5b57b96a2762d8475a630f0082d3a42da