Louisvdw / dbus-serialbattery

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

Venus OS after reboot no BMS #1106

Closed mactoolz closed 1 month ago

mactoolz commented 1 month ago

Describe the problem

After the restart from Venus OS there are no coming all Seplos BMS or sometimes there are no BMS at the device list.

My solution for that is to unplug the original Venus USB RS485 adapter and plug in. They need many many times to get the device into the Venus OS. I think it needs 1 minute if i can see the BMS in my Venus OS device list.

Driver version

v.1.2.20240227beta

Venus OS device type

Cerbo GX

Venus OS version

3.41

BMS type

Seplos

Cell count

7

Battery count

7

Connection type

Serial USB adapter to RS485

Config file

[DEFAULT]

; --------- Set logging level ---------
; ERROR: Only errors are logged
; WARNING: Errors and warnings are logged
; INFO: Errors, warnings and info messages are logged
; DEBUG: Errors, warnings, info and debug messages are logged
LOGGING = INFO

; --------- Battery Current limits ---------
MAX_BATTERY_CHARGE_CURRENT    = 80.0
MAX_BATTERY_DISCHARGE_CURRENT = 100.0

; --------- Cell Voltages ---------
; Description:
;     Cell min/max voltages which are used to calculate the min/max battery voltage
; Example:
;     16 cells * 3.45V/cell = 55.2V max charge voltage. 16 cells * 2.90V = 46.4V min discharge voltage
MIN_CELL_VOLTAGE   = 2.900
; Max voltage (can seen as absorption voltage)
MAX_CELL_VOLTAGE   = 3.4
; Float voltage (can be seen as resting voltage)
FLOAT_CELL_VOLTAGE = 3.375

; --------- SOC reset voltage ---------
; Description:
;     May be needed to reset the SoC to 100% once in a while for some BMS, because of SoC drift.
;     Specify the cell voltage where the SoC should be reset to 100% by the BMS.
;       - JKBMS: SoC is reset to 100% if one cell reaches OVP (over voltage protection) voltage
;     As you have to adopt this value to your system, I reccomend to start with
;     OVP voltage - 0.030 (see Example).
;       - Try to increase (add) by 0.005 in steps, if the system does not switch to float mode, even if
;         the target voltage SOC_RESET_VOLTAGE * CELL_COUNT is reached.
;       - Try to decrease (lower) by 0.005 in steps, if the system hits the OVP too fast, before all
;         cells could be balanced and the system goes into protection mode multiple times.
; Example:
;     If OVP is 3.650, then start with 3.620 and increase/decrease by 0.005
; Note:
;     The value has to be higher as the MAX_CELL_VOLTAGE
SOC_RESET_VOLTAGE = 3.42
; Specify after how many days the soc reset voltage should be reached again
; The timer is reset when the soc reset voltage is reached
; Leave empty if you don't want to use this
; Example:
;     Value is set to 15
;     day 1: soc reset reached once
;     day 16: soc reset reached twice
;     day 31: soc reset not reached since it's very cloudy
;     day 34: soc reset reached since the sun came out
;     day 49: soc reset reached again, since last time it took 3 days to reach soc reset voltage
SOC_RESET_AFTER_DAYS = 1

; --------- Bluetooth BMS ---------
; Description:
;     Specify the Bluetooth BMS and it's MAC address that you want to install. Leave emty to disable
; Available Bluetooth BMS:
;     Jkbms_Ble, LltJbd_Ble
; Example for one BMS:
;     BLUETOOTH_BMS = Jkbms_Ble C8:47:8C:00:00:00
; Example for multiple BMS:
;     BLUETOOTH_BMS = Jkbms_Ble C8:47:8C:00:00:00, Jkbms_Ble C8:47:8C:00:00:11, Jkbms_Ble C8:47:8C:00:00:22
BLUETOOTH_BMS =

; --------- Bluetooth use USB ---------
; Description:  Some users reported issues to the built in bluetooth module, you can try to fix it with an USB
;     module. After a change you have to run reinstall-local.sh and to manual reboot the device!
;     The usb bluetooth module must have BLE support (bluetooth version >= 4.0)
;     Other bluetooth devices such as Ruuvi tags not tested yet.
; False: Use the built in bluetooth module
; True: Disable built in bluetooth module and try to use USB module
BLUETOOTH_USE_USB = False

; --------- CAN BMS ---------
; Description:
;     Specify the CAN port(s) where the BMS is connected to. Leave empty to disable
; Available CAN BMS:
;     Daly_Can, Jkbms_Can
; Example for one CAN port:
;     CAN_PORT = can0
; Example for multiple CAN ports:
;     CAN_PORT = can0, can8, can9
CAN_PORT =

; --------- BMS disconnect behaviour ---------
; Description:
;     Block charge and discharge when the communication to the BMS is lost. If you are removing the
;     BMS on purpose, then you have to restart the driver/system to reset the block.
; False:
;     Charge and discharge is not blocked on BMS communication loss for 20 minutes, if cell voltages are between
;     3.25 V and 3.35 V. Else the driver block charge and discharge after 60 seconds.
; True:
;     Charge and discharge is blocked on BMS communication loss, it's unblocked when connection is established
;     again or the driver/system is restarted. This is the Victron Energy default behaviour.
BLOCK_ON_DISCONNECT = False

; --------- Charge mode ---------
; Choose the mode for voltage / current limitations (True / False)
; False is a step mode: This is the default with limitations on hard boundary steps
; True is a linear mode:
;     For CCL and DCL the values between the steps are calculated for smoother values (by WaldemarFech)
;     For CVL max battery voltage is calculated dynamically in order that the max cell voltage is not exceeded
LINEAR_LIMITATION_ENABLE = True

; Specify in seconds how often the linear values should be recalculated
LINEAR_RECALCULATION_EVERY = 15
; Specify in percent when the linear values should be recalculated immediately
; Example:
;     5 for a immediate change, when the value changes by more than 5%
LINEAR_RECALCULATION_ON_PERC_CHANGE = 2

; --------- Charge Voltage limitation (affecting CVL) ---------
; Description:
;     Limit max charging voltage (MAX_CELL_VOLTAGE * cell count), switch from max voltage to float
;     voltage (FLOAT_CELL_VOLTAGE * cell count) and back
;     False: Max charging voltage is always kept
;     True: Max charging voltage is reduced based on charge mode
;         Step mode: After max voltage is reached for MAX_VOLTAGE_TIME_SEC it switches to float voltage. After
;             SoC is below SOC_LEVEL_TO_RESET_VOLTAGE_LIMIT it switches back to max voltage.
;         Linear mode: After max voltage is reachend and cell voltage difference is smaller or equal to
;             CELL_VOLTAGE_DIFF_KEEP_MAX_VOLTAGE_UNTIL it switches to float voltage after MAX_VOLTAGE_TIME_SEC
;             additional seconds.
;             After cell voltage difference is greater or equal to CELL_VOLTAGE_DIFF_TO_RESET_VOLTAGE_LIMIT
;             OR
;             SoC is below SOC_LEVEL_TO_RESET_VOLTAGE_LIMIT
;             it switches back to max voltage.
; Example when set to True:
;     Step mode:
;          The battery reached max voltage of 55.2V and hold it for 900 seconds, the the CVL is switched to
;          float voltage of 53.6V to don't stress the batteries. Allow max voltage of 55.2V again, if SoC is
;          once below 80%
;     Linear mode:
;          The battery reached max voltage of 55.2V and the max cell difference is 0.010V, then switch to float
;          voltage of 53.6V after 900 additional seconds to don't stress the batteries. Allow max voltage of
;          55.2V again if max cell difference is above 0.080V or SoC below 80%.
; Charge voltage control management enable (True/False).
CVCM_ENABLE = True

; -- CVL reset based on cell voltage diff (linear mode)
; Specify cell voltage diff where CVL limit is kept until diff is equal or lower
CELL_VOLTAGE_DIFF_KEEP_MAX_VOLTAGE_UNTIL        = 0.010
; Specify cell voltage diff where MAX_VOLTAGE_TIME_SEC restarts if diff is bigger
CELL_VOLTAGE_DIFF_KEEP_MAX_VOLTAGE_TIME_RESTART = 0.013
; Specify cell voltage diff where CVL limit is reset to max voltage, if value get above
; the cells are considered as imbalanced, if the cell diff exceeds 5% of the nominal cell voltage
; e.g. 3.2 V * 5 / 100 = 0.160 V
CELL_VOLTAGE_DIFF_TO_RESET_VOLTAGE_LIMIT        = 0.080

; -- CVL reset based on SoC option (step mode & linear mode)
; Specify how long the max voltage should be kept
;     Step mode: If reached then switch to float voltage
;     Linear mode: If cells are balanced keep max voltage for further MAX_VOLTAGE_TIME_SEC seconds
MAX_VOLTAGE_TIME_SEC = 45
; Specify SoC where CVL limit is reset to max voltage
;     Step mode: If SoC gets below
;     Linear mode: If cells are unbalanced or if SoC gets below
SOC_LEVEL_TO_RESET_VOLTAGE_LIMIT = 80

; --------- SOC calculation ---------
; Description:
;     Calculate the SOC in the driver. Do not use the SOC reported by the BMS
; SOC_CALCULATION:
;     True: Calc SOC in the driver, do not use SOC reported from BMS
;         - The SOC is calculated by integration of the current reported by the BMS
;         - The current reported from the BMS can be corrected by
;           the map (SOC_CALC_CURRENT_REPORTED_BY_BMS, SOC_CALC_CURRENT_MEASURED_BY_USER)
;         - The SOC is set to 100% if the following conditions apply for at least SOC_RESET_TIME seconds:
;             * Current is lower than SOC_RESET_CURRENT amps
;             * Sum of cell voltages >= self.max_battery_voltage - VOLTAGE_DROP
;         - The calculated SOC is stored in dbus to persist a driver restart
;     False: Use SOC reported from BMS (none of the other parameters apply)
; More info: https://github.com/Louisvdw/dbus-serialbattery/pull/868
SOC_CALCULATION   = False
SOC_RESET_CURRENT = 7
SOC_RESET_TIME    = 60
SOC_CALC_CURRENT_REPORTED_BY_BMS  = -300, 300
SOC_CALC_CURRENT_MEASURED_BY_USER = -300, 300
; Example to set small currents to zero
;     SOC_CALC_CURRENT_REPORTED_BY_BMS  = -300, -0.5, 0.5, 300
;     SOC_CALC_CURRENT_MEASURED_BY_USER = -300,    0,   0, 300

; --------- Cell Voltage Current limitation (affecting CCL/DCL) ---------
; Description: Maximal charge / discharge current will be in-/decreased depending on min and max cell voltages
; Example:
;     18 cells * 3.55V/cell = 63.9V max charge voltage
;     18 cells * 2.70V/cell = 48.6V min discharge voltage
;     But in reality not all cells reach the same voltage at the same time. The (dis)charge current
;     will be (in-/)decreased, if even ONE SINGLE BATTERY CELL reaches the limits

; Charge current control management referring to cell-voltage enable (True/False).
CCCM_CV_ENABLE = True
; Discharge current control management referring to cell-voltage enable (True/False).
DCCM_CV_ENABLE = True

; 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.50, 3.45, 3.40, 3.30
MAX_CHARGE_CURRENT_CV_FRACTION    =    0, 0.03,  0.6,    1

CELL_VOLTAGES_WHILE_DISCHARGING   = 2.80, 2.90, 3.00, 3.10
MAX_DISCHARGE_CURRENT_CV_FRACTION =    0,  0.1,  0.4,    1

; --------- Cell Voltage limitation (affecting CVL) ---------
; This function prevents a bad balanced battery to overcharge the cell with the highest voltage and the bms to
; switch off because of overvoltage of this cell.
;
; Example:
;     15 cells are at 3.4v, 1 cell is at 3.6v. Total voltage of battery is 54.6v and the Victron System sees no reason to
;     lower the charging current as the control_voltage (Absorbtion Voltage) ist 55.2v
;     In this case the Cell Voltage limitation kicks in and lowers the control_voltage to keep it close to the MAX_CELL_VOLTAGE.
;
; In theory this can also be done with CCL, but doing it with CVL has 2 advantages:
;     - In a well balanced system the current can be kept quite high till the end of charge by using MAX_CELL_VOLTAGE for charging.
;     - In systems with MPPTs and DC-feed-in activated the victron systems do not respect CCL, so CVL is the only way to prevent the
;       highest cell in a bad balanced system from overcharging.
;
; There are 2 methods implemented to calculate CVL:
;   1. penalty_sum-Method (CVL_ICONTROLLER_MODE = False)
;      The voltage-overshoot of all cells that exceed MAX_CELL_VOLTAGE is summed up and the control voltage is lowered by this "penalty_sum".
;      This is calculated every LINEAR_RECALCULATION_EVERY seconds.
;      In fact, this is a P-Controller.
;   2. I-Controller (CVL_ICONTROLLER_MODE = True)
;      An I-Controller tries to control the voltage of the highest cell to MAX_CELL_VOLTAGE + CELL_VOLTAGE_DIFF_KEEP_MAX_VOLTAGE_UNTIL.
;      (for example 3.45V+0.01V =3.46V). If the voltage of the highest cell is above this level, CVL is reduced. If the voltage is below, CVL is
;      increased until cellcount*MAX_CELL_VOLTAGE.
;      An I-Part of 0.2 V/Vs (CVL_ICONTROLLER_FACTOR) has proved to be a stable and fast controlling-behaviour.
;      This method is not as fast as the penalty_sum-Method but usually smoother and more stable against toggeling and has no stationary deviation.
; More info: https://github.com/Louisvdw/dbus-serialbattery/pull/882
CVL_ICONTROLLER_MODE   = True
CVL_ICONTROLLER_FACTOR = 0.2

; --------- Temperature limitation (affecting CCL/DCL) ---------
; Description:
;     Maximal charge / discharge current will be in-/decreased depending on temperature
; Example:
;     The temperature limit will be monitored to control the currents. If there are two temperature senors,
;     then the worst case will be calculated and the more secure lower current will be set.
; Charge current control management referring to temperature enable (True/False).
CCCM_T_ENABLE = True
; Charge current control management referring to temperature enable (True/False).
DCCM_T_ENABLE = True

; Set steps to reduce battery current
; The current will be changed linear between those steps if LINEAR_LIMITATION_ENABLE is set to 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, 0.80, 1.00, 1.00, 0.40, 0.00

TEMPERATURES_WHILE_DISCHARGING   =  -20,    0,    5,   10,   15,   45,   55
MAX_DISCHARGE_CURRENT_T_FRACTION = 0.00, 0.20, 0.30, 0.40, 1.00, 1.00, 0.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 = True
; Discharge current control management enable (True/False).
DCCM_SOC_ENABLE = True

; Set steps to reduce battery current
; The current will be changed linear between those steps if LINEAR_LIMITATION_ENABLE is set to True
SOC_WHILE_CHARGING                 =  100,   95,   90,   85
MAX_CHARGE_CURRENT_SOC_FRACTION    = 0.00, 0.15, 0.50, 1.00

SOC_WHILE_DISCHARGING              =    0,    5,   10,   15,   20
MAX_DISCHARGE_CURRENT_SOC_FRACTION = 0.00, 0.10, 0.20, 0.50, 1.00

; --------- Time-To-Go ---------
; Description:
;     Calculates the time to go shown in the GUI
;     Recalculation is done based on TIME_TO_SOC_RECALCULATE_EVERY
TIME_TO_GO_ENABLE = True

; --------- Time-To-Soc ---------
; Description:
;     Calculates the time to a specific SoC
; Example:
;     TIME_TO_SOC_POINTS = 50, 25, 15, 0
;     6h 24m remaining until 50% SoC
;     17h 36m remaining until 25% SoC
;     22h 5m remaining until 15% SoC
;     28h 48m remaining until 0% SoC
; Set of SoC percentages to report on dbus and MQTT. The more you specify the more it will impact system performance.
; [Valid values 0-100, comma separated list. More that 20 intervals are not recommended]
; Example: TIME_TO_SOC_POINTS = 100, 95, 90, 85, 75, 50, 25, 20, 10, 0
; Leave empty to disable
TIME_TO_SOC_POINTS =
; Specify TimeToSoc value type [Valid values 1, 2, 3]
; 1 Seconds
; 2 Time string <days>d <hours>h <minutes>m <seconds>s
; 3 Both seconds and time string "<seconds> [<days>d <hours>h <minutes>m <seconds>s]"
TIME_TO_SOC_VALUE_TYPE = 1
; Specify in seconds how often the TimeToSoc should be recalculated
; Minimum are 5 seconds to prevent CPU overload
TIME_TO_SOC_RECALCULATE_EVERY = 30
; Include TimeToSoC points when moving away from the SoC point [Valid values True, False]
; These will be as negative time. Disabling this improves performance slightly
TIME_TO_SOC_INC_FROM = False

; --------- Additional settings ---------
; Specify one or more BMS types to load else leave empty to try to load all available
; Available BMS:
;     Daly, Ecs, HeltecModbus, HLPdataBMS4S, Jkbms, Lifepower, LltJbd, Renogy, Seplos
; Available BMS, but disabled by default (just enter one or more below and it will be enabled):
;     ANT, MNB, Sinowealth
BMS_TYPE =

; Exclute this serial devices from the driver startup
; Example:
;     /dev/ttyUSB2, /dev/ttyUSB4
EXCLUDED_DEVICES = 

; Auto reset SoC
; If on, then SoC is reset to 100%, if the value switches from absorption to float voltage
; Currently only working for Daly BMS and JKBMS BLE
AUTO_RESET_SOC = True

; Publish the config settings to the dbus path "/Info/Config/"
PUBLISH_CONFIG_VALUES = True

; Select the format of cell data presented on dbus [Valid values 0,1,2,3]
; 0 Do not publish all the cells (only the min/max cell data as used by the default GX)
; 1 Format: /Voltages/Cell (also available for display on Remote Console)
; 2 Format: /Cell/#/Volts
; 3 Both formats 1 and 2
BATTERY_CELL_DATA_FORMAT = 1

; Simulate Midpoint graph (True/False).
MIDPOINT_ENABLE = False

; Battery temperature
; Specify how the battery temperature is assembled
; 0 Get mean of temperature sensor 1 to sensor 4
; 1 Get only temperature from temperature sensor 1
; 2 Get only temperature from temperature sensor 2
; 3 Get only temperature from temperature sensor 3
; 4 Get only temperature from temperature sensor 4
TEMP_BATTERY = 0

; Temperature sensor 1 name
TEMP_1_NAME = Temp 1

; Temperature sensor 2 name
TEMP_2_NAME = Temp 2

; Temperature sensor 2 name
TEMP_3_NAME = Temp 3

; Temperature sensor 2 name
TEMP_4_NAME = Temp 4

; --------- BMS specific settings ---------

; -- LltJbd settings
; SoC low levels
; Note:
;     SOC_LOW_WARNING is also used to calculate the Time-To-Go even if you are not using a LltJbd BMS
SOC_LOW_WARNING = 10
SOC_LOW_ALARM   = 7

; -- Daly settings
; Battery capacity (amps), if the BMS does not support reading it
BATTERY_CAPACITY = 50
; Invert Battery Current. Default non-inverted. Set to -1 to invert
INVERT_CURRENT_MEASUREMENT = 1

; -- ESC GreenMeter and Lipro device settings
GREENMETER_ADDRESS  = 1
LIPRO_START_ADDRESS = 2
LIPRO_END_ADDRESS   = 4
LIPRO_CELL_COUNT    = 15

; -- HeltecModbus (Heltec SmartBMS/YYBMS) settings
; Set the Modbus addresses from the adapters
; Separate each address to check by a comma like: 1, 2, 3, ...
; factory default address will be 1
HELTEC_MODBUS_ADDR = 1

; --------- Voltage drop ---------
; If you have a voltage drop between the BMS and the charger because of wire size or length
; then you can specify the voltage drop here. The driver will then add the voltage drop
; to the calculated CVL to compensate.
; Example:
;     cell count: 16
;     MAX_CELL_VOLTAGE = 3.45
;     max voltage calculated = 16 * 3.45 = 55.20
;     CVL is set to 55.20 V and the battery is now charged until the charger reaches 55.20 V.
;     The BMS now measures 55.05 V since there is a voltage drop of 0.15 V on the cable.
;     Since the dbus-serialbattery reads the voltage of 55.05 V from the BMS the max voltage
;     of 55.20 V is never reached and max voltage is kept forever.
;     By setting the VOLTAGE_DROP to 0.15 V the voltage on the charger is increased and the
;     target voltage on the BMS is reached.
VOLTAGE_DROP = 0.00

Relevant log output

@4000000066b230b933842dd4 *** CCGX booted (0) ***
@4000000066b230ba2df64dd4 *** starting serial-starter ***
@4000000066b230bb1761ec7c serstart starting
@4000000066b230bb19d0b614 INFO: loading config file /etc/venus/serial-starter.conf
@4000000066b230bc3ae22a54 INFO: loading config file /data/conf/serial-starter.d/dbus-serialbattery.conf
@4000000066b230be26151794 INFO: Create daemontools service mk2-dbus.ttyS4
@4000000066b230c00fb1d85c INFO: Create daemontools service vedirect-interface.ttyS5
@4000000066b230c131bceaf4 INFO: Create daemontools service vedirect-interface.ttyS6
@4000000066b230c31cb1f474 INFO: Create daemontools service vedirect-interface.ttyS7
@4000000066b230c436fc0acc INFO: Start service mk2-dbus.ttyS4
@4000000066b230c517e178d4 INFO: Create daemontools service dbus-serialbattery.ttyUSB0
@4000000066b230c621896554 INFO: Start service vedirect-interface.ttyS5
@4000000066b230c71a05feb4 INFO: Create daemontools service dbus-serialbattery.ttyUSB1
@4000000066b230c8039a8604 INFO: Start service vedirect-interface.ttyS6
@4000000066b230c90c26968c INFO: Create daemontools service dbus-serialbattery.ttyUSB2
@4000000066b230c9298a068c INFO: Start service vedirect-interface.ttyS7
@4000000066b230cb0a3afee4 INFO: Create daemontools service dbus-serialbattery.ttyUSB3
@4000000066b230cb287df974 INFO: Start service dbus-serialbattery.ttyUSB0 once
@4000000066b230cc384904fc INFO: Create daemontools service dbus-serialbattery.ttyUSB4
@4000000066b230cd27c47544 INFO: Start service dbus-serialbattery.ttyUSB1 once
@4000000066b230ce289d31a4 INFO: Create daemontools service dbus-serialbattery.ttyUSB5
@4000000066b230cf1a3ce564 INFO: Start service dbus-serialbattery.ttyUSB2 once
@4000000066b230d10078d78c INFO: Create daemontools service dbus-serialbattery.ttyUSB6
@4000000066b230d11885c754 INFO: Start service dbus-serialbattery.ttyUSB3 once
@4000000066b230d307c5c8c4 INFO: Start service dbus-serialbattery.ttyUSB4 once
@4000000066b230d43214f9ec INFO: Start service dbus-serialbattery.ttyUSB5 once
@4000000066b230d7134b991c INFO: Start service dbus-serialbattery.ttyUSB6 once
@4000000066b2331a27734fd4 INFO: Create daemontools service gps-dbus.ttyUSB1
@4000000066b233202b195d04 INFO: Start service gps-dbus.ttyUSB1 once
@4000000066b233220653c234 INFO: Create daemontools service gps-dbus.ttyUSB2
@4000000066b233280abf4244 INFO: Start service gps-dbus.ttyUSB2 once
@4000000066b233292e3c2c8c INFO: Create daemontools service vedirect-interface.ttyUSB1
@4000000066b2332d1689572c INFO: Create daemontools service gps-dbus.ttyUSB3
@4000000066b2332f33ba457c INFO: Start service vedirect-interface.ttyUSB1 once
@4000000066b233302f15b024 INFO: Create daemontools service vedirect-interface.ttyUSB2
@4000000066b233331aaf65e4 INFO: Start service gps-dbus.ttyUSB3 once
@4000000066b233340f399b1c INFO: Start service dbus-serialbattery.ttyUSB1 once
@4000000066b2333539619d04 INFO: Create daemontools service gps-dbus.ttyUSB4
@4000000066b23336337531e4 INFO: Start service vedirect-interface.ttyUSB2 once
@4000000066b2333b21ac431c INFO: Start service dbus-serialbattery.ttyUSB2 once
@4000000066b2333c0800168c INFO: Start service gps-dbus.ttyUSB4 once
@4000000066b2333d0ad83114 INFO: Create daemontools service vedirect-interface.ttyUSB3
@4000000066b2333e32730fdc INFO: Create daemontools service gps-dbus.ttyUSB5
@4000000066b23343137773ac INFO: Start service vedirect-interface.ttyUSB3 once
@4000000066b233441639b08c INFO: Create daemontools service gps-dbus.ttyUSB6
@4000000066b233443a617134 INFO: Start service gps-dbus.ttyUSB5 once
@4000000066b2334735b07be4 INFO: Start service dbus-serialbattery.ttyUSB3 once
@4000000066b2334916c68b24 INFO: Create daemontools service vedirect-interface.ttyUSB4
@4000000066b2334a1a796994 INFO: Start service gps-dbus.ttyUSB6 once
@4000000066b2334f0504dfbc INFO: Create daemontools service vedirect-interface.ttyUSB5
@4000000066b2334f19dc3f34 INFO: Start service vedirect-interface.ttyUSB4 once
@4000000066b233550a499d14 INFO: Start service dbus-serialbattery.ttyUSB4 once
@4000000066b233550a7131e4 INFO: Start service vedirect-interface.ttyUSB5 once
@4000000066b233562b38b08c INFO: Create daemontools service vedirect-interface.ttyUSB6
@4000000066b2335a14742afc INFO: Start service dbus-serialbattery.ttyUSB5 once
@4000000066b2335c34072cfc INFO: Start service vedirect-interface.ttyUSB6 once
@4000000066b23362364fb984 INFO: Start service dbus-serialbattery.ttyUSB6 once
@4000000066b233d527c86ce4 INFO: Create daemontools service gps-dbus.ttyUSB0
@4000000066b233db317487b4 INFO: Start service gps-dbus.ttyUSB0 once
@4000000066b233e50dad84ac INFO: Create daemontools service vedirect-interface.ttyUSB0
@4000000066b233eb16c9a034 INFO: Start service vedirect-interface.ttyUSB0 once
@4000000066b233ef13c95c6c INFO: Start service dbus-serialbattery.ttyUSB0 once

@4000000066b230f3387b30bc INFO:SerialBattery:Testing HLPdataBMS4S
@4000000066b230f42dbbf454 ERROR:SerialBattery:>>> ERROR: No reply - returning
@4000000066b230f42dc98114 INFO:SerialBattery:Testing Jkbms
@4000000066b230f5042ac7b4 ERROR:SerialBattery:>>> ERROR: No reply - returning
@4000000066b230f504b6ac34 INFO:SerialBattery:Testing Lifepower
@4000000066b230f51731cc2c ERROR:SerialBattery:>>> ERROR: No reply - returning
@4000000066b230f5178c0da4 INFO:SerialBattery:Testing LltJbd
@4000000066b230f529ec4eb4 ERROR:SerialBattery:>>> ERROR: No reply - returning
@4000000066b230f52a9cbeac INFO:SerialBattery:Testing Renogy at address "\x30"
@4000000066b230f601397bf4 ERROR:SerialBattery:>>> ERROR: No reply - returning
@4000000066b230f601c7f0b4 INFO:SerialBattery:Testing Renogy at address "\xf7"
@4000000066b230f61372438c ERROR:SerialBattery:>>> ERROR: No reply - returning
@4000000066b230f613ca7994 INFO:SerialBattery:Testing Seplos
@4000000066b230f7238f1c7c INFO:SerialBattery:Connection established to Seplos
@4000000066b230f7239e37ac INFO:SerialBattery:Battery Seplos connected to dbus from /dev/ttyUSB6
@4000000066b230f723b1989c INFO:SerialBattery:========== Settings ==========
@4000000066b230f723c38674 INFO:SerialBattery:> Connection voltage: 53.6V | Current: 0.0A | SoC: 90.2%
@4000000066b230f723d08a7c INFO:SerialBattery:> Cell count: 16 | Cells populated: 0
@4000000066b230f723dde85c INFO:SerialBattery:> LINEAR LIMITATION ENABLE: True
@4000000066b230f72541123c INFO:SerialBattery:> MIN CELL VOLTAGE: 2.9V | MAX CELL VOLTAGE: 3.4V
@4000000066b230f72559f16c INFO:SerialBattery:> MAX BATTERY CHARGE CURRENT: 80.0A | MAX BATTERY DISCHARGE CURRENT: 100.0A
@4000000066b230f7256130e4 INFO:SerialBattery:> CVCM:     True
@4000000066b230f7256ee0cc INFO:SerialBattery:> CCCM CV:  True  | DCCM CV:  True
@4000000066b230f726b8f4cc INFO:SerialBattery:> CCCM T:   True  | DCCM T:   True
@4000000066b230f726c5d5ac INFO:SerialBattery:> CCCM SOC: True  | DCCM SOC: True
@4000000066b230f726d5f2ac INFO:SerialBattery:Serial Number/Unique Identifier: SeplosBMS16cells_286.0Ah
@4000000066b2313c2ef070fc INFO:SerialBattery:Found existing battery with DeviceInstance = 7
@4000000066b2313f25a882b4 INFO:SerialBattery:DeviceInstance = 7
@4000000066b2313f25d0715c INFO:SerialBattery:PID file created successfully: /var/tmp/dbus-serialbattery_7.pid
@4000000066b2313f25e46e8c INFO:SerialBattery:Used DeviceInstances = ['2', '4', '3', '1', '5', '7', '8']
@4000000066b2313f25fdc2ec INFO:SerialBattery:com.victronenergy.battery.ttyUSB6
@4000000066b2313f2f609fbc INFO:SerialBattery:publish config values = True
@4000000066b232d11ede3e9c Traceback (most recent call last):
@4000000066b232d11ede65ac   File "/usr/lib/python3.8/site-packages/serial/serialposix.py", line 265, in open
@4000000066b232d11ede754c     self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
@4000000066b232d11ede8104 FileNotFoundError: [Errno 2] No such file or directory: '/dev/ttyUSB6'
@4000000066b232d11ede90a4 
@4000000066b232d11ede948c During handling of the above exception, another exception occurred:
@4000000066b232d11edea044 
@4000000066b232d11ee16734 Traceback (most recent call last):
@4000000066b232d11ee172ec   File "/opt/victronenergy/dbus-serialbattery/dbushelper.py", line 754, in publish_battery
@4000000066b232d11ee1828c     result = self.battery.refresh_data()
@4000000066b232d11ee18a5c   File "/opt/victronenergy/dbus-serialbattery/bms/seplos.py", line 127, in refresh_data
@4000000066b232d11ee19614     result_status = self.read_status_data()
@4000000066b232d11ee1a1cc   File "/opt/victronenergy/dbus-serialbattery/bms/seplos.py", line 209, in read_status_data
@4000000066b232d11ee21ae4     data = self.read_serial_data_seplos(
@4000000066b232d11ee2269c   File "/opt/victronenergy/dbus-serialbattery/bms/seplos.py", line 300, in read_serial_data_seplos
@4000000066b232d11ee2363c     with serial.Serial(self.port, baudrate=self.baud_rate, timeout=1) as ser:
@4000000066b232d11ee241f4   File "/usr/lib/python3.8/site-packages/serial/serialutil.py", line 240, in __init__
@4000000066b232d11ee4b6dc     self.open()
@4000000066b232d11ee4beac   File "/usr/lib/python3.8/site-packages/serial/serialposix.py", line 268, in open
@4000000066b232d11ee4ca64     raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
@4000000066b232d11ee4da04 serial.serialutil.SerialException: [Errno 2] could not open port /dev/ttyUSB6: [Errno 2] No such file or directory: '/dev/ttyUSB6'
@4000000066b232d224788664 /opt/victronenergy/serial-starter/run-service.sh: line 15: kill: (2330) - No such process
@4000000066b233681e5403e4 INFO:SerialBattery:
@4000000066b233681e67708c INFO:SerialBattery:Starting dbus-serialbattery
@4000000066b233681e8eb73c INFO:SerialBattery:Venus OS v3.41
@4000000066b233681f2d7bc4 INFO:SerialBattery:dbus-serialbattery v1.2.20240227beta
@4000000066b2337820591ecc INFO:SerialBattery:-- Testing BMS: 1 of 3 rounds
@4000000066b23378205941f4 INFO:SerialBattery:Testing Daly at address "\x40"
@4000000066b23378283f7974 ERROR:SerialBattery:>>> ERROR: No reply - returning
@4000000066b23378284f11a4 INFO:SerialBattery:Testing Daly at address "\x80"
@4000000066b233783057f80c ERROR:SerialBattery:>>> ERROR: No reply - returning
@4000000066b2337830656974 INFO:SerialBattery:Testing Ecs
@4000000066b23378363e6bd4 ERROR:SerialBattery:>>> ERROR: No reply - returning
@4000000066b23378363e92e4 INFO:SerialBattery:Testing HeltecModbus
@4000000066b2337c2a9e3d7c ERROR:SerialBattery:>>> ERROR: No reply - returning
@4000000066b2337c2a9e648c INFO:SerialBattery:Testing HLPdataBMS4S
@4000000066b2337d1fc53f54 ERROR:SerialBattery:>>> ERROR: No reply - returning
@4000000066b2337d1fc5627c INFO:SerialBattery:Testing Jkbms
@4000000066b2337d321c8f54 ERROR:SerialBattery:>>> ERROR: No reply - returning
@4000000066b2337d32b62b8c INFO:SerialBattery:Testing Lifepower
@4000000066b2337e09b80f5c ERROR:SerialBattery:>>> ERROR: No reply - returning
@4000000066b2337e0a124134 INFO:SerialBattery:Testing LltJbd
@4000000066b2337e1cc10bbc ERROR:SerialBattery:>>> ERROR: No reply - returning
@4000000066b2337e1d12583c INFO:SerialBattery:Testing Renogy at address "\x30"
@4000000066b2337e2ece9504 ERROR:SerialBattery:>>> ERROR: No reply - returning
@4000000066b2337e2f48ce14 INFO:SerialBattery:Testing Renogy at address "\xf7"
@4000000066b2337f04af7874 ERROR:SerialBattery:>>> ERROR: No reply - returning
@4000000066b2337f052cb6f4 INFO:SerialBattery:Testing Seplos
@4000000066b233800d9d7364 INFO:SerialBattery:Connection established to Seplos
@4000000066b233800db24384 INFO:SerialBattery:Battery Seplos connected to dbus from /dev/ttyUSB6
@4000000066b233800ddc4954 INFO:SerialBattery:========== Settings ==========
@4000000066b233800df0794c INFO:SerialBattery:> Connection voltage: 54.05V | Current: 35.03A | SoC: 91.0%
@4000000066b233800dffe684 INFO:SerialBattery:> Cell count: 16 | Cells populated: 0
@4000000066b233800e0e84b4 INFO:SerialBattery:> LINEAR LIMITATION ENABLE: True
@4000000066b233800ecac034 INFO:SerialBattery:> MIN CELL VOLTAGE: 2.9V | MAX CELL VOLTAGE: 3.4V
@4000000066b233800ee05b74 INFO:SerialBattery:> MAX BATTERY CHARGE CURRENT: 80.0A | MAX BATTERY DISCHARGE CURRENT: 100.0A
@4000000066b233800ef239ac INFO:SerialBattery:> CVCM:     True
@4000000066b2338010501814 INFO:SerialBattery:> CCCM CV:  True  | DCCM CV:  True
@4000000066b233801064d4ac INFO:SerialBattery:> CCCM T:   True  | DCCM T:   True
@4000000066b2338010c2c38c INFO:SerialBattery:> CCCM SOC: True  | DCCM SOC: True
@4000000066b2338011845254 INFO:SerialBattery:Serial Number/Unique Identifier: SeplosBMS16cells_287.0Ah
@4000000066b233982c5557a4 INFO:SerialBattery:Found existing battery with DeviceInstance = 8
@4000000066b2339b00cd2594 INFO:SerialBattery:DeviceInstance = 8
@4000000066b2339b00eea7b4 INFO:SerialBattery:PID file created successfully: /var/tmp/dbus-serialbattery_8.pid
@4000000066b2339b00fd037c INFO:SerialBattery:Used DeviceInstances = ['2', '4', '3', '1', '5', '7', '8']
@4000000066b2339b01102204 INFO:SerialBattery:com.victronenergy.battery.ttyUSB6
@4000000066b2339b0926c024 INFO:SerialBattery:publish config values = True

Any other information that may be helpful

No response

mactoolz commented 1 month ago

All Seplos batteries the have the different in the capacity, so it is possible to define which batterie comes into the cerbo GX.

e.g. Pack01 -> 281Ah Pack02 -> 282Ah and so on.

mr-manuel commented 1 month ago

Please check the docs, since this is no driver issue, but an adapter, cabeling or USB hub issue.

You could also check the CPU load.

mactoolz commented 1 month ago

No, there is no wireing problems. After unplug and plug in is everything working.

If we have a cable problem it doesnt work for many days ...

mactoolz commented 1 month ago

The cpu load is cery high, for each of them serial adapter the cpu load goes up for 6% ...

mr-manuel commented 1 month ago

Please describe better your setup. Which adapters are you using, which GX device, USB hub?

mactoolz commented 1 month ago

7x Victron Original RS485 Adapter 10x USB Hub with seperate power plug Cerbo GX, 3.41 Version

mr-manuel commented 1 month ago

The only thing that I have in mind, is that you could specify the BMS type in the config.ini.

mactoolz commented 1 month ago

which parameter is that at the config ?

mr-manuel commented 1 month ago

https://github.com/Louisvdw/dbus-serialbattery/blob/fd0fc1a193427df6ca0fadd141aa57826f761819/etc/dbus-serialbattery/config.default.ini#L321-L327

mactoolz commented 1 month ago

why do you think that is the solution ? What happens if the parameter set to seplos BMS Type

mactoolz commented 1 month ago

i set the parameter, it doesnt work.

mactoolz commented 1 month ago

image

mr-manuel commented 1 month ago

why do you think that is the solution ? What happens if the parameter set to seplos BMS Type

It is written in the description!?

i set the parameter, it doesnt work.

what does not work?

Anyway no one tested it with that much batteries except you. Unfortunately I have no idea to help you further.

mactoolz commented 1 month ago

ok, but it should be possible to integrate the number of serial adapters in the first place, shouldn't it?

What can I test so that it somehow works in some way? the error can be found ?

The number of 7 adapters is a bit more than normal, but it should be possible.

mr-manuel commented 1 month ago

As you can see in the logs, the driver cannot see the USB to serial adapter anymore since it's gone in the OS.

@4000000066b232d11ede3e9c Traceback (most recent call last):
@4000000066b232d11ede65ac   File "/usr/lib/python3.8/site-packages/serial/serialposix.py", line 265, in open
@4000000066b232d11ede754c     self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
@4000000066b232d11ede8104 FileNotFoundError: [Errno 2] No such file or directory: '/dev/ttyUSB6'
@4000000066b232d11ede90a4 
@4000000066b232d11ede948c During handling of the above exception, another exception occurred:
@4000000066b232d11edea044 
@4000000066b232d11ee16734 Traceback (most recent call last):
@4000000066b232d11ee172ec   File "/opt/victronenergy/dbus-serialbattery/dbushelper.py", line 754, in publish_battery
@4000000066b232d11ee1828c     result = self.battery.refresh_data()
@4000000066b232d11ee18a5c   File "/opt/victronenergy/dbus-serialbattery/bms/seplos.py", line 127, in refresh_data
@4000000066b232d11ee19614     result_status = self.read_status_data()
@4000000066b232d11ee1a1cc   File "/opt/victronenergy/dbus-serialbattery/bms/seplos.py", line 209, in read_status_data
@4000000066b232d11ee21ae4     data = self.read_serial_data_seplos(
@4000000066b232d11ee2269c   File "/opt/victronenergy/dbus-serialbattery/bms/seplos.py", line 300, in read_serial_data_seplos
@4000000066b232d11ee2363c     with serial.Serial(self.port, baudrate=self.baud_rate, timeout=1) as ser:
@4000000066b232d11ee241f4   File "/usr/lib/python3.8/site-packages/serial/serialutil.py", line 240, in __init__
@4000000066b232d11ee4b6dc     self.open()
@4000000066b232d11ee4beac   File "/usr/lib/python3.8/site-packages/serial/serialposix.py", line 268, in open
@4000000066b232d11ee4ca64     raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
@4000000066b232d11ee4da04 serial.serialutil.SerialException: [Errno 2] could not open port /dev/ttyUSB6: [Errno 2] No such file or directory: '/dev/ttyUSB6'

Since this is a OS problem and not a driver problem I will close this issue.

You could try to open a question in the Victron Community.

mactoolz commented 1 month ago

but this is not correct, the serial is available !!!

mactoolz commented 1 month ago

i think the driver start to early to get the serial adapter, the OS is not ready to get the USB Adapter !

mr-manuel commented 1 month ago

You could read the docs to understand how the driver works: https://mr-manuel.github.io/venus-os_dbus-serialbattery_docs/troubleshoot/

Serial adapter is recognized -> dbus-serialbattery is tested on it -> if successful then dbus-serialbattery is bind to the serial port -> adapter or something else in the OS crashes and the adapter is not reachable anymre.

dbus-serialbattery is only started, if the serial adapter is recognized, so it is not possible to start too early.

You have to troubleshoot your system messages in this case. This is nothing for this driver.

mactoolz commented 1 month ago

Ok, again, but if i restart the usb adapter, it works. I think the driver do not wait correctly !!!

mactoolz commented 1 month ago

Hi,

I really have to say. All the work in honour, but you can't leave it like that and close the post.

Then take such a constellation as an incentive and try to solve the issue. I really don't think it's right to simply claim that this is an operating system problem. Yes, I know, it's private time, you don't earn any money from it.

But I maintain that the driver is not integrating correctly at this point.

Etc etc.

But simply ignoring the issue is not fair.

mr-manuel commented 1 month ago

Resuming again your statements for you:

  1. My solution for that is to unplug the original Venus USB RS485 adapter and plug in.

  2. @4000000066b232d11ede3e9c Traceback (most recent call last):
    @4000000066b232d11ede65ac   File "/usr/lib/python3.8/site-packages/serial/serialposix.py", line 265, in open
    @4000000066b232d11ede754c     self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
    @4000000066b232d11ede8104 FileNotFoundError: [Errno 2] No such file or directory: '/dev/ttyUSB6'
    @4000000066b232d11ede90a4 
    @4000000066b232d11ede948c During handling of the above exception, another exception occurred:
    @4000000066b232d11edea044 
    @4000000066b232d11ee16734 Traceback (most recent call last):
    @4000000066b232d11ee172ec   File "/opt/victronenergy/dbus-serialbattery/dbushelper.py", line 754, in publish_battery
    @4000000066b232d11ee1828c     result = self.battery.refresh_data()
    @4000000066b232d11ee18a5c   File "/opt/victronenergy/dbus-serialbattery/bms/seplos.py", line 127, in refresh_data
    @4000000066b232d11ee19614     result_status = self.read_status_data()
    @4000000066b232d11ee1a1cc   File "/opt/victronenergy/dbus-serialbattery/bms/seplos.py", line 209, in read_status_data
    @4000000066b232d11ee21ae4     data = self.read_serial_data_seplos(
    @4000000066b232d11ee2269c   File "/opt/victronenergy/dbus-serialbattery/bms/seplos.py", line 300, in read_serial_data_seplos
    @4000000066b232d11ee2363c     with serial.Serial(self.port, baudrate=self.baud_rate, timeout=1) as ser:
    @4000000066b232d11ee241f4   File "/usr/lib/python3.8/site-packages/serial/serialutil.py", line 240, in __init__
    @4000000066b232d11ee4b6dc     self.open()
    @4000000066b232d11ee4beac   File "/usr/lib/python3.8/site-packages/serial/serialposix.py", line 268, in open
    @4000000066b232d11ee4ca64     raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
    @4000000066b232d11ee4da04 serial.serialutil.SerialException: [Errno 2] could not open port /dev/ttyUSB6: [Errno 2] No such file or directory: '/dev/ttyUSB6'
  3. After unplug and plug in is everything working.

    All this indicated, that the serial to USB adapter is crashing and not available anymore to the OS. Again for the last time: As soon as the OS recognizes a serial adapter it starts the driver. NO serial adapter recognized -> NO driver started. It cannot start to early, it's impossible.

    For sure you checked, that the USB to serial adapter is still reachable under /dev/ttyUSB* after it crashed, right? ls -l /dev/ttyUSB*

  4. The cpu load is cery high, for each of them serial adapter the cpu load goes up for 6% ...

    Probably you meant "very" high. The Cerbo GX is one of the weaker devices and I'm sure that it cannot handle the load. Even other users have load problems with a much more powerful Raspberry Pi 4 with 6 batteries.

    But it seems to me, that you do not want to read the documentation and troubleshooting the problem. Unfortunately in this case I'm reaching my possibilities to help you.

    How to troubleshoot high CPU load?

    How the driver works

    How many USB to serial adapters can I connect?

  5. The number of 7 adapters is a bit more than normal, but it should be possible.

    Please tell me more about this. Did you make a research? Please post some links to the results and sources.

    On over 9.000 installed systems only about 40 systems have more than 5 batteries.

  6. But I maintain that the driver is not integrating correctly at this point.

    This tells me that you understood how the driver and the integration with the OS works, as well as how the OS handles the USB to serial adapters. Feel free to open a PR with the solution.

You also ignored my recommendation:

You could try to open a question in the Victron Community.

Please post a link to the question you made in the Victron Community yesterday.

I really have to say. All the work in honour, but you can't leave it like that and close the post.

That could interest you: https://github.com/mr-manuel/venus-os_dbus-serialbattery/issues/50#issuecomment-2220120814

By the way, if you honour all the work, did you ever made a donation?