Dr-Gigavolt / dbus-aggregate-batteries

Virtual service to merge multiple serial batteries
MIT License
66 stars 11 forks source link

No batteries found after update from 2.2 to 3.1 #59

Closed thkusch closed 1 year ago

thkusch commented 1 year ago

Hello!

I just updated dbus-aggregate-batteries from 2.2 to 3.1 (same issue with 3.0) and dbus-serialbattery from 0.14 to 1.0.2. I have 3x JK BMS

The dbus-serialbattery works fine, but the dbus-aggregate-batteries doesn't find any battery. This is what the log file says:

INFO:root:Thu Nov  2 16:11:17 2023: Starting AggregateBatteries.
INFO:root:registered ourselves on D-Bus as com.victronenergy.battery.aggregate
INFO:root:Thu Nov  2 16:11:17 2023: Initial Ah read from file: 120Ah
INFO:root:Thu Nov  2 16:11:17 2023: Last balancing done at the 306. day of the year
INFO:root:Batteries balanced 0 days ago.
INFO:root:Thu Nov  2 16:11:17 2023: Starting battery monitor.
INFO:root:Thu Nov  2 16:11:17 2023: Connected to DBus, and switching over to GLib.MainLoop()
INFO:dbusmonitor:===== Search on dbus for services that we will monitor starting... =====
INFO:dbusmonitor:Found: com.victronenergy.settings, scanning and storing items
INFO:dbusmonitor:       com.victronenergy.settings has device instance 0
INFO:dbusmonitor:Found: com.victronenergy.system, scanning and storing items
INFO:dbusmonitor:       com.victronenergy.system has device instance 0
INFO:dbusmonitor:Found: com.victronenergy.battery.ttyACM0, scanning and storing items
INFO:dbusmonitor:       com.victronenergy.battery.ttyACM0 has device instance 2
INFO:dbusmonitor:Found: com.victronenergy.battery.ttyACM1, scanning and storing items
INFO:dbusmonitor:       com.victronenergy.battery.ttyACM1 has device instance 3
INFO:dbusmonitor:Found: com.victronenergy.battery.ttyACM2, scanning and storing items
INFO:dbusmonitor:       com.victronenergy.battery.ttyACM2 has device instance 4
INFO:dbusmonitor:Found: com.victronenergy.vebus.ttyUSB0, scanning and storing items
INFO:dbusmonitor:       com.victronenergy.vebus.ttyUSB0 has device instance 288
INFO:dbusmonitor:Found: com.victronenergy.battery.aggregate, scanning and storing items
INFO:dbusmonitor:       com.victronenergy.battery.aggregate has device instance 0
INFO:dbusmonitor:===== Search on dbus for services that we will monitor finished =====
INFO:root:Thu Nov  2 16:11:18 2023: Searching Settings: Trial Nr. 1
INFO:root:Thu Nov  2 16:11:18 2023: com.victronenergy.settings found.
INFO:root:Thu Nov  2 16:11:23 2023: Searching batteries: Trial Nr. 1
INFO:root:Thu Nov  2 16:11:23 2023: 0 batteries found.
INFO:root:Thu Nov  2 16:11:28 2023: Searching batteries: Trial Nr. 2
INFO:root:Thu Nov  2 16:11:28 2023: 0 batteries found.
INFO:root:Thu Nov  2 16:11:33 2023: Searching batteries: Trial Nr. 3
INFO:root:Thu Nov  2 16:11:33 2023: 0 batteries found.
INFO:root:Thu Nov  2 16:11:38 2023: Searching batteries: Trial Nr. 4
INFO:root:Thu Nov  2 16:11:38 2023: 0 batteries found.
INFO:root:Thu Nov  2 16:11:43 2023: Searching batteries: Trial Nr. 5
INFO:root:Thu Nov  2 16:11:43 2023: 0 batteries found.

My settings.py is as follows:

# Version 3.1

#######################################
########## Hardware settings ##########
#######################################

NR_OF_BATTERIES = 3                                     # Nr. of physical batteries to be aggregated. Smart shunt for battery current is not needed and not supported. 
NR_OF_CELLS_PER_BATTERY = 16
NR_OF_MPPTS = 0                                         # Nr. of MPPTs
DC_LOADS = False                                        # If DC loads with Smart Shunt present, can be used for total current measurement
INVERT_SMARTSHUNT = False                               # False: Current subtracted, True: Current added 

#######################################
############ DBus settings ############
#######################################

BATTERY_SERVICE_NAME = 'com.victronenergy.battery'      # Key world to identify services of physical Serial Batteries (and SmartShunt if available)                
BATTERY_PRODUCT_NAME_PATH = '/ProductName'              # Path of Battery Product Name
BATTERY_PRODUCT_NAME = 'SerialBattery'                  # Key world to identify the batteries (to exclude SmartShunt)
BATTERY_INSTANCE_NAME_PATH = '/CustomName'              # if CustomName doesn't exist, set '/ProductName'
MULTI_KEY_WORD = 'com.victronenergy.vebus'              # Key world to identify service of Multis/Quattros (or cluster of them)
MPPT_KEY_WORD = 'com.victronenergy.solarcharger'        # Key world to identify services of solar chargers
SMARTSHUNT_NAME_KEY_WORD = 'SmartShunt'                 # Key world to identify services of SmartShunt

SEARCH_TRIALS = 10                                      # Trials to identify of all batteries before exit and restart
READ_TRIALS = 10                                        # Trials to get consistent data of all batteries before exit and restart

#######################################
############ DBus settings ############
#######################################

CURRENT_FROM_VICTRON = False                             # If True, the current measurement by Multis/Quattros and MPPTs is taken instead of BMS.
                                                        # Necessary for JK BMS due to poor precision.
OWN_SOC = False                                          # If True, the self calculated charge indicators are taken instead of BMS
ZERO_SOC = True                                         # Allow zeroing charge counter at MIN_CELL_VOLTAGE. At full battery it is always set to 100%. 
CHARGE_SAVE_PRECISION = 0.0025                          # Trade-off between save precision and file access frequency

#######################################
##### Charge/Discharge parameters #####
#######################################

# Please note: Victron ESS disables CCL if DC-coupled PV feed-in is active. This program disables the DC-coupled PV feed-in when necessary.

OWN_CHARGE_PARAMETERS = True                            # Calculate own charge/discharge control parameters (True) from following settings
                                                        # or use them from battery driver (False)
BALANCING_VOLTAGE = 3.45                                # This voltage per cell will be set periodically and kept until balancing below CELL_DIFF_MAX and next charge cycle
BALANCING_REPETITION = 10                               # in days                      

CHARGE_VOLTAGE_LIST = [3.50, 3.50, 3.50, 3.50, 3.50, 3.50, 3.50, 3.50, 3.50, 3.50, 3.50, 3.50,]      # Set up how full the battery has to be charged in given month
#                       jan,  feb,  mar,  apr,  may,  jun,  jul,  aug,  sep,  oct,  nov,  dec

MAX_CELL_VOLTAGE = 3.50                                  # If reached by 1-st cell, the CVL is dynamically limited. DC-coupled PV feed-in will be disabled to enable the CCL. 
MIN_CELL_VOLTAGE = 2.80                                  # If reached, discharge current set to zero
CELL_DIFF_MAX = 0.025                                   # If lower: re-enable DC-coupled PV feed in (if was enabled before); go back from BALANCING_VOLTAGE to CHARGE_VOLTAGE

MAX_CHARGE_CURRENT = 210                                # Max. charge current at normal conditions
MAX_DISCHARGE_CURRENT = 300                             # Max. discharge current at normal conditions

# settings limiting charge and discharge current if at least one cell gets full or empty
# the lists may have any length, but the same length for voltage and current
# linear interpolation is used for values between

CELL_FULL_LIMITING_VOLTAGE = [BALANCING_VOLTAGE - 0.1, BALANCING_VOLTAGE, MAX_CELL_VOLTAGE]           # [min, .... ,max]
CELL_FULL_LIMITED_CURRENT =  [1, 0.05, 0]
CELL_EMPTY_LIMITING_VOLTAGE = [MIN_CELL_VOLTAGE, MIN_CELL_VOLTAGE + 0.1, MIN_CELL_VOLTAGE + 0.2]    # [min, .... ,max]
CELL_EMPTY_LIMITED_CURRENT =  [0, 0.05, 1]

########################################
### if OWN_CHARGE_PARAMETERS = False ###
########################################

# If "False", the transmitted CVL is always the minimum of all batteries
# If "True", the transmitted CVL is the maximum of all batteries until all are in "float",
# than the minimum of all is taken. Attention: By using this function you rely on the functionality 
# and correct settings of the SerialBattery driver. Set "True" only if you know exactly
# what you are doing. If not sure, keep it at "False". 

KEEP_MAX_CVL = False

#######################################
####### Logging and reporting #########
#######################################

SEND_CELL_VOLTAGES = 0                                 # 0: Disable Cell Info in dbus, 1: Format: /Cell/BatteryName_Cell<ID>
LOGGING = 2                                            # 0: no logging, 1: print to console, 2: print to file
LOG_PERIOD = 600                                       # in seconds; if 0, periodic logging is disabled

Do you have any idea how to fix it? Best regards, Thomas

thkusch commented 1 year ago

Can be closed. The cause was BATTERY_PRODUCT_NAME = 'SerialBattery' instead of BATTERY_PRODUCT_NAME = 'JBD-AP21S002-L21S-200A-B-U-R-C'

The previous version of aggregate-batteries used BATTERY_NAME_KEY_WORD instead, where the default value ("SerialBattery") was correct