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

Add support for HLPdata BMS4S #505

Merged
merged 15 commits into from
May 2, 2023
Merged

Add support for HLPdata BMS4S #505

merged 15 commits into from
May 2, 2023

Conversation

peterohman
Copy link
Contributor

BMS4S is a command controlled device. To enable managing it while connected via hlpdatabms4s.py the serial terminal hlpdatabms4s_miniterm.py is added. In a rough manner it handles the interference with hlpdatabms4s.py. But managing sessions are expected to be short, so the solution is regarded as good enough.

@mr-manuel
Copy link
Collaborator

mr-manuel commented Apr 27, 2023

Hi, thanks for your PR. Somehow the GitHub Actions did not run in your fork. Can you please check this? Probably you have to enable it in your repository settings under Actions -> General -> Actions permissions select Allow all actions and reusable workflows.

Please also change the wildcard imports to specific imports.

mr-manuel added a commit to mr-manuel/venus-os_dbus-serialbattery that referenced this pull request Apr 27, 2023
@peterohman
Copy link
Contributor Author

peterohman commented Apr 27, 2023 via email

@peterohman
Copy link
Contributor Author

When I try to rerun the workflow I get "Error: Resource not accessible by integration". And since I have not written the workflow I do not understand what resource it is referring to. So please give me a clue on what to do.

@mr-manuel
Copy link
Collaborator

Could you check in your repository settings under Actions -> General -> Workflow permissions if Read and write permissions are selected? If not do so

@peterohman
Copy link
Contributor Author

peterohman commented Apr 27, 2023 via email

@mr-manuel
Copy link
Collaborator

I fixed the two files. It's ok now. The other errors can be ignored, they are fixed in my PR.

@mr-manuel
Copy link
Collaborator

One thing:

if not ret is False:
why not
if ret is True:

?

@peterohman
Copy link
Contributor Author

peterohman commented Apr 27, 2023 via email

@mr-manuel mr-manuel mentioned this pull request Apr 27, 2023
mr-manuel added a commit that referenced this pull request Apr 27, 2023
* Added: Support for HLPdata BMS4S #505
* Added: Support for Seplos BMS #530
* Changed: Fix for #397 #484
* Changed: flake8 settings
* Changed: Improved JBD BMS soc calculation #439
* Changed: Removed wildcard imports from several BMS drivers and fixed black lint errors
* Changed: Simplified condition for Time-To-Go/Soc
* Changed: Sort bms imports
* Removed: Old log message in handle_changed_setting()
@mr-manuel
Copy link
Collaborator

Could you please provide me the data for the comparison table?

@peterohman
Copy link
Contributor Author

peterohman commented Apr 28, 2023 via email

@mr-manuel
Copy link
Collaborator

Since we are improving this driver constantly, we will add a new value in future. Is there any value that can be read from the BMS that is unique and helps to identify a BMS, when multiple BMS are attached? Like serial number?

If yes, please write it as string to self.unique_identifier. See mr-manuel@89cfe0a#diff-9d9b25b4a5dcc9b6f162c96264601c1986789dd796a6b170586076a746fabbc0R102-R103

@peterohman
Copy link
Contributor Author

peterohman commented Apr 28, 2023 via email

@mr-manuel
Copy link
Collaborator

Ok. You don't have to add the feature by installed capacity. This will be added to the battery class, if the unique identifier is not available.

2023-05-01 16:26:56.144343500 INFO:SerialBattery:Testing HLPdataBMS4S
2023-05-01 16:26:56.146290500 Traceback (most recent call last):
2023-05-01 16:26:56.146294500   File "/opt/victronenergy/dbus-serialbattery/dbus-serialbattery.py", line 151, in <module>
2023-05-01 16:26:56.146298500     main()
2023-05-01 16:26:56.146300500   File "/opt/victronenergy/dbus-serialbattery/dbus-serialbattery.py", line 120, in main
2023-05-01 16:26:56.146304500     battery = get_battery(port)
2023-05-01 16:26:56.146307500   File "/opt/victronenergy/dbus-serialbattery/dbus-serialbattery.py", line 77, in get_battery
2023-05-01 16:26:56.146310500     battery: Battery = batteryClass(
2023-05-01 16:26:56.146347500 TypeError: __init__() got an unexpected keyword argument 'address'
@mr-manuel
Copy link
Collaborator

Do your BMS provide charge and discharge limits? #4

If yes, could you change that the limits are read from the BMS?

@peterohman
Copy link
Contributor Author

peterohman commented May 2, 2023 via email

@Louisvdw Louisvdw merged commit 1f99936 into Louisvdw:master May 2, 2023
@mr-manuel mr-manuel mentioned this pull request May 4, 2023
12 tasks
Louisvdw pushed a commit that referenced this pull request May 8, 2023
* changed cell imbalance thresholds

* added battery details
- added: MOS temperature
- added: Balancing switch status

* JKBMS Bluetooth - added battery details (#454)

* added battery details
- added: capacity
- added: MOS temperature
- added: charging switch status
- added: discharging switch status
- added: balancing switch status
- added: show if balancing is active and which cells are balanced
- added: cell imbalance alert

* changed cell imbalance thresholds

* added battery details
- added: MOS temperature
- added: Balancing switch status

* added support for the newer 32s systems, that have slightly different frame-structure

* added stop of scraping if detection of jkbms fails

* lint

* indentation was wrong

* adding fix for Venus OS >= v3.00~14 QML files

* merge with baranator:dbus-serialbattery:master

* BLE JK BMS model recognition
Pull request from @tcrichton
#462

* Small fixes
- Added: Setup cronjob when installing driver
- Added: Information how to pair JKBMS changed default pin
- Changed: Bump version to v0.15.0-ble

* Added driver restart script

* added informations to run the driver

* pasted code in wrong function

* fixed cell balancing color

* BLE JK BMS model recognition (#462)

* * Other JK BMS’ have an underscore in their vendor_id
* Don’t forget to include your new PageLynxIonIo in the build lis

* build list is removed upstream

---------

Co-authored-by: Tristan Crichton <stan@tcrichton.co.uk>

* install BLE battery as local independent service

* add disconnect before starting the service

* unique id per BLE device

* enable logging and improve error messages

* Update jkbms_ble from master

* fixes

* moved ble part to installble.sh

* added script to install directly from repository

* added QML

* create empty config.ini for easier user usage

* optimize installation scripts

* changed bash output

* added post install notes

* corrected errors

* fix black lint errors

* fix black lint errors

* fix black lint errors

* bump version

* fixed serial-starter.d
#520

* fix errors, move install notes to show always

* Update install-nightly.sh

* Update install-nightly.sh

* make use of bluetooth configurable

* remove modules with uninstall script

* fix typo

* Added install notes

* fix #351

* fix System Switch in IO page

* fix #239
by @TimGFoley

* fix black lint errors

* run code analyse only on code change

* fix #311

* Separate Time-To-Go and Time-To-SoC activation

* fix UnicodeDecodeError
#485 (comment)

* fix UnicodeDecodeError
#485 (comment)

* optimize uninstall script

* fix typo in log_settings

* add charge mode display

* Added: Temp name for sensor 1 & 2
Added the possibility to give a name to temperature sensor 1 & 2
This allows to see which sensor is low and high

* Added: Choose how battery temperature is assembled

* Added/Changed alarms for JKBMS
* Added: HighInternalTemperature alarm for JKBMS
* Changed: Temperature alarm to not trigger all in the same condition

* Removed Alarms/HighCellVoltage
It does not exist on the dbus

* Changed: Moved charge mode
from IO page to Paramaters page

* Added: Show (dis)charge current limitation reason

* added changelog

* corrected file permissions

* fix dbus-daemon memory leak

`poll_battery` is already called from the dbus mainloop in a separate thread. Opening a new thread here (and especially never closing it) will accumulate threads and leads to problems like `dbus-daemon` memory usage increasing over time, leading to eventual reboot

* fix typo

* Update readme

* Remove bluetooth option from the config file
Bluetooth classes are now imported automatically, if it's a Bluetooth port

* Small word case changes

* Added: Show specific TimeToSoC points in GUI
Only if 0%, 10%, 20%, 80%, 90% and/or 100% are selected

* fix black lint error

* Improved JBD BMS soc calculation
#439

* Fix for #397
#484

* small fixes

* sort bms imports

* Add support for HLPdata BMS4S
#505

* Add support for Seplos BMS
#530

* change flake8 settings

* fix black lint errors

* removed wildcard imports

* fixed black lint errors

* change flake8 settings

* remove wildcard import and fix black lint errors

* removed wildcard import

* fixed black lint check

* config changes

* remove old log message in handle_changed_setting()

* simplified condition for Time-To-Go/Soc

* fix renogy import

* added BMS info and cleanup
* MNB
* Revov
* Sinowealth

* moved BMS to subfolder

* moved BMS to subfolder

* corrected installble to run correct script

* Added self.unique_identifier to the battery class
Used to identify a BMS when multiple BMS are connected
planned for future use

* changed ble service name
from `dbus-blebattery-$1` to `dbus-blebattery.$1` like the non ble service

* read installed capacity at startup

* disable ANT BMS by default
#479

* fix cell voltage header parser

* rework daly receive routine

* improve read cell voltages - only work on sufficient data, drop only the bad package on checksum error, not the complete transmission

* allow read_soc to also retry serial transmission

* add daly cell balance state info. cells are red only if unbalanced now

* bump version

* typo

* moved read_serialport_data() to daly.py

* revert read_serialport_data() to the state before my changes

* fix connection log startup message.
now voltage/current/soc are displayed correctly

* black reformatting

* flake config change

* added linear voltage recalculation interval
In the config file can now be defined how often CVL, CCL and DCL is recalculated

* replaced penalty voltage calculation
with automatically calculated penalty voltages to simplify config
max voltage is kept until batteries are balanced

* fix black lint errors

* updated config.default.ini

* update nightly install script

* Removed line

* fixed error in HLPdataBMS4S

* fixed wrong variable assignment
`str` instead of `int`

* updated battery template

* Fix for #450
#450

* Read charge/discharge limit JKBMS
#4

* updated battery template

* Progress with config limits reason

* updated CELL_VOLTAGE_DIFF_TO_RESET_VOLTAGE_LIMIT default value

* added SoC round for LLT/JBD

* fixed log typo

* reworked installation procedure
Bluetooth BMS is now also fetched from config.ini

* Merge branch 'master' into jkbms_ble

* Merge branch 'master' of into jkbms_ble

* GitHub pages config change

* cleanup

* Renamed scripts for better reading #532

* update docusaurus dependencies

* change sh with bash

* limitation reason cleanup

* changed default config settings
FLOAT_CELL_VOLTAGE from 3.350V to 3.375V
LINEAR_LIMITATION_ENABLE from False to True

* removed testing line

* Cleanup duplicated files

Files were moved and not deleted

* Cleanup

* MOSFET temperature was displayed twice after merge

* updated changelog

* Small fixes

* fix disconnection behaviour: on disconnect, show '---' after 10s and 'not connected' after 60s

* fix flake errors

* small fix

* Added: apply max voltage if CVCM_ENABLE is False
before float voltage was applied

* fixed type error

* Added: BMS disconnect behaviour
* Choose to block charge/discharge on disconnect
* Trigger Venus OS alarm

* Changed: Remove wildcard import from dbushelper.py

* small fixes

* flake8 changes

* copied lltjbd_ble from idstein:jdb_ble

* Added and adapted LltJbd_Ble
ATTENTION: Currently it's untested

* small changes

* read production date and append to hardware version

* Set SOC nightly. Button is working, next is send command to bms

* Added: Show additional data in device page
* show self.unique_identifier as serial number
* show self.production as device name

* Added: JKBMS unique identifier & fixed data length

* Added: JKBMS BLE unique identifier

* Added: Jkbms_Ble connection_name()

* Added: Daly unique identifier

* Added: JKBMS BLE serial number, user defined field

* read out daly battery code and use as unique id

* moved production date and added custom field

* clean battery code
strip whitespace and replace one or multiple spaces with one underline
if no battery code generate unique field

* Daly read_capacity change
Read capacity from config file, if no value provided by BMS

* Daly try to fix no reply

* Improvements by @transistorgit

* changed value

* set SOC (and date time) on button press.

* fix battery code parser

* format fix

* format fix

* fix extra long serial timeouts
by calculating max time instead of loop counts

* Small fixes

* updated config file

* updated changelog

* debug daly

* changed release workflow

* Updated from master

* fix blank screen, debug daly

* make Reset SoC a spin box

* fix possible read_capacity problem

* Daly read_balance_state() add missing return

* Daly advanced troubleshooting

* Changed: Improved Daily stability by a lot

* fixes for disable and uninstall
service was not removed and if removed, it was recreated by the serial starter

* optimized USB install method

* updated changelog

* added missing qml to restore-gui.sh

* Improved uninstall

* make executable

* ready to merge with master

---------

Co-authored-by: Eike Baran <derbaranator@gmail.com>
Co-authored-by: Eike Baran <eikebaran89@gmail.com>
Co-authored-by: Tristan Crichton <github@tcrichton.co.uk>
Co-authored-by: Tristan Crichton <stan@tcrichton.co.uk>
Co-authored-by: Stefan Seidel <lkml@stefanseidel.info>
Co-authored-by: seidler2547 <github@stefanseidel.info>
Co-authored-by: Bernd Stahlbock <stahlbock@gmail.com>
Co-authored-by: Bernd <b.stahlbock@gmx.de>
mr-manuel added a commit that referenced this pull request May 18, 2023
* Added: Show specific TimeToSoC points in GUI
Only if 0%, 10%, 20%, 80%, 90% and/or 100% are selected

* Added: Show specific TimeToSoC points in GUI
Only if 0%, 10%, 20%, 80%, 90% and/or 100% are selected

* fix black lint error

* fix black lint error

* Improved JBD BMS soc calculation
#439

* Fix for #397
#484

* small fixes

* sort bms imports

* Add support for HLPdata BMS4S
#505

* Add support for Seplos BMS
#530

* change flake8 settings

* fix black lint errors

* removed wildcard imports

* fixed black lint errors

* change flake8 settings

* remove wildcard import and fix black lint errors

* removed wildcard import

* fixed black lint check

* removed wildcard import, fixed black lint errors

* config changes

* removed wildcard import, fixed black lint errors

* remove old log message in handle_changed_setting()

* remove old log message in handle_changed_setting()

* simplified condition for Time-To-Go/Soc

* simplified condition for Time-To-Go/Soc

* fix renogy import

* fix renogy import

* added BMS info and cleanup
* MNB
* Revov
* Sinowealth

* added BMS info and cleanup
* MNB
* Revov
* Sinowealth

* moved BMS to subfolder

* moved BMS to subfolder

* moved BMS to subfolder

* corrected installble to run correct script

* Added self.unique_identifier to the battery class
Used to identify a BMS when multiple BMS are connected
planned for future use

* Added self.unique_identifier to the battery class
Used to identify a BMS when multiple BMS are connected
planned for future use

* changed ble service name
from `dbus-blebattery-$1` to `dbus-blebattery.$1` like the non ble service

* fix small errors

* read installed capacity at startup

* disable ANT BMS by default
#479

* fix cell voltage header parser

* rework daly receive routine

* improve read cell voltages - only work on sufficient data, drop only the bad package on checksum error, not the complete transmission

* allow read_soc to also retry serial transmission

* add daly cell balance state info. cells are red only if unbalanced now

* bump version

* typo

* moved read_serialport_data() to daly.py

* revert read_serialport_data() to the state before my changes

* fix connection log startup message.
now voltage/current/soc are displayed correctly

* black reformatting

* added linear voltage recalculation interval
In the config file can now be defined how often CVL, CCL and DCL is recalculated

* revert Daly adaption

* replaced penalty voltage calculation
with automatically calculated penalty voltages to simplify config
max voltage is kept until batteries are balanced

* flake config change

* flake config change

* added linear voltage recalculation interval
In the config file can now be defined how often CVL, CCL and DCL is recalculated

* replaced penalty voltage calculation
with automatically calculated penalty voltages to simplify config
max voltage is kept until batteries are balanced

* fix black lint errors

* updated changelog

* disabled ANT BMS by default
#479

* updated config.default.ini

* fix typo

* update nightly install script

* Removed line

* fixed error in HLPdataBMS4S

* fixed wrong variable assignment
`str` instead of `int`

* fixed wrong variable assignment
`str` instead of `int`

* updated battery template

* updated battery template

* Fix for #450
#450

* Read charge/discharge limit JKBMS
#4

* updated battery template

* Progress with config limits reason

* updated CELL_VOLTAGE_DIFF_TO_RESET_VOLTAGE_LIMIT default value

* added SoC round for LLT/JBD

* fixed log typo

* updated nightly script

* Fix for #450
#450

* Read charge/discharge limit JKBMS
#4

* reworked installation procedure
Bluetooth BMS is now also fetched from config.ini

* updated release workflow

* updated readme

* Merge branch 'master' into jkbms_ble

* deploy to github pages only
on changes in master or docusaurus branch

* cleanup

* Merge branch 'master' of into jkbms_ble

* GitHub pages config change

* GitHub pages config change

* cleanup

* Renamed scripts for better reading #532

* update docusaurus dependencies

* Renamed scripts for better reading #532

* update docusaurus dependencies

* change sh with bash

* limitation reason cleanup

* limitation reason cleanup

* changed default config settings
FLOAT_CELL_VOLTAGE from 3.350V to 3.375V
LINEAR_LIMITATION_ENABLE from False to True

* changed default config settings
FLOAT_CELL_VOLTAGE from 3.350V to 3.375V
LINEAR_LIMITATION_ENABLE from False to True

* removed testing line

* Cleanup duplicated files

Files were moved and not deleted

* Cleanup

* MOSFET temperature was displayed twice after merge

* small typo fixes

* updated changelog

* updated changelog

* Small fixes

* fix disconnection behaviour: on disconnect, show '---' after 10s and 'not connected' after 60s

* fix flake errors

* small fix

* fix disconnection behaviour & small fixes
* on disconnect, show '---' after 10s and 'not connected' after 60s by @transistorgit
* small fixes in shell script
* added restart driver script

* fixed file permission

* Added: apply max voltage if CVCM_ENABLE is False
before float voltage was applied

* fixed type error

* Added: BMS disconnect behaviour
* Choose to block charge/discharge on disconnect
* Trigger Venus OS alarm

* Changed: Remove wildcard import from dbushelper.py

* small fixes

* Added: apply max voltage if CVCM_ENABLE is False
before float voltage was applied

* Added: BMS disconnect behaviour
* Choose to block charge/discharge on disconnect
* Trigger Venus OS alarm

* Changed: Remove wildcard import from dbushelper.py

* flake8 changes

* copied lltjbd_ble from idstein:jdb_ble

* Added and adapted LltJbd_Ble
ATTENTION: Currently it's untested

* small changes

* read production date and append to hardware version

* Set SOC nightly. Button is working, next is send command to bms

* Added: Show additional data in device page
* show self.unique_identifier as serial number
* show self.production as device name

* Added: JKBMS unique identifier & fixed data length

* Added: JKBMS BLE unique identifier

* Added: Jkbms_Ble connection_name()

* Added: Daly unique identifier

* Added: JKBMS BLE serial number, user defined field

* Added: Show additional data in device page
* show self.unique_identifier as serial number
* show self.production as device name

* Added: JKBMS unique identifier & fixed data length

* move config.ini before update

* read production date by @tranistorgit
this adds the battery production date

* read out daly battery code and use as unique id

* moved production date and added custom field

* clean battery code
strip whitespace and replace one or multiple spaces with one underline
if no battery code generate unique field

* Daly read_capacity change
Read capacity from config file, if no value provided by BMS

* Daly try to fix no reply

* Improvements by @transistorgit

* changed value

* set SOC (and date time) on button press.

* fix battery code parser

* format fix

* format fix

* fix extra long serial timeouts
by calculating max time instead of loop counts

* Changed: Merged all install files into one

* updated install docs for nightly build

* Small fixes

* changed config backup

* updated config file

* updated changelog

* debug daly

* changed release workflow

* changed release workflow

* changed release workflow

* changed release workflow

* Updated from master

* fix blank screen, debug daly

* make Reset SoC a spin box

* fix possible read_capacity problem

* Daly read_balance_state() add missing return

* Daly advanced troubleshooting

* Changed: Improved Daily stability by a lot

* fixes for disable and uninstall
service was not removed and if removed, it was recreated by the serial starter

* optimized USB install method

* updated changelog

* added missing qml to restore-gui.sh

* optimized USB install method

* Daly improvements
* Set SoC on button press by @transistorgit
* Improved driver stability by @transistorgit & @mr-manuel

* moved production date and added custom field

* changed jkbms_ble to dev

* changed order

* final daly 'broken packages handling'

* Last changes for daly read problem
by @transistorgit

* change version in utils based on GitHub tag

* test automatic release version change

* Added: Configure voltage drop

* test automatic release version change

* fix Daly alarms

* fixes small errors in bash files

* fix missing driver name in restart-driver.sh

* linear mode, allow max voltage on soc thesshold

* Daly added one retry if failed

* fixed LLT/JBD cell balancing display

* rename tar after USB install
fixes #638

* add force buttons

* force buttons working

* fixed removing entries

* implement force charge/discharge

* little bit cleaner soc preset

* use existing serial read/write function

* add stop balancong switch

* use existing serial read/write function

* Changed: Get bg colors from MbStyle for dark mode

* prevent short circuit evaluation

* fix merge errors

* added changelog info

* Fix #648

---------

Co-authored-by: Bernd Stahlbock <stahlbock@gmail.com>
Louisvdw pushed a commit that referenced this pull request May 31, 2023
* Changes 2023.05.18 (#649)

* Added: Show specific TimeToSoC points in GUI
Only if 0%, 10%, 20%, 80%, 90% and/or 100% are selected

* Added: Show specific TimeToSoC points in GUI
Only if 0%, 10%, 20%, 80%, 90% and/or 100% are selected

* fix black lint error

* fix black lint error

* Improved JBD BMS soc calculation
#439

* Fix for #397
#484

* small fixes

* sort bms imports

* Add support for HLPdata BMS4S
#505

* Add support for Seplos BMS
#530

* change flake8 settings

* fix black lint errors

* removed wildcard imports

* fixed black lint errors

* change flake8 settings

* remove wildcard import and fix black lint errors

* removed wildcard import

* fixed black lint check

* removed wildcard import, fixed black lint errors

* config changes

* removed wildcard import, fixed black lint errors

* remove old log message in handle_changed_setting()

* remove old log message in handle_changed_setting()

* simplified condition for Time-To-Go/Soc

* simplified condition for Time-To-Go/Soc

* fix renogy import

* fix renogy import

* added BMS info and cleanup
* MNB
* Revov
* Sinowealth

* added BMS info and cleanup
* MNB
* Revov
* Sinowealth

* moved BMS to subfolder

* moved BMS to subfolder

* moved BMS to subfolder

* corrected installble to run correct script

* Added self.unique_identifier to the battery class
Used to identify a BMS when multiple BMS are connected
planned for future use

* Added self.unique_identifier to the battery class
Used to identify a BMS when multiple BMS are connected
planned for future use

* changed ble service name
from `dbus-blebattery-$1` to `dbus-blebattery.$1` like the non ble service

* fix small errors

* read installed capacity at startup

* disable ANT BMS by default
#479

* fix cell voltage header parser

* rework daly receive routine

* improve read cell voltages - only work on sufficient data, drop only the bad package on checksum error, not the complete transmission

* allow read_soc to also retry serial transmission

* add daly cell balance state info. cells are red only if unbalanced now

* bump version

* typo

* moved read_serialport_data() to daly.py

* revert read_serialport_data() to the state before my changes

* fix connection log startup message.
now voltage/current/soc are displayed correctly

* black reformatting

* added linear voltage recalculation interval
In the config file can now be defined how often CVL, CCL and DCL is recalculated

* revert Daly adaption

* replaced penalty voltage calculation
with automatically calculated penalty voltages to simplify config
max voltage is kept until batteries are balanced

* flake config change

* flake config change

* added linear voltage recalculation interval
In the config file can now be defined how often CVL, CCL and DCL is recalculated

* replaced penalty voltage calculation
with automatically calculated penalty voltages to simplify config
max voltage is kept until batteries are balanced

* fix black lint errors

* updated changelog

* disabled ANT BMS by default
#479

* updated config.default.ini

* fix typo

* update nightly install script

* Removed line

* fixed error in HLPdataBMS4S

* fixed wrong variable assignment
`str` instead of `int`

* fixed wrong variable assignment
`str` instead of `int`

* updated battery template

* updated battery template

* Fix for #450
#450

* Read charge/discharge limit JKBMS
#4

* updated battery template

* Progress with config limits reason

* updated CELL_VOLTAGE_DIFF_TO_RESET_VOLTAGE_LIMIT default value

* added SoC round for LLT/JBD

* fixed log typo

* updated nightly script

* Fix for #450
#450

* Read charge/discharge limit JKBMS
#4

* reworked installation procedure
Bluetooth BMS is now also fetched from config.ini

* updated release workflow

* updated readme

* Merge branch 'master' into jkbms_ble

* deploy to github pages only
on changes in master or docusaurus branch

* cleanup

* Merge branch 'master' of into jkbms_ble

* GitHub pages config change

* GitHub pages config change

* cleanup

* Renamed scripts for better reading #532

* update docusaurus dependencies

* Renamed scripts for better reading #532

* update docusaurus dependencies

* change sh with bash

* limitation reason cleanup

* limitation reason cleanup

* changed default config settings
FLOAT_CELL_VOLTAGE from 3.350V to 3.375V
LINEAR_LIMITATION_ENABLE from False to True

* changed default config settings
FLOAT_CELL_VOLTAGE from 3.350V to 3.375V
LINEAR_LIMITATION_ENABLE from False to True

* removed testing line

* Cleanup duplicated files

Files were moved and not deleted

* Cleanup

* MOSFET temperature was displayed twice after merge

* small typo fixes

* updated changelog

* updated changelog

* Small fixes

* fix disconnection behaviour: on disconnect, show '---' after 10s and 'not connected' after 60s

* fix flake errors

* small fix

* fix disconnection behaviour & small fixes
* on disconnect, show '---' after 10s and 'not connected' after 60s by @transistorgit
* small fixes in shell script
* added restart driver script

* fixed file permission

* Added: apply max voltage if CVCM_ENABLE is False
before float voltage was applied

* fixed type error

* Added: BMS disconnect behaviour
* Choose to block charge/discharge on disconnect
* Trigger Venus OS alarm

* Changed: Remove wildcard import from dbushelper.py

* small fixes

* Added: apply max voltage if CVCM_ENABLE is False
before float voltage was applied

* Added: BMS disconnect behaviour
* Choose to block charge/discharge on disconnect
* Trigger Venus OS alarm

* Changed: Remove wildcard import from dbushelper.py

* flake8 changes

* copied lltjbd_ble from idstein:jdb_ble

* Added and adapted LltJbd_Ble
ATTENTION: Currently it's untested

* small changes

* read production date and append to hardware version

* Set SOC nightly. Button is working, next is send command to bms

* Added: Show additional data in device page
* show self.unique_identifier as serial number
* show self.production as device name

* Added: JKBMS unique identifier & fixed data length

* Added: JKBMS BLE unique identifier

* Added: Jkbms_Ble connection_name()

* Added: Daly unique identifier

* Added: JKBMS BLE serial number, user defined field

* Added: Show additional data in device page
* show self.unique_identifier as serial number
* show self.production as device name

* Added: JKBMS unique identifier & fixed data length

* move config.ini before update

* read production date by @tranistorgit
this adds the battery production date

* read out daly battery code and use as unique id

* moved production date and added custom field

* clean battery code
strip whitespace and replace one or multiple spaces with one underline
if no battery code generate unique field

* Daly read_capacity change
Read capacity from config file, if no value provided by BMS

* Daly try to fix no reply

* Improvements by @transistorgit

* changed value

* set SOC (and date time) on button press.

* fix battery code parser

* format fix

* format fix

* fix extra long serial timeouts
by calculating max time instead of loop counts

* Changed: Merged all install files into one

* updated install docs for nightly build

* Small fixes

* changed config backup

* updated config file

* updated changelog

* debug daly

* changed release workflow

* changed release workflow

* changed release workflow

* changed release workflow

* Updated from master

* fix blank screen, debug daly

* make Reset SoC a spin box

* fix possible read_capacity problem

* Daly read_balance_state() add missing return

* Daly advanced troubleshooting

* Changed: Improved Daily stability by a lot

* fixes for disable and uninstall
service was not removed and if removed, it was recreated by the serial starter

* optimized USB install method

* updated changelog

* added missing qml to restore-gui.sh

* optimized USB install method

* Daly improvements
* Set SoC on button press by @transistorgit
* Improved driver stability by @transistorgit & @mr-manuel

* moved production date and added custom field

* changed jkbms_ble to dev

* changed order

* final daly 'broken packages handling'

* Last changes for daly read problem
by @transistorgit

* change version in utils based on GitHub tag

* test automatic release version change

* Added: Configure voltage drop

* test automatic release version change

* fix Daly alarms

* fixes small errors in bash files

* fix missing driver name in restart-driver.sh

* linear mode, allow max voltage on soc thesshold

* Daly added one retry if failed

* fixed LLT/JBD cell balancing display

* rename tar after USB install
fixes #638

* add force buttons

* force buttons working

* fixed removing entries

* implement force charge/discharge

* little bit cleaner soc preset

* use existing serial read/write function

* add stop balancong switch

* use existing serial read/write function

* Changed: Get bg colors from MbStyle for dark mode

* prevent short circuit evaluation

* fix merge errors

* added changelog info

* Fix #648

---------

Co-authored-by: Bernd Stahlbock <stahlbock@gmail.com>

* Limit control voltage to max cell voltage

* Rework serial parser (#12)

much cleaner code, as it is optimised for the daly protocol

* updated changelog

* fix black lint error

* fixed black lint error

* added infos to battery template

* JDB BLE support (#499)

* Implementing JBD BLE support. It is built upon Bleak
* Additionally, it provides some handling of for up to 4 temperature probes labels T1 (NTC2), T2 (NTC3), T3 (NTC4) and T4 (NTC5). NTC1 is the BMS module temperature itself
* The device page has been extend to provide more details about the actual used hardware (= product name), firmware version and BLE address

* updated changelog

* Add Supoprt for HeltecSmartBMS (YYBMS) using modbus via RS485 connection (#658)

* Changes 2023.05.24 (#667)

* Check Venus OS version before installing

* fix Jkbms_Ble error

* updated changelog

* updated readme and added donation link

* bugfix: Heltec BMS test_connection breaks on other modbus compliant BMS systems

* bugfix: LLTJBD BMS ignore non ASCII letters for hardware version

* updated readme

* Suppress daly read errors (#13)

* updated descriptions

* Changed logging level and give better feedback
* Changed logging level to debug for unneeded messages
* Give the user feedback, if a BMS is found or not. Useful, if only one BMS is tested.

* small fixes

---------

Co-authored-by: Bernd Stahlbock <stahlbock@gmail.com>
Co-authored-by: Oleg Gurevich <oleg@gurevich.de>
Co-authored-by: Bernd <6627385+transistorgit@users.noreply.github.com>
Co-authored-by: Paul Strawder <paulidstein@gmail.com>
Co-authored-by: Raphael Mack <ramack@raphael-mack.de>
Co-authored-by: Strawder, Paul <paul@coach-ai.com>
Copy link
Collaborator

@mr-manuel mr-manuel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Somehow your driver is preventing the BMS that is tested after your BMS from beeing recognized, but it works the second time all BMS were tried.

With your driver
2023-06-12 11:39:08.537982500 INFO:SerialBattery:Starting dbus-serialbattery
2023-06-12 11:39:08.538924500 INFO:SerialBattery:dbus-serialbattery v1.0.20230611dev
2023-06-12 11:39:08.539367500 INFO:SerialBattery:-- Testing BMS: 1 of 3 rounds
2023-06-12 11:39:08.539796500 INFO:SerialBattery:Testing Daly at address "\x40"
2023-06-12 11:39:08.683765500 ERROR:SerialBattery:>>> ERROR: No reply - returning
2023-06-12 11:39:08.684352500 INFO:SerialBattery:Testing Daly at address "\x80"
2023-06-12 11:39:08.824932500 ERROR:SerialBattery:>>> ERROR: No reply - returning
2023-06-12 11:39:08.825681500 INFO:SerialBattery:Testing Ecs
2023-06-12 11:39:08.904741500 ERROR:SerialBattery:>>> ERROR: No reply - returning
2023-06-12 11:39:08.905370500 INFO:SerialBattery:Testing HeltecModbus
2023-06-12 11:39:12.715049500 ERROR:SerialBattery:>>> ERROR: No reply - returning
2023-06-12 11:39:12.716151500 INFO:SerialBattery:Testing HLPdataBMS4S
2023-06-12 11:39:17.241819500 ERROR:SerialBattery:>>> ERROR: No reply - returning
2023-06-12 11:39:17.242373500 INFO:SerialBattery:Testing Jkbms
2023-06-12 11:39:17.523428500 ERROR:SerialBattery:>>> ERROR: No reply - returning
2023-06-12 11:39:17.526613500 INFO:SerialBattery:Testing Lifepower
2023-06-12 11:39:17.811083500 ERROR:SerialBattery:>>> ERROR: No reply - returning
2023-06-12 11:39:17.814712500 INFO:SerialBattery:Testing LltJbd
2023-06-12 11:39:18.095208500 ERROR:SerialBattery:>>> ERROR: No reply - returning
2023-06-12 11:39:18.098686500 INFO:SerialBattery:Testing Renogy at address "\x30"
2023-06-12 11:39:18.386284500 ERROR:SerialBattery:>>> ERROR: No reply - returning
2023-06-12 11:39:18.389648500 INFO:SerialBattery:Testing Renogy at address "\xf7"
2023-06-12 11:39:18.668034500 ERROR:SerialBattery:>>> ERROR: No reply - returning
2023-06-12 11:39:18.671680500 INFO:SerialBattery:Testing Seplos
2023-06-12 11:39:19.695775500 ERROR:SerialBattery:>>> ERROR: No reply - returning
2023-06-12 11:39:19.696289500 INFO:SerialBattery:Testing ANT
2023-06-12 11:39:19.985956500 ERROR:SerialBattery:>>> ERROR: No reply - returning
2023-06-12 11:39:19.989579500 ERROR:SerialBattery:>>> ERROR: Incorrect Data
2023-06-12 11:39:19.990051500 INFO:SerialBattery:Testing Sinowealth
2023-06-12 11:39:20.272670500 ERROR:SerialBattery:>>> ERROR: No reply - returning
2023-06-12 11:39:20.779821500 INFO:SerialBattery:-- Testing BMS: 2 of 3 rounds
2023-06-12 11:39:20.779834500 INFO:SerialBattery:Testing Daly at address "\x40"
2023-06-12 11:39:20.920201500 ERROR:SerialBattery:>>> ERROR: No reply - returning
2023-06-12 11:39:20.920850500 INFO:SerialBattery:Testing Daly at address "\x80"
2023-06-12 11:39:21.061789500 ERROR:SerialBattery:>>> ERROR: No reply - returning
2023-06-12 11:39:21.062332500 INFO:SerialBattery:Testing Ecs
2023-06-12 11:39:21.488360500 ERROR:SerialBattery:>>> ERROR: No reply - returning
2023-06-12 11:39:21.488884500 INFO:SerialBattery:Testing HeltecModbus
2023-06-12 11:39:25.311045500 ERROR:SerialBattery:>>> ERROR: No reply - returning
2023-06-12 11:39:25.311557500 INFO:SerialBattery:Testing HLPdataBMS4S
2023-06-12 11:39:29.838805500 ERROR:SerialBattery:>>> ERROR: No reply - returning
2023-06-12 11:39:29.839388500 INFO:SerialBattery:Testing Jkbms
2023-06-12 11:39:29.979059500 INFO:SerialBattery:Connection established to Jkbms
2023-06-12 11:39:29.979579500 INFO:SerialBattery:Battery Jkbms connected to dbus from /dev/ttyUSB0
2023-06-12 11:39:29.979980500 INFO:SerialBattery:========== Settings ==========
2023-06-12 11:39:29.980431500 INFO:SerialBattery:> Connection voltage: 63.95V | Current: -0.0A | SoC: 94%
2023-06-12 11:39:29.980804500 INFO:SerialBattery:> Cell count: 18 | Cells populated: 0
2023-06-12 11:39:29.981186500 INFO:SerialBattery:> LINEAR LIMITATION ENABLE: True
2023-06-12 11:39:29.981580500 INFO:SerialBattery:> MAX BATTERY CHARGE CURRENT: 80.0A | MAX BATTERY DISCHARGE CURRENT: 120.0A
2023-06-12 11:39:29.981945500 INFO:SerialBattery:> CVCM:     True
2023-06-12 11:39:29.982320500 INFO:SerialBattery:> MIN CELL VOLTAGE: 2.9V | MAX CELL VOLTAGE: 3.65V
2023-06-12 11:39:29.982687500 INFO:SerialBattery:> CCCM CV:  True  | DCCM CV:  True
2023-06-12 11:39:29.983054500 INFO:SerialBattery:> CCCM T:   True  | DCCM T:   True
2023-06-12 11:39:29.983416500 INFO:SerialBattery:> CCCM SOC: False | DCCM SOC: False
2023-06-12 11:39:29.983771500 INFO:SerialBattery:Serial Number/Unique Identifier: Battery1_JK-B2A24S15P
2023-06-12 11:39:30.032444500 INFO:SerialBattery:DeviceInstance = 1
2023-06-12 11:39:30.033034500 INFO:SerialBattery:com.victronenergy.battery.ttyUSB0
2023-06-12 11:39:30.057118500 INFO:SerialBattery:publish config values = 1
Without your driver
2023-06-12 11:36:29.637534500 INFO:SerialBattery:Starting dbus-serialbattery
2023-06-12 11:36:29.638513500 INFO:SerialBattery:dbus-serialbattery v1.0.20230611dev
2023-06-12 11:36:29.638978500 INFO:SerialBattery:-- Testing BMS: 1 of 3 rounds
2023-06-12 11:36:29.639398500 INFO:SerialBattery:Testing Daly at address "\x40"
2023-06-12 11:36:29.783860500 ERROR:SerialBattery:>>> ERROR: No reply - returning
2023-06-12 11:36:29.784490500 INFO:SerialBattery:Testing Daly at address "\x80"
2023-06-12 11:36:29.924793500 ERROR:SerialBattery:>>> ERROR: No reply - returning
2023-06-12 11:36:29.925420500 INFO:SerialBattery:Testing Ecs
2023-06-12 11:36:30.003559500 ERROR:SerialBattery:>>> ERROR: No reply - returning
2023-06-12 11:36:30.004095500 INFO:SerialBattery:Testing HeltecModbus
2023-06-12 11:36:33.811255500 ERROR:SerialBattery:>>> ERROR: No reply - returning
2023-06-12 11:36:33.812354500 INFO:SerialBattery:Testing Jkbms
2023-06-12 11:36:33.879719500 INFO:SerialBattery:Connection established to Jkbms
2023-06-12 11:36:33.880345500 INFO:SerialBattery:Battery Jkbms connected to dbus from /dev/ttyUSB0
2023-06-12 11:36:33.880815500 INFO:SerialBattery:========== Settings ==========
2023-06-12 11:36:33.881390500 INFO:SerialBattery:> Connection voltage: 64.05V | Current: -0.0A | SoC: 94%
2023-06-12 11:36:33.881932500 INFO:SerialBattery:> Cell count: 18 | Cells populated: 0
2023-06-12 11:36:33.882503500 INFO:SerialBattery:> LINEAR LIMITATION ENABLE: True
2023-06-12 11:36:33.883019500 INFO:SerialBattery:> MAX BATTERY CHARGE CURRENT: 80.0A | MAX BATTERY DISCHARGE CURRENT: 120.0A
2023-06-12 11:36:33.883456500 INFO:SerialBattery:> CVCM:     True
2023-06-12 11:36:33.883916500 INFO:SerialBattery:> MIN CELL VOLTAGE: 2.9V | MAX CELL VOLTAGE: 3.65V
2023-06-12 11:36:33.884350500 INFO:SerialBattery:> CCCM CV:  True  | DCCM CV:  True
2023-06-12 11:36:33.884780500 INFO:SerialBattery:> CCCM T:   True  | DCCM T:   True
2023-06-12 11:36:33.885268500 INFO:SerialBattery:> CCCM SOC: False | DCCM SOC: False
2023-06-12 11:36:33.885744500 INFO:SerialBattery:Serial Number/Unique Identifier: Battery1_JK-B2A24S15P
2023-06-12 11:36:33.936144500 INFO:SerialBattery:DeviceInstance = 1
2023-06-12 11:36:33.936704500 INFO:SerialBattery:com.victronenergy.battery.ttyUSB0
2023-06-12 11:36:33.960843500 INFO:SerialBattery:publish config values = 1

Could you check that please? Else we have to disable the driver by default.

return

def read_test_data(self):
test_data = self.read_serial_data_HLPdataBMS4S(b"pv\n", 1, 15)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the wait time of 1 second be reduced?

ser.flushInput()
ser.write(command)
sleep(time)
res = ser.read(1000)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it always 1000? Why are you not using toread = ser.inWaiting()?

@peterohman
Copy link
Contributor Author

peterohman commented Jun 12, 2023 via email

@mr-manuel
Copy link
Collaborator

I’ve noticed that the driver before hlpdatabms4s leaves data in the hlpdatabms4s inputbuffer since it does not read it until a linefeed is received, which makes it’s initial test fail every time. This problem must be the same for all drivers.

That is a good find. I will dig a bit deeper and see how I can solve this for all. Then I will remove it again from your driver, if that's the case.

@transistorgit maybe you have an idea on how to do that?

@transistorgit
Copy link
Contributor

2 points:

A

I don't think "old data" from the last driver is an issue, because the utils.read_serialport_data() does always

        ser.flushOutput()
        ser.flushInput()

as first action. So the buffer is clean. There is one chance for this to be a problem nevertheless: there can by still comming new data in, or an always-sending device is connected (like a german gridmeter)

This leads to point

B

I already complained about the serial parser. It lacks some significant basic parsing elements, like checking the frame (header/startbyte, tail/checksum, significant other bytes that are specific to the expected answer. This is due to the aim to have a very universal receive routine, but this makes it very vulnerable. If there are excessive bytes before the telegram or there are bit errors (which come on any serial transmission statistically) this parser will just gulp what comes in. In this particular case, the drivers parse the wrong byte as packet length.
I changed daly.py to use a local implementation to fix that. I think it makes no sense to try to improve the "universal" approach, the protocols are too different. Each driver should have it's local optimised parser.

I just saw that @peterohman also wrote his own parser, what is a good thing. Of course it should not wait for 1000 bytes, though. And the string "BMS4S" as a header marker could be found somewhere at the end of the string which will let crash the later index based parser. The buffer length is not checked.

@peterohman
Copy link
Contributor Author

peterohman commented Jun 12, 2023 via email

mr-manuel added a commit to mr-manuel/venus-os_dbus-serialbattery that referenced this pull request Jun 15, 2023
@peterohman
Copy link
Contributor Author

peterohman commented Jun 15, 2023 via email

Louisvdw pushed a commit that referenced this pull request Nov 25, 2023
* Update reinstall-local.sh: Fixed charge current parameter

Update reinstall-local.sh: Corrected charge current parameter for  initial config.ini

* Exclude devices from driver startup
This prevents blocking the serial port

* implement callback function for update

* fix comments to reflect new logic

* update changelog

* set soc=100% when charge mode changes to float, apply exponential smoothing on current readout

* remove scan for devices

the scan for devices and check if the BMS to test is present doesn't add value
if the device is not within range (or the MAC is wrong), then the subsequent start_scraping call will either fail or fail to produce usable data

* JKBMS_BLE driver fixes

* added Bluetooth signal strenght, increased debug

* Optimized reinstallation procedure
- Changed: Optimized restart sequence for the bluetooth installation
- Changed: Run serial part first and then bluetooth part. This allows the serial driver to get operative faster
- Removed: $DRIVERNAME variable for clearer paths
- Removed: Bluetooth system driver restart, since the devices get disconnected by the service before starting the dbus-serialbatterydriver

* Improved Jkbms_Ble error handling

* optimized disable procedure

* small fixes

* save custom name and make it restart persistant
#100

* changed unique identifier from string to function
function can be overridden by BMS battery class

* fix typo

* fix Sinowealth not loading
#702

* fix unique identifier function

* enable BMS over config, if disabled by default
Now you can also add more then one BMS for BMS_TYPE

* show battery port in log

* ANT BMS fixes
Fixed that other devices are recognized as ANT BMS

* Sinowealth BMS fixes
Fixed that other devices are recognized as Sinowealth BMS

* improved publish_battery error handling
switched from error count to seconds

* Improve Battery Voltage Handling in Linear Absorption Mode

* Refactor change time() to int(time()) for consistency in max_voltage_start_time and tDiff calculation
* Refactor battery voltage calculations for efficiency and clarity
* Remove penalty_buffer
* Reset max_voltage_start_time wenn we going to bulk(dynamic) mode

* updated changelog

* fix reply processing

* Reduce the big inrush current, if the CVL jumps
from Bulk/Absorbtion to Float
fix #659

* Check returned data lenght for Seplos BMS

Be stricter about the return data we accept, might fix the problem of grid meters accidently being recognized as a Seplos

* Validate current, voltage, capacity and SoC for all BMS
This prevents that a device, which is no BMS, is detected as BMS

* removed double check

* bump version

* fix validation if None

* updated changelog

* proposal to #659 formatted :)

* bugfix proposal to #659

* refactor setting float charge_mode

* fix type error, removed bluetooth cronjob

* updated changelog

* fix rs485 write communication errors by inserting sleeps, add debug print for charge mode and fix crash on write soc failures

* fix write problem on set_soc. also changed the switch charge/discharge function, just in case

* debug msg

* Bluetooth optimizations

* Fixes by @peterohman
#505 (comment)

* fix #712

* fix meaningless time to go values

* fix meaningless time to go values

* Duration of transition to float depends on number of cells

* Float transition - Voltage drop per second

* Update hlpdatabms4s.py

* Validate setting of FLOAT_CELL_VOLTAGE and avoid misconfiguration

* consider utils.LINEAR_RECALCULATION_EVERY to refresh CVL

* cleanup

* consider utils.LINEAR_RECALCULATION_EVERY to refresh CVL

* small refactor, introduced set_cvl_linear function to set CVL only once every LINEAR_RECALCULATION_EVERY seconds

* fix typo

* updated changelog

* remove debug msg

* remove debug msg

* undo debug change

* Daly BMS make auto reset soc configurable

* added debug and error information for CVL

* fix proposal for #733 (#735)

* Added: Tollerance to enter float voltage once the timer is triggered

* Add bulk voltage
Load to bulk voltage every x days to reset the SoC to 100% for some BMS

* JKBMS disable high voltage warning on bulk
reenable after bulk was completed

* fixed error

* disable high voltage warning for all BMS
when charging to bulk voltage

* fix error and change default value
measurementToleranceVariation from 0.025 to 0.5 else in OffGrid mode max voltage is always kept

* Added temperature names to dbus/mqtt

* Use current avg of last 300 cycles for TTG & TTS

* Calculate only positive Time-to-SoC points

* added current average of last 5 minutes

* make CCL and DCL more clear

* fix small error

* bugfix: LLTJBD BMS SOC different in Xiaoxiang app and dbus-serialbattery

* black formatting

* JDB BMS - Control FETs for charge, discharge and disable / enable balancer (#761)

* feature: Allow to control charge / discharge FET
* feature: Allow to enable / disable balancer

* bugfix: Cycle Capacity is in 10 mAh

Fixes SoC with factor 100 * 100% percentage

* JBD BMS show balancer state in GUI page IO (#763)

* Bump version

* Fix typos

* Smaller fixes
- fixes #792 (comment)

* Removed comments from utils.py
This should make more clear that there are no values to change

* Updated changelog

* possible fix for LLT/JBS connection problems
#769
#777

* bugfix: LLT/JBD BMS general packet data size check

* improved reinstall and disable script

* LLT/JBD BMS - Improved error handling and automatical driver restart
in case of error. Should fix:
- #730
- #769
- #777

* Fixed Building wheel for dbus-fast won't finish on weak systems
Fixes #785

* Support for Daly CAN Bus (#169)

* support for Daly CAN Bus
* fix constructor args
* revert port, needs fix
* add can filters
* comment logger

Some changes are still needed to work with the latest version. They will follow in a next PR.

---------

Co-authored-by: Samuel Brucksch <samuel@iternio.com>
Co-authored-by: Manuel <mr-manuel@outlook.it>

* JKBMS BLE - Introduction of automatic SOC reset (HW Version 11) (#736)

* Introduction of automatic SOC reset for JK BMS (HW Version 11)
* Fixed value mapping
* Rework of the code to make it simpler to use without additional configuration.
Moved execution of SOC reset. It's now executed while changing from "Float" to "Float Transition".
* Implementation of suggested changes
Persist initial BMS OVP and OVPR settings
Make use of max_cell_voltage to calculate trigger value for OVP alert

* Added: Daly CAN and JKBMS CAN

* added CAN bms to installation script
optimized CAN drivers

* smaller fixes

* Trigger JK BLE SOC reset when using Step Mode

* Moved trigger_soc_reset()

* fixes LLT/JBD SOC > 100%
#769

* changed VOLTAGE_DROP behaviour

* Fix JKBMS not starting if BMS manuf. date is empty

* corrected bulk, absorption and soc reset terms

* fix typo

* add JKBMS_BLE debugging data

* fix small error

* added logging to config

* add sleep before starting driver
prevents lot of timeouts after reinstalling the driver, since the restart is now much faster than before

* changed post install info

* fix error

* Daly BMS fixed embedded null byte
#837

* added info for SoC reset to default config file

* fix for #716
#716

* fix for #716 and JKBMS model recognition
#716

* optimized logging

* fix JKBMS recognition

* added debugging

* fixes #716
#716

---------

Co-authored-by: Holger Schultheiß <hoschult@web.de>
Co-authored-by: Stefan Seidel <lkml@stefanseidel.info>
Co-authored-by: Bernd Stahlbock <6627385+transistorgit@users.noreply.github.com>
Co-authored-by: seidler2547 <github@stefanseidel.info>
Co-authored-by: ogurevich <50322596+ogurevich@users.noreply.github.com>
Co-authored-by: wollew <wollew@users.noreply.github.com>
Co-authored-by: Oleg Gurevich <oleg@gurevich.de>
Co-authored-by: peterohman <psub@fieber.se>
Co-authored-by: Strawder, Paul <paul@coach-ai.com>
Co-authored-by: Paul Strawder <paulidstein@gmail.com>
Co-authored-by: Samuel Brucksch <SamuelBrucksch@users.noreply.github.com>
Co-authored-by: Samuel Brucksch <samuel@iternio.com>
Co-authored-by: ArendsM <136503378+ArendsM@users.noreply.github.com>
Co-authored-by: Meik Arends <github@arends.info>
Louisvdw pushed a commit that referenced this pull request Feb 28, 2024
* fix Sinowealth not loading
#702

* fix unique identifier function

* enable BMS over config, if disabled by default
Now you can also add more then one BMS for BMS_TYPE

* show battery port in log

* ANT BMS fixes
Fixed that other devices are recognized as ANT BMS

* Sinowealth BMS fixes
Fixed that other devices are recognized as Sinowealth BMS

* improved publish_battery error handling
switched from error count to seconds

* Improve Battery Voltage Handling in Linear Absorption Mode

* Refactor change time() to int(time()) for consistency in max_voltage_start_time and tDiff calculation
* Refactor battery voltage calculations for efficiency and clarity
* Remove penalty_buffer
* Reset max_voltage_start_time wenn we going to bulk(dynamic) mode

* updated changelog

* fix reply processing

* Reduce the big inrush current, if the CVL jumps
from Bulk/Absorbtion to Float
fix #659

* Check returned data lenght for Seplos BMS

Be stricter about the return data we accept, might fix the problem of grid meters accidently being recognized as a Seplos

* Validate current, voltage, capacity and SoC for all BMS
This prevents that a device, which is no BMS, is detected as BMS

* removed double check

* bump version

* fix validation if None

* updated changelog

* proposal to #659 formatted :)

* bugfix proposal to #659

* refactor setting float charge_mode

* fix type error, removed bluetooth cronjob

* updated changelog

* fix rs485 write communication errors by inserting sleeps, add debug print for charge mode and fix crash on write soc failures

* fix write problem on set_soc. also changed the switch charge/discharge function, just in case

* debug msg

* Bluetooth optimizations

* Fixes by @peterohman
#505 (comment)

* fix #712

* fix meaningless time to go values

* fix meaningless time to go values

* Duration of transition to float depends on number of cells

* Float transition - Voltage drop per second

* Update hlpdatabms4s.py

* Validate setting of FLOAT_CELL_VOLTAGE and avoid misconfiguration

* consider utils.LINEAR_RECALCULATION_EVERY to refresh CVL

* cleanup

* consider utils.LINEAR_RECALCULATION_EVERY to refresh CVL

* small refactor, introduced set_cvl_linear function to set CVL only once every LINEAR_RECALCULATION_EVERY seconds

* fix typo

* updated changelog

* remove debug msg

* remove debug msg

* undo debug change

* Daly BMS make auto reset soc configurable

* added debug and error information for CVL

* fix proposal for #733 (#735)

* Added: Tollerance to enter float voltage once the timer is triggered

* Add bulk voltage
Load to bulk voltage every x days to reset the SoC to 100% for some BMS

* JKBMS disable high voltage warning on bulk
reenable after bulk was completed

* fixed error

* disable high voltage warning for all BMS
when charging to bulk voltage

* fix error and change default value
measurementToleranceVariation from 0.025 to 0.5 else in OffGrid mode max voltage is always kept

* Added temperature names to dbus/mqtt

* Use current avg of last 300 cycles for TTG & TTS

* Calculate only positive Time-to-SoC points

* added current average of last 5 minutes

* make CCL and DCL more clear

* fix small error

* bugfix: LLTJBD BMS SOC different in Xiaoxiang app and dbus-serialbattery

* black formatting

* JDB BMS - Control FETs for charge, discharge and disable / enable balancer (#761)

* feature: Allow to control charge / discharge FET
* feature: Allow to enable / disable balancer

* bugfix: Cycle Capacity is in 10 mAh

Fixes SoC with factor 100 * 100% percentage

* JBD BMS show balancer state in GUI page IO (#763)

* Bump version

* Fix typos

* Smaller fixes
- fixes #792 (comment)

* Removed comments from utils.py
This should make more clear that there are no values to change

* Updated changelog

* possible fix for LLT/JBS connection problems
#769
#777

* bugfix: LLT/JBD BMS general packet data size check

* improved reinstall and disable script

* LLT/JBD BMS - Improved error handling and automatical driver restart
in case of error. Should fix:
- #730
- #769
- #777

* Fixed Building wheel for dbus-fast won't finish on weak systems
Fixes #785

* Support for Daly CAN Bus (#169)

* support for Daly CAN Bus
* fix constructor args
* revert port, needs fix
* add can filters
* comment logger

Some changes are still needed to work with the latest version. They will follow in a next PR.

---------

Co-authored-by: Samuel Brucksch <samuel@iternio.com>
Co-authored-by: Manuel <mr-manuel@outlook.it>

* JKBMS BLE - Introduction of automatic SOC reset (HW Version 11) (#736)

* Introduction of automatic SOC reset for JK BMS (HW Version 11)
* Fixed value mapping
* Rework of the code to make it simpler to use without additional configuration.
Moved execution of SOC reset. It's now executed while changing from "Float" to "Float Transition".
* Implementation of suggested changes
Persist initial BMS OVP and OVPR settings
Make use of max_cell_voltage to calculate trigger value for OVP alert

* Added: Daly CAN and JKBMS CAN

* added CAN bms to installation script
optimized CAN drivers

* smaller fixes

* Trigger JK BLE SOC reset when using Step Mode

* Moved trigger_soc_reset()

* fixes LLT/JBD SOC > 100%
#769

* changed VOLTAGE_DROP behaviour

* Fix JKBMS not starting if BMS manuf. date is empty

* corrected bulk, absorption and soc reset terms

* fix typo

* add JKBMS_BLE debugging data

* fix small error

* Some changes for lost bluetooth connection / hci_uart stack restart

* added logging to config

* add sleep before starting driver
prevents lot of timeouts after reinstalling the driver, since the restart is now much faster than before

* changed post install info

* fix error

* Daly BMS fixed embedded null byte
#837

* added info for SoC reset to default config file

* fix for #716
#716

* fix for #716 and JKBMS model recognition
#716

* optimized logging

* fix JKBMS recognition

* added debugging

* fixes #716
#716

* Bind device instance to unique_identifier
#718

* added data types to battery class
disabled unused variables

* save current charge state
#840

* correct file permissions

* updated changelog

* added periodic saveChargeDetails

* fix some small errors

* fix issue with ruuvi tags
When there are hundreds of unused ruuvi tags in the settings list that where added because thei where nearby the driver does not start correctly. These stale entries are disabled on the driver startup.
The issue was already filed to Victron developers

* CVL with i-controller instead of penaltysum

* cvl_controller: switch to choose PenaltySum or ICOntroller + documentation

* docu enhancement

* Add setting and install logic for usb bluetooth module

* round temperatures

* changed battery disconnect behaviour

* Fixes #891
#891

* updated changelog

* Add bluetooth device note to config.default.ini

* Fix typo in bluetooth note in config.default.ini

* fixed error in new cvl_controller

* fixed float division by zero and code optimization

* Restart MAX_VOLTAGE_TIME_SEC if cell diff > CELL_VOLTAGE_DIFF_KEEP_MAX_VOLTAGE_TIME_RESTART

* Calculation of the SOC based on coloumb-counting (#868)

* Calculation of the SOC in the driver based on coloumb-counting

* soc_calc: add current correction before integration

* soc_calc: correction map for current

* Soc_calc: CorrectionMap, switch to turn on/off correction, selectable initial value

* soc_calc: Bugfix

* soc_calc: Bugfix

* store soc in dbus for restart

* store soc in dbus for restart (formatted)

* store soc in dbus for restart (bugfix)

* save soc_calc only after change > 1.0

* store soc in dbus for restart (bugfix)

* logger does not work this way. do not know why

* writing and reading to dbus works

* Removed options: SOC_CALC_CURRENT_CORRECTION, SOC_CALC_RESET_VALUE_ON_RESTART, SOC_CALC_INIT_VALUE
sort soc_calc alphabetically

* fixed comments

* Updated changelog, small fixes

* Changed: PUBLISH_CONFIG_VALUES from 0/1 to True/False

* Changed: Code optimizations
- Changed some variables to be more clear
- Added comments for easier code understanding

* Calculated SOC: Added two decimals, added BMS SOC for MQTT & Node-RED

* Updated changelog, small fixes

* Changed: PUBLISH_CONFIG_VALUES from 0/1 to True/False

* Changed: Code optimizations
- Changed some variables to be more clear
- Added comments for easier code understanding

* Calculated SOC: Added two decimals, added BMS SOC for MQTT & Node-RED

* Fix #898
#898

* Changed: Fix issue loading settings from dbus

* Added nightly install option
makes it easier for users to pretest fixes

* Changed: more detailed error output when an exception happens

* Possible fix for #912
#912

* Fixes #919
#919

* Changed: Exit script with error, if port excluded
else the serialstarter stops at the dbus-serialbattery

* Fixed some smaller errors

* Updated pre-release workflow

* Fix JK BMS connection restart when bluetooth fails.

This fix installs a new thread to monitor the state of the original
scraping thread.
If scraping thread dies, it verifies that it did not because the
scraping was intentionally stopped by calling stop_scrapping.
When restarting the scrapper, it first calls the bluetooth
reset lambda function that was passed in the class contructor, such that
bluetooth is ready to make a proper connection.

* Fixes #916
#916

* Added Venus OS version to logfile

* Fix #840
#840

* Small code formatting fixes

* Optimized reinstall script. Restart GUI only on changes.

* Display debugging data in GUI when DEBUG enabled

* Install script now shows repositories and version numbers

* Update daly_can.py

Fixing #950 for DalyBMS

* Update jkbms_can.py

Fixing #950 for Jk BMS

* Fix black lint check

* Fixes #970
#970

* Fixed some errors in restoring values from dbus settings

* Moved sleep on start for all BMS

* Update config description

* Reworked a part of the default config

* fix typo in stopping services when reinstalling

* Fix Time-to-SoC and Time-to-Go calculation

* Add changelog info

* Round sum and diff voltage

* Temperature limitation variables where changed

* SoC limitation variables where changed

* Added error messages

* Remove unneeded code

* Reset SoC to 0% if empty

* Add GUIv2 for dbus-serialbattery

* Check free space before installing

* Added new GUIv2 version

* Removed Python 2 compatibility

* Changelog update

* Code cleanup
- Removed: get_temperatures()
- Removed: update_last_seen()

* Bluetooth code optimizations

* Fixed some JKBMS BLE not starting
#819

* Check if packages are already installed before install

* Fixed some SOC calculation errors

* Fixed None SOC on driver start

* Do not show and allow button change when callback is missing for:
- ForceChargingOff
- ForceDischargingOff
- TurnBalancingOff

* Check if a device instance is already used by creating a PID file

* Log and execute SOC reset to 100% or 0% only once

* Update GitHub workflow and issue templates

* Fixed LLT/JBD BMS with only on temperature sensor #791
#971

* Fix warning on reinstall

* Fix missing IO control for JBDBMS #992
#992

* Prepare for removing dev branch

---------

Co-authored-by: ogurevich <50322596+ogurevich@users.noreply.github.com>
Co-authored-by: Bernd Stahlbock <6627385+transistorgit@users.noreply.github.com>
Co-authored-by: wollew <wollew@users.noreply.github.com>
Co-authored-by: Oleg Gurevich <oleg@gurevich.de>
Co-authored-by: peterohman <psub@fieber.se>
Co-authored-by: Strawder, Paul <paul@coach-ai.com>
Co-authored-by: Paul Strawder <paulidstein@gmail.com>
Co-authored-by: Samuel Brucksch <SamuelBrucksch@users.noreply.github.com>
Co-authored-by: Samuel Brucksch <samuel@iternio.com>
Co-authored-by: ArendsM <136503378+ArendsM@users.noreply.github.com>
Co-authored-by: Meik Arends <github@arends.info>
Co-authored-by: Marvo2011 <Marvin.Edeler@gmail.com>
Co-authored-by: cflenker <christian.flenker@gmx.de>
Co-authored-by: cflenker <125555670+cflenker@users.noreply.github.com>
Co-authored-by: Cupertino Miranda <cupertinomiranda@gmail.com>
Co-authored-by: Martin Polehla <p0l0us@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants