mr-manuel / venus-os_dbus-serialbattery

Battery Monitor driver for serial battery in VenusOS GX systems
https://mr-manuel.github.io/venus-os_dbus-serialbattery_docs/
MIT License
35 stars 15 forks source link

SoC: None% in log upon driver start #32

Closed SenH closed 4 months ago

SenH commented 4 months ago

Describe the bug

In my log upon start the SoC is alwaysNone.

After checking the code the variable used for this field is self.soc_calc from battery.py. This variable is set in manage_charge_voltage() but this function is not called before battery.log_settings() in dbus-serialbattery.py. So self.soc_calc defaults to the value defined in __init__ which is None.

How to reproduce

Start the driver and check the log settings.

Expected behavior

The value from self.soc should be visible in the log.

Driver version

v1.3.20240520dev

Venus OS device type

Cerbo GX

Venus OS version

v3.31

BMS type

JKBMS / Heltec BMS

Cell count

16

Battery count

1

Connection type

Serial USB adapter to TTL

Config file

MAX_BATTERY_CHARGE_CURRENT    = 70.0
MAX_BATTERY_DISCHARGE_CURRENT = 70.0

; Copy value from "Balance Trig. Volt" in JK BMS app
CELL_VOLTAGE_DIFF_KEEP_MAX_VOLTAGE_UNTIL = 0.010

MAX_VOLTAGE_TIME_SEC = 1800
CVL_ICONTROLLER_MODE = True

TEMPERATURES_WHILE_CHARGING      =    0,    2,    5,   10,   15,   20,   35,   40,   55
MAX_CHARGE_CURRENT_T_FRACTION    = 0.00, 0.10, 0.20, 0.40, 1.00, 1.00, 1.00, 0.40, 0.00

; Measure Voltage drop between the BMS and the charger
; VOLTAGE_DROP = 0.00

TEMP_1_NAME = T1 C6
TEMP_2_NAME = T2 C13

BMS_TYPE = Jkbms
BLOCK_ON_DISCONNECT = True

Relevant log output

2024-06-01 20:39:30.819489500 INFO:SerialBattery:========== Settings ==========
2024-06-01 20:39:30.820221500 INFO:SerialBattery:> Connection voltage: 52.6 V | Current: -7.21 A | SoC: None%
2024-06-01 20:39:30.820830500 INFO:SerialBattery:> Cell count: 16 | Cells populated: 16
2024-06-01 20:39:30.821409500 INFO:SerialBattery:> LINEAR LIMITATION ENABLE: True
2024-06-01 20:39:30.822013500 INFO:SerialBattery:> MIN CELL VOLTAGE: 2.9 V | MAX CELL VOLTAGE: 3.45 V
2024-06-01 20:39:30.822616500 INFO:SerialBattery:> MAX BATTERY CHARGE CURRENT: 70.0 A | MAX BATTERY DISCHARGE CURRENT: 70.0 A
2024-06-01 20:39:30.823226500 INFO:SerialBattery:> MAX BATTERY CHARGE CURRENT: 120.0 A | MAX BATTERY DISCHARGE CURRENT: 120.0 A (read from BMS)
2024-06-01 20:39:30.823947500 INFO:SerialBattery:> CVCM:     True
2024-06-01 20:39:30.824595500 INFO:SerialBattery:> CCCM CV:  True  | DCCM CV:  True
2024-06-01 20:39:30.825179500 INFO:SerialBattery:> CCCM T:   True  | DCCM T:   True
2024-06-01 20:39:30.825766500 INFO:SerialBattery:> CCCM SOC: False | DCCM SOC: False
2024-06-01 20:39:30.826355500 INFO:SerialBattery:> CHARGE FET: True | DISCHARGE FET: True | BALANCE FET: True

Any other information that may be helpful

No response

mr-manuel commented 4 months ago

Thanks for reporting. Fixed with v1.3.20240602dev.