Skip to content

Commit

Permalink
Changes 2023.05.07
Browse files Browse the repository at this point in the history
Optimizations and added advanced debugging for Daly.
  • Loading branch information
mr-manuel authored May 7, 2023
2 parents cb050e2 + ecb586d commit 13a9f41
Show file tree
Hide file tree
Showing 14 changed files with 333 additions and 155 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/release-beta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Pre-release

on:
push:
tags:
# only match pre release
# matches:
# v1.0.0alpha20230507
# v1.0.0-beta20230507
# v1.0.0-development-20230507
- "v*.*.[0-9]+-?[a-zA-Z]*"

jobs:
build:
runs-on: ubuntu-latest
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 __pycache__ \
--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:
files: venus-data.tar.gz
prerelease: true
6 changes: 5 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ name: Release
on:
push:
tags:
- "v*.*.*"
# do not match pre release
# matches:
# v1.0.0
# v1.0.123
- "v[0-9]+.[0-9]+.[0-9]+"

jobs:
build:
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
* 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: Daly BMS - Improved driver requests by @transistorgit
* Changed: Daly BMS - Improved driver stability by @transistorgit
* Changed: Default config file by @ppuetsch
* 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
Expand Down
21 changes: 21 additions & 0 deletions docs/docs/faq/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,27 @@ See [this page](../general/install#how-to-change-the-default-limits).

See the Victron Energy documentation how to get [root access](https://www.victronenergy.com/live/ccgx:root_access#root_access).


## How to aggregate multiple batteries?

You need an additional driver for that. Here are a few listed:


### [BatteryAggregator](https://github.com/pulquero/BatteryAggregator) by [pulquero](https://github.com/pulquero)

Automatically merges connected batteries. Additional configuration for excluded batteries, total capacity and custom merging possible.

Can be installed through the [SetupHelper](https://github.com/kwindrem/SetupHelper) of [kwindrem](https://github.com/kwindrem).

### [dbus-aggregate-batteries](https://github.com/Dr-Gigavolt/dbus-aggregate-batteries) by [Dr-Gigavolt](https://github.com/Dr-Gigavolt)

Automatically merges connected batteries. Takes consideration of SmartShunt, Multies, Quattros, SmartSolars, BlueSolars and MPPT for current calculation. Additional configuration possible.

### [venus-os_dbus-mqtt-battery](https://github.com/mr-manuel/venus-os_dbus-mqtt-battery) by [mr-manuel](https://github.com/mr-manuel)

Virtual battery that has to be fed over MQTT in case you want to merge your data how you'd like. Venus OS Large with Node-RED recommended.


## Why do I need a BMS for lithium batteries?
Lithuim cells are great at storing energy, but they can be dangerous. An overcharged cell can cause a fire. A Battery Management System (BMS) first priority is to protect the cells in your battery from any potential hazards.

Expand Down
10 changes: 5 additions & 5 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/install-release.sh https://raw.githubusercontent.com/Louisvdw/dbus-serialbattery/master/etc/dbus-serialbattery/install-release.sh
wget -O /tmp/install.sh https://raw.githubusercontent.com/Louisvdw/dbus-serialbattery/master/etc/dbus-serialbattery/install.sh

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

reboot
```
Expand Down Expand Up @@ -110,10 +110,10 @@ In [VRM](https://vrm.victronenergy.com/) look under the device list for your ins
> This version is installed directly from the repository and can contain errors. Not recommended for production environments unless you know what you do.
```bash
wget -O /tmp/install-nightly.sh https://raw.githubusercontent.com/Louisvdw/dbus-serialbattery/jkbms_ble/etc/dbus-serialbattery/install-nightly.sh && bash /tmp/install-nightly.sh
wget -O /tmp/install.sh https://raw.githubusercontent.com/Louisvdw/dbus-serialbattery/jkbms_ble/etc/dbus-serialbattery/install.sh && bash /tmp/install.sh
```

Select `2` for `jkbms_ble`.
Select `2` for `nightly build` and then select the branch you want to install from.

### BMS specific settings

Expand Down Expand Up @@ -239,7 +239,7 @@ rm -rf /opt/victronenergy/dbus-serialbattery
# kill driver, if running
pkill -f "python .*/dbus-serialbattery.py"

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

Expand Down
42 changes: 21 additions & 21 deletions docs/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2064,9 +2064,9 @@
integrity sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw==

"@types/node@*":
version "18.16.3"
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.16.3.tgz#6bda7819aae6ea0b386ebc5b24bdf602f1b42b01"
integrity sha512-OPs5WnnT1xkCBiuQrZA4+YAV4HEJejmHneyraIaxsbev5yCEr6KMwINNFP9wQeFIw8FWcoTqF3vQsa5CDaI+8Q==
version "20.1.0"
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.1.0.tgz#258805edc37c327cf706e64c6957f241ca4c4c20"
integrity sha512-O+z53uwx64xY7D6roOi4+jApDGFg0qn6WHcxe5QeqjMaTezBO/mxdfFXIVAVVyNWKx84OmPB3L8kbVYOTeN34A==

"@types/node@^17.0.5":
version "17.0.45"
Expand Down Expand Up @@ -2125,9 +2125,9 @@
"@types/react" "*"

"@types/react@*":
version "18.2.0"
resolved "https://registry.yarnpkg.com/@types/react/-/react-18.2.0.tgz#15cda145354accfc09a18d2f2305f9fc099ada21"
integrity sha512-0FLj93y5USLHdnhIhABk83rm8XEGA7kH3cr+YUlvxoUGp1xNt/DINUMvqPxLyOQMzLmZe8i4RTHbvb8MC7NmrA==
version "18.2.5"
resolved "https://registry.yarnpkg.com/@types/react/-/react-18.2.5.tgz#f9403e1113b12b53f7edcdd9a900c10dd4b49a59"
integrity sha512-RuoMedzJ5AOh23Dvws13LU9jpZHIc/k90AgmK7CecAYeWmSr3553L4u5rk4sWAPBuQosfT7HmTfG4Rg5o4nGEA==
dependencies:
"@types/prop-types" "*"
"@types/scheduler" "*"
Expand Down Expand Up @@ -2411,9 +2411,9 @@ ajv@^8.0.0, ajv@^8.9.0:
uri-js "^4.2.2"

algoliasearch-helper@^3.10.0:
version "3.12.0"
resolved "https://registry.yarnpkg.com/algoliasearch-helper/-/algoliasearch-helper-3.12.0.tgz#0fe39d49b0290e4aa5e1fe733bd24d857d258e94"
integrity sha512-/j1U3PEwdan0n6P/QqSnSpNSLC5+cEMvyljd5CnmNmUjDlGrys+vFEOwjVEnqELIiAGMHEA/Nl3CiKVFBUYqyQ==
version "3.13.0"
resolved "https://registry.yarnpkg.com/algoliasearch-helper/-/algoliasearch-helper-3.13.0.tgz#1ccca7056fd27c2b0b5c92dd5c0abf4314bec3b8"
integrity sha512-kV3c1jMQCvkARtGsSDvAwuht4PAMSsQILqPiH4WFiARoa3jXJ/r1TQoBWAjWyWF48rsNYCv7kzxgB4LTxrvvuw==
dependencies:
"@algolia/events" "^4.0.1"

Expand Down Expand Up @@ -2789,9 +2789,9 @@ caniuse-api@^3.0.0:
lodash.uniq "^4.5.0"

caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001449, caniuse-lite@^1.0.30001464:
version "1.0.30001482"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001482.tgz#8b3fad73dc35b2674a5c96df2d4f9f1c561435de"
integrity sha512-F1ZInsg53cegyjroxLNW9DmrEQ1SuGRTO1QlpA0o2/6OpQ0gFeDRoq1yFmnr8Sakn9qwwt9DmbxHB6w167OSuQ==
version "1.0.30001485"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001485.tgz#026bb7319f1e483391872dc303a973d4f513f619"
integrity sha512-8aUpZ7sjhlOyiNsg+pgcrTTPUXKh+rg544QYHSvQErljVEKJzvkYkCR/hUFeeVoEfTToUtY9cUKNRC7+c45YkA==

ccount@^1.0.0:
version "1.1.0"
Expand Down Expand Up @@ -3556,9 +3556,9 @@ [email protected]:
integrity sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==

electron-to-chromium@^1.4.284:
version "1.4.380"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.380.tgz#195dc59d930c6b74efbee6f0e6a267ce4af5ed91"
integrity sha512-XKGdI4pWM78eLH2cbXJHiBnWUwFSzZM7XujsB6stDiGu9AeSqziedP6amNLpJzE3i0rLTcfAwdCTs5ecP5yeSg==
version "1.4.385"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.385.tgz#1afd8d6280d510145148777b899ff481c65531ff"
integrity sha512-L9zlje9bIw0h+CwPQumiuVlfMcV4boxRjFIWDcLfFqTZNbkwOExBzfmswytHawObQX4OUhtNv8gIiB21kOurIg==

emoji-regex@^8.0.0:
version "8.0.0"
Expand Down Expand Up @@ -6801,9 +6801,9 @@ [email protected]:
integrity sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==

std-env@^3.0.1:
version "3.3.2"
resolved "https://registry.yarnpkg.com/std-env/-/std-env-3.3.2.tgz#af27343b001616015534292178327b202b9ee955"
integrity sha512-uUZI65yrV2Qva5gqE0+A7uVAvO40iPo6jGhs7s8keRfHCmtg+uB2X6EiLGCI9IgL1J17xGhvoOqSz79lzICPTA==
version "3.3.3"
resolved "https://registry.yarnpkg.com/std-env/-/std-env-3.3.3.tgz#a54f06eb245fdcfef53d56f3c0251f1d5c3d01fe"
integrity sha512-Rz6yejtVyWnVjC1RFvNmYL10kgjC49EOghxWn0RFqlCHGFpQx+Xe7yW3I4ceK1SGrWIGMjD5Kbue8W/udkbMJg==

string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2:
version "4.2.3"
Expand Down Expand Up @@ -7451,9 +7451,9 @@ webpack-sources@^3.2.2, webpack-sources@^3.2.3:
integrity sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==

webpack@^5.73.0:
version "5.81.0"
resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.81.0.tgz#27a2e8466c8b4820d800a8d90f06ef98294f9956"
integrity sha512-AAjaJ9S4hYCVODKLQTgG5p5e11hiMawBwV2v8MYLE0C/6UAGLuAF4n1qa9GOwdxnicaP+5k6M5HrLmD4+gIB8Q==
version "5.82.0"
resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.82.0.tgz#3c0d074dec79401db026b4ba0fb23d6333f88e7d"
integrity sha512-iGNA2fHhnDcV1bONdUu554eZx+XeldsaeQ8T67H6KKHl2nUSwX8Zm7cmzOA46ox/X1ARxf7Bjv8wQ/HsB5fxBg==
dependencies:
"@types/eslint-scope" "^3.7.3"
"@types/estree" "^1.0.0"
Expand Down
70 changes: 57 additions & 13 deletions etc/dbus-serialbattery/bms/daly.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def __init__(self, port, baud, address):
self.cell_max_voltage = None
self.cell_min_no = None
self.cell_max_no = None
self.poll_interval = 500
self.poll_interval = 1000
self.poll_step = 0
self.type = self.BATTERYTYPE
self.has_settings = 1
Expand All @@ -28,19 +28,19 @@ def __init__(self, port, baud, address):

# command bytes [StartFlag=A5][Address=40][Command=94][DataLength=8][8x zero bytes][checksum]
command_base = b"\xA5\x40\x94\x08\x00\x00\x00\x00\x00\x00\x00\x00\x81"
command_set_soc = b"\x21"
command_rated_params = b"\x50"
command_batt_details = b"\x53"
command_batt_code = b"\x57"
command_soc = b"\x90"
command_minmax_cell_volts = b"\x91"
command_minmax_temp = b"\x92"
command_fet = b"\x93"
command_minmax_cell_volts = b"\x91" # no reply
command_minmax_temp = b"\x92" # no reply
command_fet = b"\x93" # no reply
command_status = b"\x94"
command_cell_volts = b"\x95"
command_temp = b"\x96"
command_cell_balance = b"\x97"
command_alarm = b"\x98"
command_rated_params = b"\x50"
command_set_soc = b"\x21"
command_batt_details = b"\x53"
command_batt_code = b"\x57"
command_cell_balance = b"\x97" # no reply
command_alarm = b"\x98" # no reply

BATTERYTYPE = "Daly"
LENGTH_CHECK = 1
Expand All @@ -53,49 +53,86 @@ def test_connection(self):
# The result or call should be unique to this BMS. Battery name or version, etc.
# Return True if success, False for failure
result = False
logger.info("> test_connection: start")
try:
logger.info("> test_connection: open_serial_port")
with open_serial_port(self.port, self.baud_rate) as ser:
logger.info("> test_connection: read_battery_code")
self.read_battery_code(ser)

logger.info("> test_connection: read_status_data")
result = self.read_status_data(ser)

logger.info("> test_connection: read_soc_data")
self.read_soc_data(ser)
self.reset_soc = (
self.soc
) # set to meaningful value as preset for the GUI

logger.info("> test_connection: read_soc_data")

except Exception as err:
logger.error(f"Unexpected {err=}, {type(err)=}")
result = False

logger.info("> test_connection: end")
return result

def get_settings(self):
logger.info("> get_settings: start")
self.capacity = utils.BATTERY_CAPACITY
logger.info("> get_settings: open_serial_port")
with open_serial_port(self.port, self.baud_rate) as ser:
logger.info("> get_settings: read_capacity")
self.read_capacity(ser)

logger.info("> get_settings: read_production_date")
self.read_production_date(ser)

self.max_battery_charge_current = utils.MAX_BATTERY_CHARGE_CURRENT
self.max_battery_discharge_current = utils.MAX_BATTERY_DISCHARGE_CURRENT
logger.info("> get_settings: end")
return True

def refresh_data(self):
logger.info("> refresh_data: start")
result = False

if self.busy:
logger.info("> refresh_data: CURRENTLY BUSY!")
return False
self.busy = True

# Open serial port to be used for all data reads instead of opening multiple times
try:
logger.info("> refresh_data: open_serial_port")
with open_serial_port(self.port, self.baud_rate) as ser:
logger.info("> refresh_data: read_soc_data")
result = self.read_soc_data(ser)

logger.info("> refresh_data: read_fed_data")
result = result and self.read_fed_data(ser)

logger.info("> refresh_data: read_cell_voltage_range_data")
result = result and self.read_cell_voltage_range_data(ser)

logger.info("> refresh_data: write_soc_and_datetime")
self.write_soc_and_datetime(ser)

if self.poll_step == 0:
logger.info("> refresh_data: read_alarm_data")
result = result and self.read_alarm_data(ser)

logger.info("> refresh_data: read_temperature_range_data")
result = result and self.read_temperature_range_data(ser)

elif self.poll_step == 1:
logger.info("> refresh_data: read_cells_volts")
result = result and self.read_cells_volts(ser)

logger.info("> refresh_data: read_balance_state")
result = result and self.read_balance_state(ser)

# else: # A placeholder to remind this is the last step. Add any additional steps before here
# This is last step so reset poll_step
self.poll_step = -1
Expand All @@ -105,6 +142,7 @@ def refresh_data(self):
logger.warning("Couldn't open serial port")

self.busy = False
logger.info("> refresh_data: end")
return result

def read_status_data(self, ser):
Expand Down Expand Up @@ -411,6 +449,7 @@ def read_capacity(self, ser):
# check if connection success
if capa_data is False:
logger.warning("No data received in read_capacity()")
return False

(capacity, cell_volt) = unpack_from(">LL", capa_data)
self.capacity = (
Expand Down Expand Up @@ -603,9 +642,14 @@ def read_serialport_data(
return False

def reset_soc_callback(self, path, value):
self.reset_soc = 0
if value == 1:
self.soc_to_set = 100
if value is None:
return False

if value < 0 or value > 100:
return False

self.reset_soc = value
self.soc_to_set = value
return True

def write_soc_and_datetime(self, ser):
Expand Down
23 changes: 0 additions & 23 deletions etc/dbus-serialbattery/install-local.sh

This file was deleted.

Loading

0 comments on commit 13a9f41

Please sign in to comment.