Louisvdw / dbus-serialbattery

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

Python errors in log directly after starting the driver #1079

Closed salami738 closed 3 weeks ago

salami738 commented 3 weeks ago

Describe the bug

The driver throws various python exception on start:

How to reproduce

Start the driver with the config.ini from below

Expected behavior

No error messages.

Driver version

1.2.20240408

Venus OS device type

Raspberry Pi 4

Venus OS version

v3.11

BMS type

JKBMS / Heltec BMS

Cell count

16

Battery count

1

Connection type

Serial USB adapter to TTL

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):
; MAX_BATTERY_CHARGE_CURRENT = 50.0
; MAX_BATTERY_DISCHARGE_CURRENT = 60.0

; Datasheet L194F130A
; Charge
;  40°C    0%
;  35°C   75%
;  30    100%
;  10    100%
;   5     75%
;   0     40%
;  -5     10%
; -10      0%

TEMPERATURE_LIMITS_WHILE_CHARGING = -10, -5  , 0  , 5   , 10, 30, 35   , 40
MAX_CHARGE_CURRENT_T_FRACTION     =   0,  0.1, 0.4, 0.75,  1,  1,  0.75,  0

; Datasheet L194F130A
; Discharge
;  40°C    0%
;  35°C   75%
;  30    100%
;  10    100%
;   5     50%
;   0     30%
;  -5     20%
; -10      0%

TEMPERATURE_LIMITS_WHILE_DISCHARGING = -10,  -5,   0,   5, 10, 30,    35, 40
MAX_DISCHARGE_CURRENT_T_FRACTION     =   0, 0.2, 0.3, 0.5,  1,  1,  0.75,  0

; Set steps to reduce battery current
; The current will be changed linear between those steps if LINEAR_LIMITATION_ENABLE is set to True
CELL_VOLTAGES_WHILE_CHARGING   = 3.55, 3.50, 3.45, 3.40, 3.30
MAX_CHARGE_CURRENT_CV_FRACTION = 0.00, 0.05, 0.40, 1.00, 1.00

; --------- SOC limitation (affecting CCL/DCL) ---------
; Description: Maximal charge / discharge current will be increased / decreased depending on State of Charge,
;              see CC_SOC_LIMIT1 etc.
; Example: The SoC limit will be monitored to control the currents.
; Charge current control management enable (True/False).
CCCM_SOC_ENABLE = False
; Discharge current control management enable (True/False).
DCCM_SOC_ENABLE = False

SOC_CALCULATION = True

Relevant log output

==> /data/log/dbus-serialbattery.ttyUSB0/current <==
2024-06-10 07:23:08.418497500 INFO:SerialBattery:> Connection voltage: 55.11V | Current: 0.54A | SoC: 82.02%
2024-06-10 07:23:08.418504500 INFO:SerialBattery:> Cell count: 16 | Cells populated: 16
2024-06-10 07:23:08.418508500 INFO:SerialBattery:> LINEAR LIMITATION ENABLE: True
2024-06-10 07:23:08.418511500 INFO:SerialBattery:> MIN CELL VOLTAGE: 2.9V | MAX CELL VOLTAGE: 3.45V
2024-06-10 07:23:08.418516500 INFO:SerialBattery:> MAX BATTERY CHARGE CURRENT: 50.0A | MAX BATTERY DISCHARGE CURRENT: 60.0A
2024-06-10 07:23:08.418521500 INFO:SerialBattery:> MAX BATTERY CHARGE CURRENT: 60.0A | MAX BATTERY DISCHARGE CURRENT: 60.0A (read from BMS)
2024-06-10 07:23:08.418621500 INFO:SerialBattery:> CVCM:     True
2024-06-10 07:23:08.418624500 INFO:SerialBattery:> CCCM CV:  True  | DCCM CV:  True
2024-06-10 07:23:08.418628500 INFO:SerialBattery:> CCCM T:   True  | DCCM T:   True
2024-06-10 07:23:08.418631500 INFO:SerialBattery:> CCCM SOC: False | DCCM SOC: False
2024-06-10 07:23:08.418635500 INFO:SerialBattery:Serial Number/Unique Identifier: JK_BD6A17S8P
2024-06-10 07:23:09.450160500 ERROR:SerialBattery:CRC checksum mismatch: Expected 0x51aa, Got 0x3423
2024-06-10 07:23:09.451309500 INFO:SerialBattery:SOC initialized from dbus and set to 82.02%
2024-06-10 07:23:09.452523500 WARNING:SerialBattery:Error while executing calcMaxChargeCurrentReferringToCellVoltage(). Using default value instead.
2024-06-10 07:23:09.453056500 WARNING:SerialBattery:CELL_VOLTAGES_WHILE_CHARGING: [3.55, 3.5, 3.45, 3.4, 3.3] • MAX_CHARGE_CURRENT_CV: [0.0, 2.5, 20.0, 50.0, 50.0]
2024-06-10 07:23:09.453543500 ERROR:SerialBattery:Exception occurred: TypeError("'<=' not supported between instances of 'NoneType' and 'float'") of type <class 'TypeError'> in /opt/victronenergy/dbus-serialbattery/battery.py line #937
2024-06-10 07:23:09.454464500 WARNING:SerialBattery:Error while executing calcMaxDischargeCurrentReferringToCellVoltage(). Using default value instead.
2024-06-10 07:23:09.454967500 WARNING:SerialBattery:CELL_VOLTAGES_WHILE_DISCHARGING: [2.7, 2.8, 2.9, 3.1] • MAX_DISCHARGE_CURRENT_CV: [0.0, 6.0, 30.0, 60.0]
2024-06-10 07:23:09.455452500 ERROR:SerialBattery:Exception occurred: TypeError("'<=' not supported between instances of 'NoneType' and 'float'") of type <class 'TypeError'> in /opt/victronenergy/dbus-serialbattery/battery.py line #968
2024-06-10 07:23:09.491067500 ERROR:SerialBattery:Non blocking exception occurred: TypeError("unsupported operand type(s) for -: 'NoneType' and 'NoneType'") of type <class 'TypeError'> in /opt/victronenergy/dbus-serialbattery/dbushelper.py line #1008
2024-06-10 07:23:26.376341500 ERROR:SerialBattery:>>> ERROR: No reply - returning [len:163/39169]
2024-06-10 07:23:26.382403500 Traceback (most recent call last):
2024-06-10 07:23:26.382409500   File "/opt/victronenergy/dbus-serialbattery/dbushelper.py", line 788, in publish_battery
2024-06-10 07:23:26.382414500     if self.battery.get_min_cell_voltage() > 3.25
2024-06-10 07:23:26.382418500 TypeError: '>' not supported between instances of 'NoneType' and 'float'
2024-06-10 07:23:27.812263500 INFO:SerialBattery:
2024-06-10 07:23:27.812823500 INFO:SerialBattery:Starting dbus-serialbattery
2024-06-10 07:23:27.814495500 INFO:SerialBattery:Venus OS v3.11
2024-06-10 07:23:27.815015500 INFO:SerialBattery:dbus-serialbattery v1.2.20240408
2024-06-10 07:23:43.828744500 INFO:SerialBattery:-- Testing BMS: 1 of 3 rounds
2024-06-10 07:23:43.829346500 INFO:SerialBattery:Testing Daly at address "\x40"
2024-06-10 07:23:43.955342500 ERROR:SerialBattery:>>> ERROR: No reply - returning
2024-06-10 07:23:43.955912500 INFO:SerialBattery:Testing Daly at address "\x80"
2024-06-10 07:23:44.080086500 ERROR:SerialBattery:>>> ERROR: No reply - returning
2024-06-10 07:23:44.080621500 INFO:SerialBattery:Testing Ecs
2024-06-10 07:23:44.138892500 ERROR:SerialBattery:>>> ERROR: No reply - returning
2024-06-10 07:23:44.139344500 INFO:SerialBattery:Testing HeltecModbus
2024-06-10 07:23:47.802056500 ERROR:SerialBattery:>>> ERROR: No reply - returning
2024-06-10 07:23:47.802509500 INFO:SerialBattery:Testing HLPdataBMS4S
2024-06-10 07:23:48.608948500 ERROR:SerialBattery:>>> ERROR: No reply - returning
2024-06-10 07:23:48.609380500 INFO:SerialBattery:Testing Jkbms
2024-06-10 07:23:48.661576500 INFO:SerialBattery:Connection established to Jkbms
2024-06-10 07:23:48.861908500 INFO:SerialBattery:Found existing battery with DeviceInstance = 1
2024-06-10 07:23:49.073656500 INFO:SerialBattery:DeviceInstance = 1
2024-06-10 07:23:49.074974500 INFO:SerialBattery:PID file created successfully: /var/tmp/dbus-serialbattery_1.pid
2024-06-10 07:23:49.075547500 INFO:SerialBattery:Used DeviceInstances = ['1']
2024-06-10 07:23:49.076091500 INFO:SerialBattery:com.victronenergy.battery.ttyUSB0
2024-06-10 07:23:49.102566500 INFO:SerialBattery:publish config values = True
2024-06-10 07:23:49.123631500 INFO:SerialBattery:Battery Jkbms connected to dbus from /dev/ttyUSB0
2024-06-10 07:23:49.124247500 INFO:SerialBattery:========== Settings ==========
2024-06-10 07:23:49.124817500 INFO:SerialBattery:> Connection voltage: 55.09V | Current: 0.82A | SoC: 82.02%
2024-06-10 07:23:49.125336500 INFO:SerialBattery:> Cell count: 16 | Cells populated: 16
2024-06-10 07:23:49.125851500 INFO:SerialBattery:> LINEAR LIMITATION ENABLE: True
2024-06-10 07:23:49.126388500 INFO:SerialBattery:> MIN CELL VOLTAGE: 2.9V | MAX CELL VOLTAGE: 3.45V
2024-06-10 07:23:49.126944500 INFO:SerialBattery:> MAX BATTERY CHARGE CURRENT: 50.0A | MAX BATTERY DISCHARGE CURRENT: 60.0A
2024-06-10 07:23:49.127498500 INFO:SerialBattery:> MAX BATTERY CHARGE CURRENT: 60.0A | MAX BATTERY DISCHARGE CURRENT: 60.0A (read from BMS)
2024-06-10 07:23:49.128017500 INFO:SerialBattery:> CVCM:     True
2024-06-10 07:23:49.128546500 INFO:SerialBattery:> CCCM CV:  True  | DCCM CV:  True
2024-06-10 07:23:49.129070500 INFO:SerialBattery:> CCCM T:   True  | DCCM T:   True
2024-06-10 07:23:49.129596500 INFO:SerialBattery:> CCCM SOC: False | DCCM SOC: False
2024-06-10 07:23:49.130113500 INFO:SerialBattery:Serial Number/Unique Identifier: JK_BD6A17S8P
2024-06-10 07:23:50.394206500 ERROR:SerialBattery:>>> ERROR: No reply - returning
2024-06-10 07:23:50.395503500 INFO:SerialBattery:SOC initialized from dbus and set to 82.02%
2024-06-10 07:23:50.396783500 WARNING:SerialBattery:Error while executing calcMaxChargeCurrentReferringToCellVoltage(). Using default value instead.
2024-06-10 07:23:50.397401500 WARNING:SerialBattery:CELL_VOLTAGES_WHILE_CHARGING: [3.55, 3.5, 3.45, 3.4, 3.3] • MAX_CHARGE_CURRENT_CV: [0.0, 2.5, 20.0, 50.0, 50.0]
2024-06-10 07:23:50.398172500 ERROR:SerialBattery:Exception occurred: TypeError("'<=' not supported between instances of 'NoneType' and 'float'") of type <class 'TypeError'> in /opt/victronenergy/dbus-serialbattery/battery.py line #937
2024-06-10 07:23:50.399764500 WARNING:SerialBattery:Error while executing calcMaxDischargeCurrentReferringToCellVoltage(). Using default value instead.
2024-06-10 07:23:50.400445500 WARNING:SerialBattery:CELL_VOLTAGES_WHILE_DISCHARGING: [2.7, 2.8, 2.9, 3.1] • MAX_DISCHARGE_CURRENT_CV: [0.0, 6.0, 30.0, 60.0]
2024-06-10 07:23:50.401229500 ERROR:SerialBattery:Exception occurred: TypeError("'<=' not supported between instances of 'NoneType' and 'float'") of type <class 'TypeError'> in /opt/victronenergy/dbus-serialbattery/battery.py line #968
2024-06-10 07:23:50.457937500 ERROR:SerialBattery:Non blocking exception occurred: TypeError("unsupported operand type(s) for -: 'NoneType' and 'NoneType'") of type <class 'TypeError'> in /opt/victronenergy/dbus-serialbattery/dbushelper.py line #1008
2024-06-10 07:23:51.392182500 ERROR:SerialBattery:>>> ERROR: No reply - returning
2024-06-10 07:23:51.403055500 Traceback (most recent call last):
2024-06-10 07:23:51.403061500   File "/opt/victronenergy/dbus-serialbattery/dbushelper.py", line 811, in publish_battery
2024-06-10 07:23:51.403067500     self.battery.manage_charge_voltage()
2024-06-10 07:23:51.403070500   File "/opt/victronenergy/dbus-serialbattery/battery.py", line 232, in manage_charge_voltage
2024-06-10 07:23:51.403075500     self.soc_calculation()
2024-06-10 07:23:51.403077500   File "/opt/victronenergy/dbus-serialbattery/battery.py", line 287, in soc_calculation
2024-06-10 07:23:51.403161500     if current_min_cell_voltage > utils.MAX_CELL_VOLTAGE * 0.99:
2024-06-10 07:23:51.403166500 TypeError: '>' not supported between instances of 'NoneType' and 'float'
2024-06-10 07:24:11.384927500 INFO:SerialBattery:
2024-06-10 07:24:11.386396500 INFO:SerialBattery:Starting dbus-serialbattery
2024-06-10 07:24:11.388439500 INFO:SerialBattery:Venus OS v3.11
2024-06-10 07:24:11.389053500 INFO:SerialBattery:dbus-serialbattery v1.2.20240408
2024-06-10 07:24:27.402474500 INFO:SerialBattery:-- Testing BMS: 1 of 3 rounds
2024-06-10 07:24:27.403157500 INFO:SerialBattery:Testing Daly at address "\x40"
2024-06-10 07:24:27.531167500 ERROR:SerialBattery:>>> ERROR: No reply - returning
2024-06-10 07:24:27.531814500 INFO:SerialBattery:Testing Daly at address "\x80"
2024-06-10 07:24:27.657857500 ERROR:SerialBattery:>>> ERROR: No reply - returning
2024-06-10 07:24:27.658331500 INFO:SerialBattery:Testing Ecs
2024-06-10 07:24:27.718646500 ERROR:SerialBattery:>>> ERROR: No reply - returning
2024-06-10 07:24:27.719235500 INFO:SerialBattery:Testing HeltecModbus
2024-06-10 07:24:31.410217500 ERROR:SerialBattery:>>> ERROR: No reply - returning
2024-06-10 07:24:31.410823500 INFO:SerialBattery:Testing HLPdataBMS4S
2024-06-10 07:24:32.218482500 ERROR:SerialBattery:>>> ERROR: No reply - returning
2024-06-10 07:24:32.218938500 INFO:SerialBattery:Testing Jkbms
2024-06-10 07:24:32.271411500 INFO:SerialBattery:Connection established to Jkbms
2024-06-10 07:24:32.490094500 INFO:SerialBattery:Found existing battery with DeviceInstance = 1
2024-06-10 07:24:32.701942500 INFO:SerialBattery:DeviceInstance = 1
2024-06-10 07:24:32.703108500 INFO:SerialBattery:PID file created successfully: /var/tmp/dbus-serialbattery_1.pid
2024-06-10 07:24:32.703547500 INFO:SerialBattery:Used DeviceInstances = ['1']
2024-06-10 07:24:32.703989500 INFO:SerialBattery:com.victronenergy.battery.ttyUSB0
2024-06-10 07:24:32.731077500 INFO:SerialBattery:publish config values = True
2024-06-10 07:24:32.752322500 INFO:SerialBattery:Battery Jkbms connected to dbus from /dev/ttyUSB0
2024-06-10 07:24:32.752735500 INFO:SerialBattery:========== Settings ==========
2024-06-10 07:24:32.753204500 INFO:SerialBattery:> Connection voltage: 55.22V | Current: 1.64A | SoC: 82.02%
2024-06-10 07:24:32.753623500 INFO:SerialBattery:> Cell count: 16 | Cells populated: 16
2024-06-10 07:24:32.754039500 INFO:SerialBattery:> LINEAR LIMITATION ENABLE: True
2024-06-10 07:24:32.754473500 INFO:SerialBattery:> MIN CELL VOLTAGE: 2.9V | MAX CELL VOLTAGE: 3.45V
2024-06-10 07:24:32.754913500 INFO:SerialBattery:> MAX BATTERY CHARGE CURRENT: 50.0A | MAX BATTERY DISCHARGE CURRENT: 60.0A
2024-06-10 07:24:32.755349500 INFO:SerialBattery:> MAX BATTERY CHARGE CURRENT: 60.0A | MAX BATTERY DISCHARGE CURRENT: 60.0A (read from BMS)
2024-06-10 07:24:32.755766500 INFO:SerialBattery:> CVCM:     True
2024-06-10 07:24:32.756195500 INFO:SerialBattery:> CCCM CV:  True  | DCCM CV:  True
2024-06-10 07:24:32.756619500 INFO:SerialBattery:> CCCM T:   True  | DCCM T:   True
2024-06-10 07:24:32.757046500 INFO:SerialBattery:> CCCM SOC: False | DCCM SOC: False
2024-06-10 07:24:32.757460500 INFO:SerialBattery:Serial Number/Unique Identifier: JK_BD6A17S8P
2024-06-10 07:24:33.807533500 INFO:SerialBattery:SOC initialized from dbus and set to 82.02%

Any other information that may be helpful

No response

salami738 commented 3 weeks ago

I found one error in my configuration. I missed the renaming from TEMPERATURE_LIMITS_WHILE_CHARGING -> TEMPERATURES_WHILE_CHARGING TEMPERATURE_LIMITS_WHILE_DISCHARGING -> TEMPERATURES_WHILE_DISCHARGING in the release logs.

Now only this error messages remain:

2024-06-10 07:23:50.395503500 INFO:SerialBattery:SOC initialized from dbus and set to 82.02%
2024-06-10 07:23:50.396783500 WARNING:SerialBattery:Error while executing calcMaxChargeCurrentReferringToCellVoltage(). Using default value instead.
2024-06-10 07:23:50.397401500 WARNING:SerialBattery:CELL_VOLTAGES_WHILE_CHARGING: [3.55, 3.5, 3.45, 3.4, 3.3] • MAX_CHARGE_CURRENT_CV: [0.0, 2.5, 20.0, 50.0, 50.0]
2024-06-10 07:23:50.398172500 ERROR:SerialBattery:Exception occurred: TypeError("'<=' not supported between instances of 'NoneType' and 'float'") of type <class 'TypeError'> in /opt/victronenergy/dbus-serialbattery/battery.py line #937
2024-06-10 07:23:50.399764500 WARNING:SerialBattery:Error while executing calcMaxDischargeCurrentReferringToCellVoltage(). Using default value instead.
2024-06-10 07:23:50.400445500 WARNING:SerialBattery:CELL_VOLTAGES_WHILE_DISCHARGING: [2.7, 2.8, 2.9, 3.1] • MAX_DISCHARGE_CURRENT_CV: [0.0, 6.0, 30.0, 60.0]
2024-06-10 07:23:50.401229500 ERROR:SerialBattery:Exception occurred: TypeError("'<=' not supported between instances of 'NoneType' and 'float'") of type <class 'TypeError'> in /opt/victronenergy/dbus-serialbattery/battery.py line #968
2024-06-10 07:23:50.457937500 ERROR:SerialBattery:Non blocking exception occurred: TypeError("unsupported operand type(s) for -: 'NoneType' and 'NoneType'") of type <class 'TypeError'> in /opt/victronenergy/dbus-serialbattery/dbushelper.py line #1008
2024-06-10 07:23:51.392182500 ERROR:SerialBattery:>>> ERROR: No reply - returning
2024-06-10 07:23:51.403055500 Traceback (most recent call last):
2024-06-10 07:23:51.403061500   File "/opt/victronenergy/dbus-serialbattery/dbushelper.py", line 811, in publish_battery
2024-06-10 07:23:51.403067500     self.battery.manage_charge_voltage()
2024-06-10 07:23:51.403070500   File "/opt/victronenergy/dbus-serialbattery/battery.py", line 232, in manage_charge_voltage
2024-06-10 07:23:51.403075500     self.soc_calculation()
2024-06-10 07:23:51.403077500   File "/opt/victronenergy/dbus-serialbattery/battery.py", line 287, in soc_calculation
2024-06-10 07:23:51.403161500     if current_min_cell_voltage > utils.MAX_CELL_VOLTAGE * 0.99:
2024-06-10 07:23:51.403166500 TypeError: '>' not supported between instances of 'NoneType' and 'float'
salami738 commented 3 weeks ago

Ok, the error has vanished too after restarting the driver. You can close this ticket. Thanks