Skip to content

Commit

Permalink
Some improvements and fixes (Louisvdw#468)
Browse files Browse the repository at this point in the history
* added balancing switch status

* added balancing switch status

* changed default config file
- added missing descriptions
- changed name

* indentation was wrong

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

* added cell balancing status for JKBMS

* changed ConsumedAmpHours
should be None instead of 0, if not available

* TimeToSoc fixes
- Added: Show TimeToSoc only, if enabled
- Changed: description in config file
- Changed: default value TIME_TO_SOC_VALUE_TYPE = 1

* resorted functions

* fix CPU overload
- changed: how often Time-To-Soc is calculated in seconds

* fix Time-to-Go and Time-to-SoC
- changed: Time-To-Go has to be always a positive int
since it's used from dbus-systemcalc-py
- changed: how Time-to-SoC is string is generated and displayed
(format like Time-To-Go)

* small fixes

* Show MOSFET temperature from JKBMS
Pull request from @baphomett
Louisvdw#440

* bump version to 1.0.0
respecting semantic versioning

* added uninstall script and fixed reinstall
- `/data/conf/serial-starter.d` was not recreated if deleted

* small fixes
- added description in utils.py
- change qml files in destination not source

* typo

* fixed cell balancing color for cells 13-24

* updated description in default config file

* Updated logging to get relevant informations

* clearer config file

* make config file clearer

* fix Louisvdw#421
- Louisvdw#421

* missing removals

* corrected typo, added missing +x in release.yml

* added info for new issue

* fix black lint errors

* optimize installation scripts

* added script to install directly from repository

* fixed serial-starter.d
Louisvdw#520

* smaller fixes

* fix Louisvdw#351

* fix System Switch in IO page

* fix Louisvdw#239
by @TimGFoley

* fix black lint errors

* run code analyse only on code change

* fix Louisvdw#311

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

* remove duplicated and incorrect log message on handle_changed_setting

* properly log max battery currents on startup

* 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

* fix black lint errors

* 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

* Merge branch 'master' into master

* Added: Show (dis)charge current limitation reason

* Added changelog

* corrected file permissions

* Update readme

* Small word case changes

* 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
by @seidler2547

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

* fix black lint error

* removed wildcard import, fixed black lint errors

* removed wildcard import, fixed black lint errors

* 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

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

* fix small errors

* 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

* updated changelog

* disabled ANT BMS by default
Louisvdw#479

* fix typo

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

* updated battery template

* updated nightly script

* Fix for Louisvdw#450
Louisvdw#450

* Read charge/discharge limit JKBMS
Louisvdw#4

* updated release workflow

* updated readme

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

* cleanup

* GitHub pages config change

* Renamed scripts for better reading Louisvdw#532

* update docusaurus dependencies

* limitation reason cleanup

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

* small typo fixes

* updated changelog

* 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

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

* Changed: Remove wildcard import from dbushelper.py

* 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

---------

Co-authored-by: Daniel Hillenbrand <[email protected]>
  • Loading branch information
mr-manuel and codeworkx authored May 6, 2023
1 parent 9cf3b9a commit e762832
Show file tree
Hide file tree
Showing 52 changed files with 3,671 additions and 2,267 deletions.
22 changes: 7 additions & 15 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
[flake8]
max-line-length = 120
per-file-ignores =
./etc/dbus-serialbattery/utils.py: E501
exclude =
./etc/dbus-serialbattery/ant.py,
./etc/dbus-serialbattery/battery_template.py,
./etc/dbus-serialbattery/daly.py,
./etc/dbus-serialbattery/dbus-serialbattery.py,
./etc/dbus-serialbattery/dbushelper.py,
./etc/dbus-serialbattery/ecs.py,
./etc/dbus-serialbattery/lifepower.py,
./etc/dbus-serialbattery/lltjbd.py,
./etc/dbus-serialbattery/bms/battery_template.py,
./etc/dbus-serialbattery/bms/mnb_test_max17853.py,
./etc/dbus-serialbattery/bms/mnb_utils_max17853.py,
./etc/dbus-serialbattery/bms/revov.py,
./etc/dbus-serialbattery/minimalmodbus.py,
./etc/dbus-serialbattery/mnb.py,
./etc/dbus-serialbattery/renogy.py,
./etc/dbus-serialbattery/revov.py,
./etc/dbus-serialbattery/sinowealth.py,
./etc/dbus-serialbattery/test_max17853.py,
./etc/dbus-serialbattery/util_max17853.py,
./velib_python
venv
extend-ignore:
# E203 whitespace fefore ':' conflicts with black code formatting. Will be ignored in flake8
# E203 whitespace before ':' conflicts with black code formatting. Will be ignored in flake8
E203
7 changes: 6 additions & 1 deletion .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ on:
# Runs on pushes targeting the default branch
push:
# Run on changes in the master branch
#branches: [master]:
branches:
- master
- docusaurus

# Run on changes in the docs folder
paths:
Expand Down Expand Up @@ -37,6 +39,9 @@ jobs:
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest

# execute only in Louisvdw repository
if: github.repository_owner == 'Louisvdw'

#defaults:
# run:
# working-directory: 'docs' # Here the path to the folder where package-lock.json is located.
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,20 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3

- name: build release archive
run: |
find . -type f -name "*.py" -exec chmod +x {} \;
find . -type f -name "*.sh" -exec chmod +x {} \;
find . -type f -name "run" -exec chmod +x {} \;
tar -czvf venus-data.tar.gz \
--mode='a+rwX' \
--exclude battery_template.py \
--exclude __pycache__ \
--exclude restartservice.sh \
--exclude revov.py \
--exclude test_max17853.py \
conf/serial-starter.d \
--exclude bms/battery_template.py \
--exclude bms/revov.py \
--exclude bms/test_max17853.py \
etc/dbus-serialbattery/
- name: Release
uses: softprops/action-gh-release@v1
with:
Expand Down
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,17 @@ cython_debug/
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

# VS Code
.vscode/

# Custom for this repo
venus-data.tar.gz
BMS-trials
.DS_Store
.project
.pydevproject
*.prefs
etc/dbus-serialbattery/config.ini

# Local Clone of velib_python
velib_python
velib_python
71 changes: 71 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Changelog

## v1.0.0

### ATTENTION: Breaking changes! The config is now done in the `config.ini`. All values from the `utils.py` gets lost. The changes in the `config.ini` will persists future updates.

* Added: `self.unique_identifier` to the battery class. Used to identify a BMS when multiple BMS are connected - planned for future use by @mr-manuel
* Added: Alert is triggered, when BMS communication is lost by @mr-manuel
* Added: Apply max voltage, if `CVCM_ENABLE` is `False`. Before float voltage was applied by @mr-manuel
* Added: Balancing status for JKBMS by @mr-manuel
* Added: Balancing switch status for JKBMS by @mr-manuel
* Added: Balancing switch status to the GUI -> SerialBattery -> IO by @mr-manuel
* Added: Block charge/discharge when BMS communication is lost. Can be enabled trough the config file by @mr-manuel
* Added: Charge Mode display by @mr-manuel
* 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: 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: Driver uninstall script by @mr-manuel
* 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: 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: Post install notes by @mr-manuel
* Added: Read charge/discharge limits from JKBMS by @mr-manuel
* Added: Recalculation interval in linear mode for CVL, CCL and DCL by @mr-manuel
* Added: Reset values to None, if battery goes offline (not reachable for 10s). Fixes https://github.com/Louisvdw/dbus-serialbattery/issues/193 https://github.com/Louisvdw/dbus-serialbattery/issues/64 by @transistorgit
* Added: Script to install directly from repository by @mr-manuel
* Added: Show charge mode (absorption, bulk, ...) in Parameters page by @mr-manuel
* Added: Show charge/discharge limitation reason by @mr-manuel
* Added: Show MOSFET temperature for JKBMS https://github.com/Louisvdw/dbus-serialbattery/pull/440 by @baphomett
* Added: Show serial number (used for unique identifier) and device name (custom BMS field) in the remote console/GUI to identify a BMS in a multi battery environment by @mr-manuel
* Added: Show specific TimeToSoC points in GUI, if 0%, 10%, 20%, 80%, 90% and/or 100% are selected by @mr-manuel
* Added: Show TimeToGo in GUI only, if enabled by @mr-manuel
* Added: Support for HLPdata BMS4S https://github.com/Louisvdw/dbus-serialbattery/pull/505 by @peterohman
* Added: Support for Seplos BMS https://github.com/Louisvdw/dbus-serialbattery/pull/530 by @wollew
* Added: Temperature name for temperature sensor 1 & 2. This allows to see which sensor is low and high (e.g. battery and cable) by @mr-manuel
* Changed: `reinstall-local.sh` to recreate `/data/conf/serial-starter.d`, if deleted by `disable.sh` --> to check if the file `conf/serial-starter.d` could now be removed from the repository by @mr-manuel
* Changed: Added QML to `restore-gui.sh` by @mr-manuel
* Changed: Bash output by @mr-manuel
* Changed: Default config file by @mr-manuel
* Added missing descriptions to make it much clearer to understand by @mr-manuel
* Changed name from `default_config.ini` to `config.default.ini` https://github.com/Louisvdw/dbus-serialbattery/pull/412#issuecomment-1434287942 by @mr-manuel
* Changed TimeToSoc default value `TIME_TO_SOC_VALUE_TYPE` from `Both seconds and time string "<seconds> [<days>d <hours>h <minutes>m <seconds>s]"` to `1 Seconds` by @mr-manuel
* Changed TimeToSoc description by @mr-manuel
* Changed value positions, added groups and much clearer descriptions by @mr-manuel
* 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: 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
* Changed: Fix for https://github.com/Louisvdw/dbus-serialbattery/issues/397 by @transistorgit
* Changed: Fix for https://github.com/Louisvdw/dbus-serialbattery/issues/421 by @mr-manuel
* Changed: Fix for https://github.com/Louisvdw/dbus-serialbattery/issues/450 by @mr-manuel
* Changed: Fixed black lint errors by @mr-manuel
* Changed: Fixed cell balancing background for cells 17-24 by @mr-manuel
* Changed: Fixed Time-To-Go is not working, if `TIME_TO_SOC_VALUE_TYPE` is set to other than `1` https://github.com/Louisvdw/dbus-serialbattery/pull/424#issuecomment-1440511018 by @mr-manuel
* 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: Moved BMS scripts to subfolder 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
* Changed: Removed all wildcard imports and fixed black lint errors by @mr-manuel
* Changed: Renamed scripts for better reading #532 by @mr-manuel
* Changed: Reworked and optimized installation scripts by @mr-manuel
* Changed: Separate Time-To-Go and Time-To-SoC activation by @mr-manuel
* Changed: Serial-Starter file is now created from `reinstall-local.sh`. Fixes also https://github.com/Louisvdw/dbus-serialbattery/issues/520 by @mr-manuel
* 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
3 changes: 0 additions & 3 deletions conf/serial-starter.d

This file was deleted.

14 changes: 7 additions & 7 deletions docs/docs/general/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ In [VRM](https://vrm.victronenergy.com/) look under the device list for your ins
2. Run these commands to install or update to the latest release version.

```bash
wget -O /tmp/installrelease.sh https://raw.githubusercontent.com/Louisvdw/dbus-serialbattery/master/etc/dbus-serialbattery/installrelease.sh
wget -O /tmp/install-release.sh https://raw.githubusercontent.com/Louisvdw/dbus-serialbattery/master/etc/dbus-serialbattery/install-release.sh

bash /tmp/installrelease.sh
bash /tmp/install-release.sh

reboot
```
Expand Down Expand Up @@ -138,7 +138,7 @@ If you use the cell voltage limits, temperature limits or SoC limits you also ne

### Settings location/path

💡 After updating the settings reboot the device or run `/data/etc/dbus-serialbattery/reinstalllocal.sh` to apply the changes.
💡 After updating the settings reboot the device or run `/data/etc/dbus-serialbattery/reinstall-local.sh` to apply the changes.

#### Driver version `<= v0.14.3`
Edit `/data/etc/dbus-serialbattery/utils.py` to update the constants.
Expand Down Expand Up @@ -204,7 +204,7 @@ Edit `/data/etc/dbus-serialbattery/dbus-serialbattery.py` and uncommented (witho
You can disable the driver so that it will not be run by the GX device. To do that run the following command in SSH.

```bash
bash /data/etc/dbus-serialbattery/disabledriver.sh
bash /data/etc/dbus-serialbattery/disable.sh
```

You also need to configure your MPPTs to run in `Stand alone mode` again. Follow the Victron guide for [Err 67 - BMS Connection lost](https://www.victronenergy.com/live/mppt-error-codes#err_67_-_bms_connection_lost).
Expand All @@ -213,7 +213,7 @@ You also need to configure your MPPTs to run in `Stand alone mode` again. Follow
To enable the driver again you can run the installer.

```bash
bash /data/etc/dbus-serialbattery/reinstalllocal.sh
bash /data/etc/dbus-serialbattery/reinstall-local.sh
```

## Uninstall/remove the driver
Expand All @@ -236,11 +236,11 @@ rm -rf /opt/victronenergy/service/dbus-serialbattery
rm -rf /opt/victronenergy/service-templates/dbus-serialbattery
rm -rf /opt/victronenergy/dbus-serialbattery

# kill if running
# kill driver, if running
pkill -f "python .*/dbus-serialbattery.py"

# remove install-script from rc.local
sed -i "/sh \/data\/etc\/dbus-serialbattery\/reinstalllocal.sh/d" /data/rc.local
sed -i "/sh \/data\/etc\/dbus-serialbattery\/reinstall-local.sh/d" /data/rc.local
```

> If after the uninstall for some reason several items in the GUI were red, DO NOT reboot your GX device. See [Uninstalling driver bricked my cerbo #576](https://github.com/Louisvdw/dbus-serialbattery/issues/576)
Loading

0 comments on commit e762832

Please sign in to comment.