Skip to content

Commit

Permalink
Merge branch 'master' of into jkbms_ble
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-manuel committed May 2, 2023
1 parent 93cb3f0 commit 557b9ac
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 27 deletions.
4 changes: 3 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
61 changes: 44 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,66 @@
# dbus-serialbattery
This is a driver for VenusOS devices (any GX device sold by Victron or a Raspberry Pi running the VenusOS image).
This is a driver for Venus OS devices (any GX device sold by Victron or a Raspberry Pi running the Venus OS image).

The driver will communicate with a Battery Management System (BMS) that support serial communication (RS232, RS485 or TTL UART) and publish this data to the VenusOS system. The main purpose is to act as a Battery Monitor in your GX and supply State of Charge (SoC) and other values to the inverter.
The driver will communicate with a Battery Management System (BMS) that support serial communication (RS232, RS485 or TTL UART) and publish this data to the Venus OS system. The main purpose is to act as a Battery Monitor in your GX and supply State Of Charge (SOC) and other values to the inverter.

## Documentation
Check the documenation for more informations.
* [Introduction](https://louisvdw.github.io/dbus-serialbattery/)
* [Features](https://louisvdw.github.io/dbus-serialbattery/general/features)
* [Supported BMS](https://louisvdw.github.io/dbus-serialbattery/general/supported-bms)
* [How to install](https://louisvdw.github.io/dbus-serialbattery/general/install)
* [Troubleshoot](https://louisvdw.github.io/dbus-serialbattery/troubleshoot/)
* [FAQ (Frequently Asked Questions)](https://louisvdw.github.io/dbus-serialbattery/troubleshoot/faq)
* [BMS Types supported](https://github.com/Louisvdw/dbus-serialbattery/wiki/BMS-types-supported)
* [FAQ](https://github.com/Louisvdw/dbus-serialbattery/wiki/FAQ)
* [Features](https://github.com/Louisvdw/dbus-serialbattery/wiki/Features)
* [How to install](https://github.com/Louisvdw/dbus-serialbattery/wiki/How-to-install)
* [Troubleshoot](https://github.com/Louisvdw/dbus-serialbattery/wiki/Troubleshoot)

## Supporting this project:
### Supporting this project:
If you find this driver helpful please considder supporting this project. You can buy me a Ko-Fi or get in contact if you would like to donate hardware.

[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/Z8Z73LCW1) or using [Paypal.me](https://paypal.me/innernet)

## Developer Remarks
### Developer Remarks
To develop this project, install the requirements. This project makes use of velib_python which is pre-installed on
Venus OS Devices under `/opt/victronenergy/dbus-systemcalc-py/ext/velib_python`. To use the python files locally,
Venus-OS Devices under `/opt/victronenergy/dbus-systemcalc-py/ext/velib_python`. To use the python files locally,
`git clone` the [velib_python](https://github.com/victronenergy/velib_python) project to velib_python and add
velib_python to the `PYTHONPATH` environment variable.

## How it works
#### How it works
* Each supported BMS needs to implement the abstract base class `Battery` from `battery.py`.
* `dbus-serialbattery.py` tries to figure out the correct connected BMS by looping through all known implementations of
`Battery` and executing its `test_connection()`. If this returns true, `dbus-serialbattery.py` sticks with this battery
and then periodically executes `dbushelper.publish_battery()`. `publish_battery()` executes `Battery.refresh_data()` which
and then periodically executes `dbushelpert.publish_battery()`. `publish_battery()` executes `Battery.refresh_data()` which
updates the fields of Battery. It then publishes those fields to dbus using `dbushelper.publish_dbus()`
* The Victron Device will be "controlled" by the values published on `/Info/` - namely:
* `/Info/MaxChargeCurrent `
* `/Info/MaxDischargeCurrent`
* `/Info/MaxChargeVoltage`
* `/Info/BatteryLowVoltage` (note that Low Voltage is ignored by the system)
* `/Info/BatteryLowVoltage`
* `/Info/ChargeRequest` (not implemented in dbus-serialbattery)

For more details on the Victron dbus interface see [the official Victron dbus documentation](https://github.com/victronenergy/venus/wiki/dbus).
For more details on the victron dbus interface see [the official victron dbus documentation](https://github.com/victronenergy/venus/wiki/dbus)

## Screenshots

### Venus OS

![VenusOS](docs/screenshots/venus-os_001.png)
![VenusOS](docs/screenshots/venus-os_002.png)
![VenusOS](docs/screenshots/venus-os_003.png)
![VenusOS](docs/screenshots/venus-os_004.png)
![VenusOS](docs/screenshots/venus-os_005.png)
![VenusOS](docs/screenshots/venus-os_006.png)
![VenusOS](docs/screenshots/venus-os_007.png)
![VenusOS](docs/screenshots/venus-os_008.png)
![VenusOS](docs/screenshots/venus-os_009.png)
![VenusOS](docs/screenshots/venus-os_010.png)
![VenusOS](docs/screenshots/venus-os_011.png)
![VenusOS](docs/screenshots/venus-os_012.png)
![VenusOS](docs/screenshots/venus-os_013.png)

### VRM Portal

![VenusOS](docs/screenshots/vrm-portal_001.png)
![VenusOS](docs/screenshots/vrm-portal_002.png)
![VenusOS](docs/screenshots/vrm-portal_003.png)
![VenusOS](docs/screenshots/vrm-portal_004.png)
![VenusOS](docs/screenshots/vrm-portal_005.png)
![VenusOS](docs/screenshots/vrm-portal_006.png)
![VenusOS](docs/screenshots/vrm-portal_007.png)
![VenusOS](docs/screenshots/vrm-portal_008.png)
![VenusOS](docs/screenshots/vrm-portal_009.png)
2 changes: 1 addition & 1 deletion etc/dbus-serialbattery/bms/hlpdatabms4s.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def read_serial_data2(command, port, baud, time, min_len):
try:
with serial.Serial(port, baudrate=baud, timeout=0.5) as ser:
ret = read_serialport_data2(ser, command, time, min_len)
if False is not ret:
if ret is True:
return ret
return False

Expand Down
11 changes: 3 additions & 8 deletions etc/dbus-serialbattery/bms/seplos.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
import serial


def int_from_hex_ascii(to_decode, signed=False):
return int.from_bytes(
bytes.fromhex(to_decode.decode("ascii")), byteorder="big", signed=signed
)


class Seplos(Battery):
def __init__(self, port, baud, address=0x00):
Expand Down Expand Up @@ -93,14 +88,14 @@ def test_connection(self):
return False

def get_settings(self):
# After successful connection get_settings will be call to set up the battery.
# After successful connection get_settings will be called to set up the battery.
# Set the current limits, populate cell count, etc.
# Return True if success, False for failure

# Uncomment if BMS does not supply capacity
# self.capacity = BATTERY_CAPACITY
# BMS does not provide max charge-/discharge, so we have to use hardcoded/config values
self.max_battery_charge_current = utils.MAX_BATTERY_CHARGE_CURRENT
self.max_battery_discharge_current = utils.MAX_BATTERY_DISCHARGE_CURRENT

self.max_battery_voltage = utils.MAX_CELL_VOLTAGE * self.cell_count
self.min_battery_voltage = utils.MIN_CELL_VOLTAGE * self.cell_count

Expand Down

0 comments on commit 557b9ac

Please sign in to comment.