Louisvdw / dbus-serialbattery

Battery Monitor driver for serial battery in VenusOS GX systems
MIT License
492 stars 157 forks source link

Driver not starting on one battery out of two (Jbd BMS) #1063

Closed geolin closed 1 month ago

geolin commented 1 month ago

Describe the bug

I have two batteries. Both Jbd BMS. One is connected to /dev/ttyACM0 and the other to /dev/ttyUSB2.

The one on /dev/ttyUSB2 is starting fine. The one on /dev/ttyACM0 does not start when the following settings in the config.ini is set to "False":

LINEAR_LIMITATION_ENABLE = False

Setting LINEAR_LIMITATION_ENABLE = True starts the device on /dev/ttyACM0 and /dev/ttyUSB2 successfully.

How to reproduce

  1. install two batteries with Jbd BMS
  2. set LINEAR_LIMITATION_ENABLE = False
  3. one serial device does not start successfully
  4. set LINEAR_LIMITATION_ENABLE = True
  5. both devices start successfully

Expected behavior

Both devices start successfully no matter if LINEAR_LIMITATION_ENABLE = True or LINEAR_LIMITATION_ENABLE = False

Driver version

v1.2.20240408

Venus OS device type

Raspberry Pi 3

Venus OS version

v3.30

BMS type

Smart BMS (LLT, JBD, Overkill Solar)

Cell count

16

Battery count

2

Connection type

Serial USB adapter to RS485

Config file

[DEFAULT]

; If you want to add custom values/settings, then check the values/settings you want to change in "config.default.ini"
; and insert them below to persist future driver updates.

; Example (remove the semicolon ";" to uncomment and activate the value/setting):
LINEAR_LIMITATION_ENABLE = True
MAX_VOLTAGE_TIME_SEC = 3600
MAX_BATTERY_CHARGE_CURRENT = 105.0
MAX_BATTERY_DISCHARGE_CURRENT = 140.0
BMS_TYPE = LltJbd
EXCLUDED_DEVICES = /dev/ttyUSB0, /dev/ttyUSB1
VOLTAGE_DROP = 0.16

Relevant log output

@4000000066467b900f50cc9c INFO:SerialBattery:
@4000000066467b900f5d4bd4 INFO:SerialBattery:Starting dbus-serialbattery
@4000000066467b900f774c14 INFO:SerialBattery:Venus OS v3.30
@4000000066467b900f7e165c INFO:SerialBattery:dbus-serialbattery v1.2.20240408
@4000000066467ba0107493ec INFO:SerialBattery:-- Testing BMS: 1 of 3 rounds
@4000000066467ba0107c63ec INFO:SerialBattery:Testing LltJbd
@4000000066467ba028bbd17c INFO:SerialBattery:Connection established to LltJbd
@4000000066467ba129592abc INFO:SerialBattery:Found existing battery with DeviceInstance = 1
@4000000066467ba135882b94 INFO:SerialBattery:DeviceInstance = 1
@4000000066467ba1359ac164 INFO:SerialBattery:PID file created successfully: /var/tmp/dbus-serialbattery_1.pid
@4000000066467ba135a45a6c INFO:SerialBattery:Used DeviceInstances = ['1', '2']
@4000000066467ba135abc8c4 INFO:SerialBattery:com.victronenergy.battery.ttyACM0
@4000000066467ba209d49bf4 INFO:SerialBattery:publish config values = True
@4000000066467ba20b22364c INFO:SerialBattery:Battery LLT/JBD connected to dbus from /dev/ttyACM0
@4000000066467ba20b2b851c INFO:SerialBattery:========== Settings ==========
@4000000066467ba20b3c4a14 INFO:SerialBattery:> Connection voltage: 53.24V | Current: -6.8A | SoC: None%
@4000000066467ba20b451fcc INFO:SerialBattery:> Cell count: 16 | Cells populated: 16
@4000000066467ba20b4d3a04 INFO:SerialBattery:> LINEAR LIMITATION ENABLE: False
@4000000066467ba20b55831c INFO:SerialBattery:> MIN CELL VOLTAGE: 2.9V | MAX CELL VOLTAGE: 3.45V
@4000000066467ba20b5dbc94 INFO:SerialBattery:> MAX BATTERY CHARGE CURRENT: 105.0A | MAX BATTERY DISCHARGE CURRENT: 140.0A
@4000000066467ba20b6605ac INFO:SerialBattery:> MAX BATTERY CHARGE CURRENT: 150.0A | MAX BATTERY DISCHARGE CURRENT: 150.0A (read from BMS)
@4000000066467ba20b6e1044 INFO:SerialBattery:> CVCM:     True
@4000000066467ba20b763a1c INFO:SerialBattery:> CCCM CV:  True  | DCCM CV:  True
@4000000066467ba20b7e871c INFO:SerialBattery:> CCCM T:   True  | DCCM T:   True
@4000000066467ba20b86bcac INFO:SerialBattery:> CCCM SOC: False | DCCM SOC: False
@4000000066467ba20b90ea24 INFO:SerialBattery:Serial Number/Unique Identifier: 21_280.0Ah
@4000000066467ba313f0f90c Traceback (most recent call last):
@4000000066467ba313f11464   File "/opt/victronenergy/dbus-serialbattery/dbushelper.py", line 811, in publish_battery
@4000000066467ba313f12bd4     self.battery.manage_charge_voltage()
@4000000066467ba313f1378c   File "/opt/victronenergy/dbus-serialbattery/battery.py", line 241, in manage_charge_voltage
@4000000066467ba313f14b14     self.manage_charge_voltage_step()
@4000000066467ba313f156cc   File "/opt/victronenergy/dbus-serialbattery/battery.py", line 734, in manage_charge_voltage_step
@4000000066467ba313f2d1b4     if not self.charge_mode.startswith("Float"):
@4000000066467ba313f2e154 AttributeError: 'NoneType' object has no attribute 'startswith'
@4000000066467ba313f3a88c #0
@4000000066467ba313f3b05c #1
@4000000066467ba313f3b444 #2
@4000000066467ba313f3bc14 #3
@4000000066467ba313f3bffc #4
@4000000066467ba313f3c3e4 #5
@4000000066467ba313f3c7cc #6
@4000000066467ba313f3cf9c #7
@4000000066467ba313f3d384 #8
@4000000066467ba313f3d76c #9
@4000000066467ba313f3db54 #10
@4000000066467ba313f3e324 #11
@4000000066467ba313f3e70c #12
@4000000066467ba313f3eaf4 #13
@4000000066467ba313f3f2c4 #14
@4000000066467ba313f3f6ac #15
@4000000066467bb219f5baa4 INFO:SerialBattery:
@4000000066467bb219ffd0ac INFO:SerialBattery:Starting dbus-serialbattery
@4000000066467bb21a18d304 INFO:SerialBattery:Venus OS v3.30
@4000000066467bb21a21d79c INFO:SerialBattery:dbus-serialbattery v1.2.20240408
@4000000066467bcc32e53a6c INFO:SerialBattery:
@4000000066467bcc32f0dee4 INFO:SerialBattery:Starting dbus-serialbattery
@4000000066467bcc330c4a6c INFO:SerialBattery:Venus OS v3.30
@4000000066467bcc3316ae94 INFO:SerialBattery:dbus-serialbattery v1.2.20240408
@4000000066467bdc33ee22d4 INFO:SerialBattery:-- Testing BMS: 1 of 3 rounds
@4000000066467bdc33ee4214 INFO:SerialBattery:Testing LltJbd
@4000000066467bdd0fd221fc INFO:SerialBattery:Connection established to LltJbd
@4000000066467bde0b0236e4 INFO:SerialBattery:Found existing battery with DeviceInstance = 1
@4000000066467bde18080fbc INFO:SerialBattery:DeviceInstance = 1
@4000000066467bde181c3bcc INFO:SerialBattery:PID file created successfully: /var/tmp/dbus-serialbattery_1.pid
@4000000066467bde18239e6c INFO:SerialBattery:Used DeviceInstances = ['1', '2']
@4000000066467bde182b85dc INFO:SerialBattery:com.victronenergy.battery.ttyACM0
@4000000066467bde26c7ecd4 INFO:SerialBattery:publish config values = True
@4000000066467bde283f13e4 INFO:SerialBattery:Battery LLT/JBD connected to dbus from /dev/ttyACM0
@4000000066467bde2846b11c INFO:SerialBattery:========== Settings ==========
@4000000066467bde284ff81c INFO:SerialBattery:> Connection voltage: 54.03V | Current: 54.06A | SoC: None%
@4000000066467bde285700e4 INFO:SerialBattery:> Cell count: 16 | Cells populated: 16
@4000000066467bde285dcf14 INFO:SerialBattery:> LINEAR LIMITATION ENABLE: True
@4000000066467bde28651e2c INFO:SerialBattery:> MIN CELL VOLTAGE: 2.9V | MAX CELL VOLTAGE: 3.45V
@4000000066467bde286c0b9c INFO:SerialBattery:> MAX BATTERY CHARGE CURRENT: 105.0A | MAX BATTERY DISCHARGE CURRENT: 140.0A
@4000000066467bde28734344 INFO:SerialBattery:> MAX BATTERY CHARGE CURRENT: 150.0A | MAX BATTERY DISCHARGE CURRENT: 150.0A (read from BMS)
@4000000066467bde287a4054 INFO:SerialBattery:> CVCM:     True
@4000000066467bde2881397c INFO:SerialBattery:> CCCM CV:  True  | DCCM CV:  True
@4000000066467bde288807ac INFO:SerialBattery:> CCCM T:   True  | DCCM T:   True
@4000000066467bde288efcec INFO:SerialBattery:> CCCM SOC: False | DCCM SOC: False
@4000000066467bde2896f014 INFO:SerialBattery:Serial Number/Unique Identifier: 21_280.0Ah

Any other information that may be helpful

In the Log File you see the output of /data/log/dbus-serialbattery.ttyACM0/current

When LINEAR_LIMITATION_ENABLE = False then you see the error in the Logfile (Traceback ...), when LINEAR_LIMITATION_ENABLE = True the serial device starts successfully.

mr-manuel commented 1 month ago

Please try the latest nightly.