Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge branch 'jkbms_ble' into master #616

Merged
merged 277 commits into from
May 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
277 commits
Select commit Hold shift + click to select a range
a02e71d
changed cell imbalance thresholds
mr-manuel Feb 11, 2023
8bac054
added battery details
mr-manuel Feb 12, 2023
a668a24
JKBMS Bluetooth - added battery details (#454)
mr-manuel Feb 13, 2023
f07eb01
added support for the newer 32s systems, that have slightly different…
baranator Feb 15, 2023
770d054
syncing with upstream
Feb 16, 2023
4e8bbb5
added stop of scraping if detection of jkbms fails
Feb 16, 2023
c734938
lint
Feb 16, 2023
ea6a1c3
indentation was wrong
mr-manuel Feb 17, 2023
fbbd17b
adding fix for Venus OS >= v3.00~14 QML files
mr-manuel Feb 20, 2023
23a60db
merge with baranator:dbus-serialbattery:master
mr-manuel Mar 5, 2023
2eae591
BLE JK BMS model recognition
mr-manuel Mar 5, 2023
d9518f2
Small fixes
mr-manuel Mar 6, 2023
de39112
Added driver restart script
mr-manuel Mar 6, 2023
a6668f6
added informations to run the driver
mr-manuel Mar 9, 2023
c8a5796
pasted code in wrong function
mr-manuel Mar 9, 2023
dd14607
fixed cell balancing color
mr-manuel Mar 10, 2023
3f67884
BLE JK BMS model recognition (#462)
tcrichton Mar 27, 2023
500e7ab
Merge branch 'jkbms_ble' into master
baranator Mar 28, 2023
b0a97e3
install BLE battery as local independent service
Mar 28, 2023
79f82f0
add disconnect before starting the service
Mar 29, 2023
2a65d6c
unique id per BLE device
Mar 29, 2023
646ca4c
Merge branch 'jkbms_ble' into jkbms_ble
mr-manuel Mar 29, 2023
0a2adb2
enable logging and improve error messages
Mar 29, 2023
f5eb089
Merge pull request #466 from baranator/master
mr-manuel Apr 12, 2023
8eabbc4
Merge branch 'jkbms_ble' into jkbms_ble
mr-manuel Apr 13, 2023
acea6bf
Merge pull request #503 from mr-manuel/jkbms_ble
mr-manuel Apr 13, 2023
20d828f
Merge branch 'jkbms_ble' into jkbms_ble
mr-manuel Apr 13, 2023
5065083
Merge pull request #502 from seidler2547/jkbms_ble
mr-manuel Apr 13, 2023
5f3fc34
Update jkbms_ble from master
mr-manuel Apr 13, 2023
534c483
fixes
mr-manuel Apr 13, 2023
26e07aa
Merge pull request #527 from mr-manuel/jkbms_ble
mr-manuel Apr 13, 2023
9c0290f
moved ble part to installble.sh
mr-manuel Apr 15, 2023
ee840ce
added script to install directly from repository
mr-manuel Apr 15, 2023
9488b83
added QML
mr-manuel Apr 15, 2023
953fbb4
create empty config.ini for easier user usage
mr-manuel Apr 15, 2023
92bb2a0
optimize installation scripts
mr-manuel Apr 15, 2023
cd8a30f
changed bash output
mr-manuel Apr 15, 2023
efd5555
added post install notes
mr-manuel Apr 15, 2023
60ddcf2
corrected errors
mr-manuel Apr 15, 2023
c3a50a4
fix black lint errors
mr-manuel Apr 15, 2023
3b82562
Merge branch 'Louisvdw:jkbms_ble' into jkbms_ble
mr-manuel Apr 15, 2023
fd1894a
fix black lint errors
mr-manuel Apr 15, 2023
5ead8b4
Merge branch 'jkbms_ble' of https://github.com/mr-manuel/venus-os_dbu…
mr-manuel Apr 15, 2023
59d91e7
fix black lint errors
mr-manuel Apr 15, 2023
194b83f
bump version
mr-manuel Apr 15, 2023
567f953
Improvements and preparation to merge with master
mr-manuel Apr 15, 2023
3219e70
fixed serial-starter.d
mr-manuel Apr 15, 2023
144d46b
fix errors, move install notes to show always
mr-manuel Apr 18, 2023
8ed26c7
fix errors
mr-manuel Apr 18, 2023
962d21d
Update install-nightly.sh
mr-manuel Apr 18, 2023
008082c
Update install-nightly.sh
mr-manuel Apr 18, 2023
5e029bf
make use of bluetooth configurable
mr-manuel Apr 19, 2023
94411e2
remove modules with uninstall script
mr-manuel Apr 19, 2023
a695052
fix typo
mr-manuel Apr 19, 2023
8f3d76e
Bluetooth enable over config file
mr-manuel Apr 19, 2023
1ad14e6
Added install notes
mr-manuel Apr 19, 2023
fe9cfdf
fix #351
mr-manuel Apr 20, 2023
bda2534
fix #351
mr-manuel Apr 20, 2023
0963923
fix System Switch in IO page
mr-manuel Apr 20, 2023
520eedc
fix #239
mr-manuel Apr 20, 2023
4ed644f
fix black lint errors
mr-manuel Apr 20, 2023
9646528
Merge branch 'Louisvdw:jkbms_ble' into jkbms_ble
mr-manuel Apr 20, 2023
13863f8
run code analyse only on code change
mr-manuel Apr 21, 2023
2bdfc56
Merge branch 'jkbms_ble' of https://github.com/mr-manuel/venus-os_dbu…
mr-manuel Apr 21, 2023
a4da321
fix #311
mr-manuel Apr 21, 2023
a32c738
Separate Time-To-Go and Time-To-SoC activation
mr-manuel Apr 23, 2023
017df8a
fix UnicodeDecodeError
mr-manuel Apr 25, 2023
d8a5d64
Some fixes
mr-manuel Apr 25, 2023
e0a55e9
fix UnicodeDecodeError
mr-manuel Apr 25, 2023
307e40c
Merge branch 'Louisvdw:jkbms_ble' into jkbms_ble
mr-manuel Apr 26, 2023
f11897b
fix UnicodeDecodeError
mr-manuel Apr 26, 2023
627383d
optimize uninstall script
mr-manuel Apr 26, 2023
65a5ef2
fix typo in log_settings
mr-manuel Apr 26, 2023
4890ad1
add charge mode display
mr-manuel Apr 26, 2023
c935363
Merge branch 'jkbms_ble' of https://github.com/mr-manuel/venus-os_dbu…
mr-manuel Apr 26, 2023
a28ae98
Merge branch 'Louisvdw:jkbms_ble' into jkbms_ble
mr-manuel Apr 26, 2023
9d993fc
Added: Temp name for sensor 1 & 2
mr-manuel Apr 26, 2023
8067045
Added: Choose how battery temperature is assembled
mr-manuel Apr 26, 2023
3777d50
Added/Changed alarms for JKBMS
mr-manuel Apr 26, 2023
89dfdbf
Removed Alarms/HighCellVoltage
mr-manuel Apr 26, 2023
8ffa730
Changed: Moved charge mode
mr-manuel Apr 26, 2023
1940d5d
Added: Show (dis)charge current limitation reason
mr-manuel Apr 26, 2023
acd9ea3
added changelog
mr-manuel Apr 26, 2023
b46c67f
Fixes and improvements
mr-manuel Apr 26, 2023
2e67a5e
corrected file permissions
mr-manuel Apr 26, 2023
3f81fa5
fix dbus-daemon memory leak
seidler2547 Apr 26, 2023
3caad73
fix typo
mr-manuel Apr 26, 2023
e0b4e99
fix dbus-daemon memory leak
mr-manuel Apr 26, 2023
3429fe2
Merge branch 'Louisvdw:jkbms_ble' into jkbms_ble
mr-manuel Apr 26, 2023
e28facf
Update readme
mr-manuel Apr 26, 2023
ed80385
Merge branch 'jkbms_ble' of https://github.com/mr-manuel/venus-os_dbu…
mr-manuel Apr 26, 2023
b011e0e
Remove bluetooth option from the config file
mr-manuel Apr 26, 2023
8d0db98
Small word case changes
mr-manuel Apr 26, 2023
2ffa358
Added: Show specific TimeToSoC points in GUI
mr-manuel Apr 26, 2023
5a16cbd
fix black lint error
mr-manuel Apr 26, 2023
964ec17
Some improvement and fixes
mr-manuel Apr 26, 2023
1e6d410
Improved JBD BMS soc calculation
mr-manuel Apr 27, 2023
922b82c
Fix for #397
mr-manuel Apr 27, 2023
23356f6
small fixes
mr-manuel Apr 27, 2023
4bd257f
sort bms imports
mr-manuel Apr 27, 2023
c56a9d1
Add support for HLPdata BMS4S
mr-manuel Apr 27, 2023
314bb93
Add support for Seplos BMS
mr-manuel Apr 27, 2023
aceeac9
change flake8 settings
mr-manuel Apr 27, 2023
64a08f4
fix black lint errors
mr-manuel Apr 27, 2023
31647db
removed wildcard imports
mr-manuel Apr 27, 2023
8d3f25e
fixed black lint errors
mr-manuel Apr 27, 2023
a4a3efb
change flake8 settings
mr-manuel Apr 27, 2023
4a26d0d
remove wildcard import and fix black lint errors
mr-manuel Apr 27, 2023
564d4ed
removed wildcard import
mr-manuel Apr 27, 2023
41cdadb
fixed black lint check
mr-manuel Apr 27, 2023
440b113
config changes
mr-manuel Apr 27, 2023
bc91973
remove old log message in handle_changed_setting()
mr-manuel Apr 27, 2023
83668b6
simplified condition for Time-To-Go/Soc
mr-manuel Apr 27, 2023
ed4d57b
Improvements and fixes
mr-manuel Apr 27, 2023
aee71f0
fix renogy import
mr-manuel Apr 27, 2023
362916c
Merge pull request #588 from mr-manuel/jkbms_ble
mr-manuel Apr 27, 2023
9e358fa
added BMS info and cleanup
mr-manuel Apr 28, 2023
09034a1
moved BMS to subfolder
mr-manuel Apr 28, 2023
a0918ee
moved BMS to subfolder
mr-manuel Apr 28, 2023
8f7d705
corrected installble to run correct script
mr-manuel Apr 28, 2023
3a62eed
Added self.unique_identifier to the battery class
mr-manuel Apr 28, 2023
d882937
changed ble service name
mr-manuel Apr 28, 2023
0aed855
Changes 2023.04.28
mr-manuel Apr 28, 2023
d3a72d6
read installed capacity at startup
transistorgit Apr 28, 2023
b113bff
Merge pull request #594 from transistorgit/daly_capacity
mr-manuel Apr 28, 2023
9cea902
disable ANT BMS by default
mr-manuel Apr 29, 2023
49694b6
fix cell voltage header parser
transistorgit Apr 29, 2023
3a583ed
rework daly receive routine
transistorgit Apr 29, 2023
554c01d
improve read cell voltages - only work on sufficient data, drop only …
transistorgit Apr 29, 2023
e8ad26d
allow read_soc to also retry serial transmission
transistorgit Apr 29, 2023
93a4e98
add daly cell balance state info. cells are red only if unbalanced now
transistorgit Apr 29, 2023
fdd0bd1
bump version
mr-manuel Apr 29, 2023
ec04969
typo
mr-manuel Apr 29, 2023
ae1e447
Fixes
mr-manuel Apr 29, 2023
878014b
Merge branch 'Louisvdw:jkbms_ble' into jkbms_ble
transistorgit Apr 29, 2023
d1238e0
moved read_serialport_data() to daly.py
transistorgit May 1, 2023
62422de
revert read_serialport_data() to the state before my changes
transistorgit May 1, 2023
a3915cb
fix connection log startup message.
transistorgit May 1, 2023
4d4d256
Revert utils.py changes, improved Daly driver
mr-manuel May 1, 2023
3153962
black reformatting
transistorgit May 1, 2023
ec4a334
flake config change
mr-manuel May 1, 2023
31a1e53
added linear voltage recalculation interval
mr-manuel May 1, 2023
295efd1
replaced penalty voltage calculation
mr-manuel May 1, 2023
f95dc05
fix black lint errors
mr-manuel May 1, 2023
52fdc4a
updated config.default.ini
mr-manuel May 1, 2023
d820050
Changes 2023.05.01
mr-manuel May 1, 2023
912cd74
update nightly install script
mr-manuel May 1, 2023
4de2ae5
update nightly install script
mr-manuel May 1, 2023
93caa23
Removed line
mr-manuel May 1, 2023
fce00b9
fixed error in HLPdataBMS4S
mr-manuel May 1, 2023
9e4b069
fixed wrong variable assignment
mr-manuel May 2, 2023
80e2c67
updated battery template
mr-manuel May 2, 2023
70658e9
Fix for #450
mr-manuel May 2, 2023
fbfdcc7
Read charge/discharge limit JKBMS
mr-manuel May 2, 2023
5c9d30a
updated battery template
mr-manuel May 2, 2023
6a9ee0a
Progress with config limits reason
mr-manuel May 2, 2023
ebfb5bc
updated CELL_VOLTAGE_DIFF_TO_RESET_VOLTAGE_LIMIT default value
mr-manuel May 2, 2023
1d82436
Changes 2023.05.02
mr-manuel May 2, 2023
f44157a
added SoC round for LLT/JBD
mr-manuel May 2, 2023
da3fa07
fixed log typo
mr-manuel May 2, 2023
cf46dab
reworked installation procedure
mr-manuel May 2, 2023
9907912
Merge branch 'Louisvdw:jkbms_ble' into jkbms_ble
mr-manuel May 2, 2023
94b1a21
Merge branch 'master' into jkbms_ble
mr-manuel May 2, 2023
93cb3f0
Merge branch 'jkbms_ble' of https://github.com/mr-manuel/venus-os_dbu…
mr-manuel May 2, 2023
557b9ac
Merge branch 'master' of into jkbms_ble
mr-manuel May 2, 2023
335a0e7
GitHub pages config change
mr-manuel May 2, 2023
9f1da97
cleanup
mr-manuel May 2, 2023
74b459a
Renamed scripts for better reading #532
mr-manuel May 3, 2023
dff74d7
update docusaurus dependencies
mr-manuel May 3, 2023
c615a61
change sh with bash
mr-manuel May 3, 2023
a1972c8
Merge branch 'master' into jkbms_ble
mr-manuel May 3, 2023
43368fe
limitation reason cleanup
mr-manuel May 3, 2023
ad2855d
changed default config settings
mr-manuel May 3, 2023
2c9d3dd
Merge branch 'jkbms_ble' into jkbms_ble
mr-manuel May 3, 2023
9fcf1a5
Changes 2023.05.03
mr-manuel May 3, 2023
66f982a
removed testing line
mr-manuel May 3, 2023
524321c
Cleanup duplicated files
mr-manuel May 3, 2023
ff1b143
Cleanup
mr-manuel May 3, 2023
12ec57e
MOSFET temperature was displayed twice after merge
mr-manuel May 3, 2023
84556e8
updated changelog
mr-manuel May 3, 2023
56fecf3
Small fixes
mr-manuel May 3, 2023
bbb7b1b
fix disconnection behaviour: on disconnect, show '---' after 10s and …
transistorgit May 3, 2023
1514206
fix merge conflicts
transistorgit May 3, 2023
d647b1e
fix flake errors
transistorgit May 3, 2023
f496103
Merge pull request #4 from transistorgit/jkbms_ble
mr-manuel May 4, 2023
8ed42ae
small fix
mr-manuel May 4, 2023
77fc212
Added: apply max voltage if CVCM_ENABLE is False
mr-manuel May 4, 2023
9acfb15
fixed type error
mr-manuel May 4, 2023
7e1ada1
Added: BMS disconnect behaviour
mr-manuel May 4, 2023
2b32e11
Changed: Remove wildcard import from dbushelper.py
mr-manuel May 4, 2023
cd8c22a
small fixes
mr-manuel May 4, 2023
8a37bf2
Changes 2023.05.04
mr-manuel May 4, 2023
1ad0f13
flake8 changes
mr-manuel May 4, 2023
1e93047
copied lltjbd_ble from idstein:jdb_ble
mr-manuel May 4, 2023
497fa2b
Added and adapted LltJbd_Ble
mr-manuel May 4, 2023
e25eff1
small changes
mr-manuel May 4, 2023
5e4d375
Merge branch 'jkbms_ble' of https://github.com/mr-manuel/venus-os_dbu…
mr-manuel May 4, 2023
b05053d
read production date and append to hardware version
transistorgit May 4, 2023
0135916
Set SOC nightly. Button is working, next is send command to bms
transistorgit May 4, 2023
62d8afd
Added: Show additional data in device page
mr-manuel May 5, 2023
94fc423
Added: JKBMS unique identifier & fixed data length
mr-manuel May 5, 2023
f79ce83
Added: JKBMS BLE unique identifier
mr-manuel May 5, 2023
2e8e7fc
Added: Jkbms_Ble connection_name()
mr-manuel May 5, 2023
61571be
read production date and append to hardware version
mr-manuel May 5, 2023
6c4c545
Added: Daly unique identifier
mr-manuel May 5, 2023
a22cde9
Added: JKBMS BLE serial number, user defined field
mr-manuel May 5, 2023
aff297e
Changes 2023.05.05
mr-manuel May 5, 2023
fe77013
read out daly battery code and use as unique id
transistorgit May 5, 2023
f0e4270
moved production date and added custom field
mr-manuel May 5, 2023
16b0e70
Merge pull request #6 from transistorgit/daly_battery_code
mr-manuel May 5, 2023
8953689
clean battery code
mr-manuel May 5, 2023
e794363
Daly read_capacity change
mr-manuel May 6, 2023
8aeebb1
Daly try to fix no reply
mr-manuel May 6, 2023
a51c975
Improvements by @transistorgit
mr-manuel May 6, 2023
ff205b8
changed value
mr-manuel May 6, 2023
7346758
set SOC (and date time) on button press.
transistorgit May 6, 2023
a480158
Merge branch 'jkbms_ble' into set_daly_soc
transistorgit May 6, 2023
991b1db
fix battery code parser
transistorgit May 6, 2023
80d7194
format fix
transistorgit May 6, 2023
46855e2
format fix
transistorgit May 6, 2023
11696e8
fix extra long serial timeouts
transistorgit May 6, 2023
c980e3b
Small fixes
mr-manuel May 6, 2023
a8703c3
Merge pull request #7 from transistorgit/set_daly_soc
mr-manuel May 6, 2023
6a06313
updated config file
mr-manuel May 6, 2023
c22e174
updated changelog
mr-manuel May 6, 2023
cb050e2
Changes 2023.05.06
mr-manuel May 6, 2023
20d83e2
debug daly
mr-manuel May 7, 2023
12b0a4c
Merge branch 'jkbms_ble' of https://github.com/mr-manuel/venus-os_dbu…
mr-manuel May 7, 2023
1a11eaa
changed release workflow
mr-manuel May 7, 2023
a88d704
Updated from master
mr-manuel May 7, 2023
2f047a9
fix blank screen, debug daly
mr-manuel May 7, 2023
944feda
make Reset SoC a spin box
transistorgit May 7, 2023
ecb586d
Merge pull request #8 from transistorgit/set_daly_soc
mr-manuel May 7, 2023
13a9f41
Changes 2023.05.07
mr-manuel May 7, 2023
b83f5bf
fix possible read_capacity problem
transistorgit May 7, 2023
6816441
Merge pull request #9 from transistorgit/set_daly_soc
mr-manuel May 7, 2023
e5880bd
Daly read_balance_state() add missing return
mr-manuel May 7, 2023
f167eb0
Daly advanced troubleshooting
mr-manuel May 7, 2023
93bbbfe
Merge branch 'jkbms_ble' of https://github.com/mr-manuel/venus-os_dbu…
mr-manuel May 7, 2023
a74cd5d
Changed: Improved Daily stability by a lot
mr-manuel May 8, 2023
8185918
fixes for disable and uninstall
mr-manuel May 8, 2023
b3cd424
optimized USB install method
mr-manuel May 8, 2023
4a92378
updated changelog
mr-manuel May 8, 2023
80a10c4
added missing qml to restore-gui.sh
mr-manuel May 8, 2023
6250836
Changes 2023.05.08
mr-manuel May 8, 2023
044de45
Improved uninstall
mr-manuel May 8, 2023
711296f
make executable
mr-manuel May 8, 2023
6f3ccd5
ready to merge with master
mr-manuel May 8, 2023
5e5fed5
ready to merge with master
mr-manuel May 8, 2023
7b0dcd1
Merge branch 'master' into jkbms_ble
mr-manuel May 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* Added: Choose how battery temperature is assembled (mean temp 1 & 2, only temp 1 or only temp 2) by @mr-manuel
* Added: Config file by @ppuetsch
* Added: Create empty `config.ini` for easier user usage by @mr-manuel
* Added: Cronjob to restart Bluetooth service every 12 hours by @mr-manuel
* Added: Daly BMS - Read capacity https://github.com/Louisvdw/dbus-serialbattery/pull/594 by @transistorgit
* Added: Daly BMS - Read production date and build unique identifier by @transistorgit
* Added: Daly BMS - Set SoC by @transistorgit
Expand All @@ -24,8 +25,18 @@
* Added: Fix for Venus OS >= v3.00~14 showing unused items https://github.com/Louisvdw/dbus-serialbattery/issues/469 by @mr-manuel
* Added: HighInternalTemperature alarm (MOSFET) for JKBMS by @mr-manuel
* Added: Improved maintainability (flake8, black lint), introduced code checks and automate release build https://github.com/Louisvdw/dbus-serialbattery/pull/386 by @ppuetsch
* Added: Install needed Bluetooth components automatically after a Venus OS upgrade by @mr-manuel
* Added: JKBMS - MOS temperature https://github.com/Louisvdw/dbus-serialbattery/pull/440 by @baphomett
* Added: JKBMS - Uniqie identifier and show "User Private Data" field that can be set in the JKBMS App to identify the BMS in a multi battery environment by @mr-manuel
* Added: JKBMS BLE - Balancing switch status by @mr-manuel
* Added: JKBMS BLE - Capacity by @mr-manuel
* Added: JKBMS BLE - Cell imbalance alert by @mr-manuel
* Added: JKBMS BLE - Charging switch status by @mr-manuel
* Added: JKBMS BLE - Discharging switch status by @mr-manuel
* Added: JKBMS BLE - MOS temperature by @mr-manuel
* Added: JKBMS BLE - Show if balancing is active and which cells are balancing by @mr-manuel
* Added: JKBMS BLE - Show serial number and "User Private Data" field that can be set in the JKBMS App to identify the BMS in a multi battery environment by @mr-manuel
* Added: JKBMS BLE driver by @baranator
* Added: Possibility to add `config.ini` to the root of a USB flash drive on install via the USB method by @mr-manuel
* Added: Post install notes by @mr-manuel
* Added: Read charge/discharge limits from JKBMS by @mr-manuel
Expand Down Expand Up @@ -55,6 +66,7 @@
* Changed: Default FLOAT_CELL_VOLTAGE from 3.350 V to 3.375 V by @mr-manuel
* Changed: Default LINEAR_LIMITATION_ENABLE from False to True by @mr-manuel
* Changed: Disabled ANT BMS by default https://github.com/Louisvdw/dbus-serialbattery/issues/479 by @mr-manuel
* Changed: Driver can now also start without serial adapter attached for Bluetooth BMS by @seidler2547
* Changed: Fix for https://github.com/Louisvdw/dbus-serialbattery/issues/239 by @mr-manuel
* Changed: Fix for https://github.com/Louisvdw/dbus-serialbattery/issues/311 by @mr-manuel
* Changed: Fix for https://github.com/Louisvdw/dbus-serialbattery/issues/351 by @mr-manuel
Expand All @@ -68,6 +80,7 @@
* Changed: Improved JBD BMS soc calculation https://github.com/Louisvdw/dbus-serialbattery/pull/439 by @aaronreek
* Changed: Logging to get relevant data by @mr-manuel
* Changed: Many code improvements https://github.com/Louisvdw/dbus-serialbattery/pull/393 by @ppuetsch
* Changed: Moved Bluetooth part to `reinstall-local.sh` by @mr-manuel
* Changed: Moved BMS scripts to subfolder by @mr-manuel
* Changed: Removed all wildcard imports and fixed black lint errors by @mr-manuel
* Changed: Removed cell voltage penalty. Replaced by automatic voltage calculation. Max voltage is kept until cells are balanced and reset when cells are inbalanced by @mr-manuel
Expand All @@ -78,3 +91,4 @@
* Changed: Temperature alarm changed in order to not trigger all in the same condition for JKBMS by @mr-manuel
* Changed: Time-To-Soc repetition from cycles to seconds. Minimum value is every 5 seconds. This prevents CPU overload and ensures system stability. Renamed `TIME_TO_SOC_LOOP_CYCLES` to `TIME_TO_SOC_RECALCULATE_EVERY` by @mr-manuel
* Changed: Time-To-Soc string from `days, HR:MN:SC` to `<days>d <hours>h <minutes>m <seconds>s` (same as Time-To-Go) by @mr-manuel
* Changed: Uninstall also installed Bluetooth modules on uninstall by @mr-manuel
255 changes: 255 additions & 0 deletions etc/dbus-serialbattery/bms/jkbms_ble.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,255 @@
# -*- coding: utf-8 -*-
from battery import Battery, Cell
from utils import logger
from bms.jkbms_brn import Jkbms_Brn
from bleak import BleakScanner, BleakError
import asyncio
import time
import os


class Jkbms_Ble(Battery):
BATTERYTYPE = "Jkbms_Ble"
resetting = False

def __init__(self, port, baud, address):
super(Jkbms_Ble, self).__init__(address.replace(":", "").lower(), baud, address)
self.type = self.BATTERYTYPE
self.jk = Jkbms_Brn(address)

logger.info("Init of Jkbms_Ble at " + address)

def connection_name(self) -> str:
return "BLE " + self.address

def test_connection(self):
# call a function that will connect to the battery, send a command and retrieve the result.
# The result or call should be unique to this BMS. Battery name or version, etc.
# Return True if success, False for failure

# check if device with given mac is found, otherwise abort

logger.info("Test of Jkbms_Ble at " + self.jk.address)
try:
loop = asyncio.get_event_loop()
t = loop.create_task(BleakScanner.discover())
devices = loop.run_until_complete(t)
except BleakError as err:
logger.error(str(err))
return False
except Exception as err:
logger.error(f"Unexpected {err=}, {type(err)=}")
return False

found = False
for d in devices:
if d.address == self.jk.address:
found = True
if not found:
logger.error("No Jkbms_Ble found at " + self.jk.address)
return False

"""
# before indipended service, has to be checked

logger.info("test of jkbmsble")
tries = 0
while True:
try:
loop = asyncio.get_event_loop()
t = loop.create_task(
BleakScanner.find_device_by_address(self.jk.address)
)
device = loop.run_until_complete(t)

if device is None:
logger.info("jkbmsble not found")
if tries > 2:
return False
else:
# device found, exit loop and continue test
break
except BleakError as e:
if tries > 2:
return False
# recover from error if tries left
logger.error(str(e))
self.reset_bluetooth()
tries += 1
"""

# device was found, presumeably a jkbms so start scraping
self.jk.start_scraping()
tries = 1

while self.jk.get_status() is None and tries < 20:
time.sleep(0.5)
tries += 1

# load initial data, from here on get_status has valid values to be served to the dbus
status = self.jk.get_status()
if status is None:
self.jk.stop_scraping()
return False

if not status["device_info"]["vendor_id"].startswith(("JK-", "JK_")):
self.jk.stop_scraping()
return False

logger.info("Jkbms_Ble found!")

# get first data to show in startup log
self.get_settings()
self.refresh_data()

return True

def get_settings(self):
# After successful connection get_settings will be call to set up the battery.
# Set the current limits, populate cell count, etc
# Return True if success, False for failure
st = self.jk.get_status()["settings"]
self.cell_count = st["cell_count"]
self.max_battery_charge_current = st["max_charge_current"]
self.max_battery_discharge_current = st["max_discharge_current"]
self.max_battery_voltage = st["cell_ovp"] * self.cell_count
self.min_battery_voltage = st["cell_uvp"] * self.cell_count

# "User Private Data" field in APP
tmp = self.jk.get_status()["device_info"]["production"]
self.custom_field = tmp if tmp != "Input Us" else None

tmp = self.jk.get_status()["device_info"]["manufacturing_date"]
self.production = "20" + tmp if tmp and tmp != "" else None

self.unique_identifier = self.jk.get_status()["device_info"]["serial_number"]

for c in range(self.cell_count):
self.cells.append(Cell(False))

self.capacity = self.jk.get_status()["cell_info"]["capacity_nominal"]

self.hardware_version = (
"JKBMS "
+ self.jk.get_status()["device_info"]["hw_rev"]
+ " "
+ str(self.cell_count)
+ " cells"
+ (" (" + self.production + ")" if self.production else "")
)
logger.info("BAT: " + self.hardware_version)
return True

def refresh_data(self):
# call all functions that will refresh the battery data.
# This will be called for every iteration (1 second)
# Return True if success, False for failure

# result = self.read_soc_data()
# TODO: check for errors
st = self.jk.get_status()
if st is None:
return False
if time.time() - st["last_update"] > 30:
# if data not updated for more than 30s, sth is wrong, then fail
logger.info("Jkbms_Ble: Bluetooth died")

# if the thread is still alive but data too old there is sth
# wrong with the bt-connection; restart whole stack
if not self.resetting:
self.reset_bluetooth()
self.jk.start_scraping()
time.sleep(2)

return False
else:
self.resetting = False

for c in range(self.cell_count):
self.cells[c].voltage = st["cell_info"]["voltages"][c]

self.to_temp(0, st["cell_info"]["temperature_mos"])
self.to_temp(1, st["cell_info"]["temperature_sensor_1"])
self.to_temp(2, st["cell_info"]["temperature_sensor_2"])
self.current = round(st["cell_info"]["current"], 1)
self.voltage = round(st["cell_info"]["total_voltage"], 2)

self.soc = st["cell_info"]["battery_soc"]
self.cycles = st["cell_info"]["cycle_count"]

self.charge_fet = st["settings"]["charging_switch"]
self.discharge_fet = st["settings"]["discharging_switch"]
self.balance_fet = st["settings"]["balancing_switch"]

self.balancing = False if st["cell_info"]["balancing_action"] == 0.000 else True
self.balancing_current = (
st["cell_info"]["balancing_current"]
if st["cell_info"]["balancing_current"] < 32768
else (65536 / 1000 - st["cell_info"]["balancing_current"]) * -1
)
self.balancing_action = st["cell_info"]["balancing_action"]

# show wich cells are balancing
for c in range(self.cell_count):
if self.balancing and (
st["cell_info"]["min_voltage_cell"] == c
or st["cell_info"]["max_voltage_cell"] == c
):
self.cells[c].balance = True
else:
self.cells[c].balance = False

# protection bits
# self.protection.soc_low = 2 if status["cell_info"]["battery_soc"] < 10.0 else 0

# trigger cell imbalance warning when delta is to great
if st["cell_info"]["delta_cell_voltage"] > min(
st["settings"]["cell_ovp"] * 0.05, 0.200
):
self.protection.cell_imbalance = 2
elif st["cell_info"]["delta_cell_voltage"] > min(
st["settings"]["cell_ovp"] * 0.03, 0.120
):
self.protection.cell_imbalance = 1
else:
self.protection.cell_imbalance = 0

self.protection.voltage_high = 2 if st["warnings"]["cell_overvoltage"] else 0
self.protection.voltage_low = 2 if st["warnings"]["cell_undervoltage"] else 0

self.protection.current_over = (
2
if (
st["warnings"]["charge_overcurrent"]
or st["warnings"]["discharge_overcurrent"]
)
else 0
)
self.protection.set_IC_inspection = (
2 if st["cell_info"]["temperature_mos"] > 80 else 0
)
self.protection.temp_high_charge = 2 if st["warnings"]["charge_overtemp"] else 0
self.protection.temp_low_charge = 2 if st["warnings"]["charge_undertemp"] else 0
self.protection.temp_high_discharge = (
2 if st["warnings"]["discharge_overtemp"] else 0
)
return True

def reset_bluetooth(self):
logger.info("Reset of Bluetooth triggered")
self.resetting = True
# if self.jk.is_running():
# self.jk.stop_scraping()
logger.info("Scraping ended, issuing sys-commands")
# process kill is needed, since the service/bluetooth driver is probably freezed
os.system('pkill -f "bluetoothd"')
# stop will not work, if service/bluetooth driver is stuck
# os.system("/etc/init.d/bluetooth stop")
time.sleep(2)
os.system("rfkill block bluetooth")
os.system("rfkill unblock bluetooth")
os.system("/etc/init.d/bluetooth start")
logger.info("Bluetooth should have been restarted")

def get_balancing(self):
return 1 if self.balancing else 0
Loading