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 HeltecSmartBMS (YYBMS) using modbus via RS485 connection #658

Merged
merged 17 commits into from
May 24, 2023

Conversation

ramack
Copy link
Contributor

@ramack ramack commented May 21, 2023

This would close #508 / #575

@ramack
Copy link
Contributor Author

ramack commented May 21, 2023

from the CI checking I get the following error:
Error: Resource not accessible by integration
and the warning
Debugging artifacts are unavailable since the 'init' Action failed before it could produce any.

@Louisvdw or @mr-manuel
Could you guide me how to solve those?

@mr-manuel
Copy link
Collaborator

Sure! Thanks for contribution.

Probably you have to enable it in your repository settings under Actions -> General -> Actions permissions select Allow all actions and reusable workflows. Check also in your repository settings under Actions -> General -> Workflow permissions if Read and write permissions are selected.

@mr-manuel
Copy link
Collaborator

Please fill out this table for a new BMS. You can do it in your current branch.

| Feature | Ant | Daly | ECS | HLPdataBMS4S | JK BMS | Life/Tian Power | LLT/JBD | MNB <sup>(1)</sup> | Renogy | Seplos | Sinowealth <sup>(1)</sup> |
| ---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
| Voltage | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| Current | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| Power | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| State Of Charge | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| Battery temperature | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| MOSFET temperature | No | No | No | No | Yes | No | Yes | No | No | No | No |
| Consumed Ah | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| Time-to-go | Calc | Calc | Calc | Calc | Calc | Calc | Calc | Calc | Calc | Calc | Calc |
| Min/max cell voltages | Yes | Yes | No | Yes | Yes | Yes | Yes | No | Yes | Yes | Yes |
| Min/max temperature | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| Installed capacity | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| Available capacity | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| Cell details | No | Yes | Yes | Yes | Yes | Yes | Yes | No | Yes | Yes | ? |
| Balancing status | Yes | No | Yes | No | Yes | Yes | No | No | No | No | ? |
| Raise alarms from the BMS | Yes | Yes | Yes <sup>(2)</sup> | Yes | Yes | Yes | Yes | Yes | Yes | Yes | ? |
| History of charge cycles | Yes | Yes | No | No | Yes | Yes | Yes | No | Yes | Yes | Yes |
| Get CCL/DCL from the BMS | No | No | No | No | Yes | No | No | No | No | No | No |
| Charge current control management (CCCM) | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| Set battery parameters (DVCC) | Calc | Calc | Yes | Yes | Calc | Calc | Calc | Yes | Calc | Calc | Calc |

Are there any special instructions needed that the user needs to know to use this BMS? Like what about the two disabled lines? Please add it here. You can do it also in your current branch.

### BMS specific settings
* ECS BMS &rarr; https://github.com/Louisvdw/dbus-serialbattery/issues/254#issuecomment-1275924313

I will update the docs/contribution guidelines to make things like this more clear and easier. So you have a checklist on what to check.

@ramack
Copy link
Contributor Author

ramack commented May 21, 2023

oh, I see that I created the PR against master, should I choose branch dev instead?

@ramack
Copy link
Contributor Author

ramack commented May 21, 2023

Are there any special instructions needed that the user needs to know to use this BMS? Like what about the two disabled lines? Please add it here. You can do it also in your current branch.

In principle I would say there is nothing special to consider ("connecting the RS485 pins from the BMS to a USB-RS485-converter" I would somehow consider evident 😉)

For the two disabled lines: when I started to work on that these were still in utils.py, where the user was more or less intended to do changes. Now I am not sure what to do... the driver supports different modbus addresses (all in 1:255 are possible) and my mid term target would be to to support multiple BMSs on the same USB-converter by different addresses. - In the driver this seems to be not yet supported, so I am not sure what to do until then. (personal note: I have 4 batteries in parallel and so far only connect one to VenusOS, but want to change that, but ideally with one USB-converter only, so I have already assigned different addresses to them for testing)

@ramack
Copy link
Contributor Author

ramack commented May 21, 2023

For the last line in the table: "Set battery parameters (DVCC)" I am not sure, which aspect the driver would need to support here, can you check if I did it right?

@mr-manuel mr-manuel changed the base branch from master to dev May 22, 2023 06:10
@mr-manuel
Copy link
Collaborator

oh, I see that I created the PR against master, should I choose branch dev instead?

I changed it to the dev branch

In principle I would say there is nothing special to consider ("connecting the RS485 pins from the BMS to a USB-RS485-converter" I would somehow consider evident 😉)

Please add it to the config.default.ini and utils.py (that read the value and store it in a variable) under

; --------- BMS specific settings ---------

I would recommend to add something like:

; -- HeltecSmartBMS settings
; Set the Modbus address from the adapter
HELLTEC_MODBUS_ADDR = 

then in a later moment, then multiple Modbus clients are allowed you can change it to:

; -- HeltecSmartBMS settings
; Set the Modbus addresses from the adapters
; Separate each address by a comma like: 1, 4, 17, ...
HELLTEC_MODBUS_ADDR = 

Please specify in the docs that the Modbus address can be changed though the config file.

If you set in the config.default.ini the factory set address then I would not add more. If you leave it blank, then please add also, that after the instalation the user has to add this to the config file.

For the last line in the table: "Set battery parameters (DVCC)" I am not sure, which aspect the driver would need to support here, can you check if I did it right?

This is when the driver sets CVL, CCL and DCL directly (yes) or if it's calculated by the driver (calc).

@mr-manuel
Copy link
Collaborator

@ramack
Copy link
Contributor Author

ramack commented May 22, 2023

sorry for the millions of commits, but that should be it so far.

@mr-manuel mr-manuel merged commit f19e004 into Louisvdw:dev May 24, 2023
@ramack
Copy link
Contributor Author

ramack commented May 26, 2023

Thanks for merging. It's an honor for me, that you consider my code useful also for others.

@mr-manuel
Copy link
Collaborator

You‘re welcome. Thanks for contributing to the project!

@mr-manuel mr-manuel changed the title Add Supoprt for HeltecSmartBMS (YYBMS) using modbus via RS485 connection Add Support for HeltecSmartBMS (YYBMS) using modbus via RS485 connection May 26, 2023
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 <[email protected]>

* 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 <[email protected]>
Co-authored-by: Oleg Gurevich <[email protected]>
Co-authored-by: Bernd <[email protected]>
Co-authored-by: Paul Strawder <[email protected]>
Co-authored-by: Raphael Mack <[email protected]>
Co-authored-by: Strawder, Paul <[email protected]>
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.

Add Support for Heltec BMS (= YYBMS YanYang)
2 participants