Louisvdw / dbus-serialbattery

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

Daly BMS - Repeated bms interruptions #770

Closed harald0815 closed 11 months ago

harald0815 commented 1 year ago

Describe the problem

Describe the problem

A connection problem occurs several times a day (NO BMS). after a restart everything works again. After some troubleshooting it seems the bms is going from ttyUSB0 to ttyUSB1. In addition, the problem occurs more often with Venus OS v3.00 than with v2.94. Before updating to v3.00 there were no problems.

Driver version

1.0.20230724beta

Venus OS device type

Cerbo GX

Venus OS version

v3.00 and v2.94

BMS type

Daly Smart BMS

Cell count

16

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 = 120.0
MAX_BATTERY_DISCHARGE_CURRENT = 140.0
BATTERY_CAPACITY = 280
INVERT_CURRENT_MEASUREMENT = -1
BLOCK_ON_DISCONNECT = False

Relevant log output

@4000000064c7d79e127230dc *** starting serial-starter ***
@4000000064c7d79f04b9d0e4 serstart starting
@4000000064c7d79f067534b4 INFO: loading config file /etc/venus/serial-starter.conf
@4000000064c7d7a0016b03a4 INFO: loading config file /data/conf/serial-starter.d/dbus-serialbattery.conf
@4000000064c7d7a136483b8c INFO: Create daemontools service mk2-dbus.ttyS4
@4000000064c7d7a32040570c INFO: Create daemontools service vedirect-interface.ttyS5
@4000000064c7d7a5049fc8d4 INFO: Create daemontools service vedirect-interface.ttyS6
@4000000064c7d7a6209ee614 INFO: Create daemontools service vedirect-interface.ttyS7
@4000000064c7d7a80bb47b9c INFO: Start service mk2-dbus.ttyS4
@4000000064c7d7a8171752d4 INFO: Create daemontools service dbus-serialbattery.ttyUSB0
@4000000064c7d7a92f12f8d4 INFO: Start service vedirect-interface.ttyS5
@4000000064c7d7aa1117add4 INFO: Create daemontools service dbus-cgwacs.ttyUSB1
@4000000064c7d7ab1324f67c INFO: Start service vedirect-interface.ttyS6
@4000000064c7d7ac2ccad5c4 INFO: Start service vedirect-interface.ttyS7
@4000000064c7d7ae3807f4bc INFO: Start service dbus-serialbattery.ttyUSB0 once
@4000000064c7d7b0335eeac4 INFO: Start service dbus-cgwacs.ttyUSB1 once

root@einstein:~# tail -F -n 100 /data/log/dbus-serialbattery.ttyUSB0/current
@4000000064c7d7bf11a2752c INFO:SerialBattery:
@4000000064c7d7bf1420dec4 INFO:SerialBattery:Starting dbus-serialbattery
@4000000064c7d7bf150f9fdc INFO:SerialBattery:dbus-serialbattery v1.0.20230724beta
@4000000064c7d7bf15516b9c INFO:SerialBattery:-- Testing BMS: 1 of 3 rounds
@4000000064c7d7bf15a557fc INFO:SerialBattery:Testing Daly at address "\x40"
@4000000064c7d7bf2845130c INFO:SerialBattery:Connection established to Daly
@4000000064c7d7bf28453634 INFO:SerialBattery:Battery Daly connected to dbus from /dev/ttyUSB0
@4000000064c7d7bf284541ec INFO:SerialBattery:========== Settings ==========
@4000000064c7d7bf2845518c INFO:SerialBattery:> Connection voltage: 52.7V | Current: 0.0A | SoC: 42.8%
@4000000064c7d7bf28455d44 INFO:SerialBattery:> Cell count: 16 | Cells populated: 0
@4000000064c7d7bf28456514 INFO:SerialBattery:> LINEAR LIMITATION ENABLE: True
@4000000064c7d7bf284570cc INFO:SerialBattery:> MAX BATTERY CHARGE CURRENT: 120.0A | MAX BATTERY DISCHARGE CURRENT: 140.0A
@4000000064c7d7bf2847c674 INFO:SerialBattery:> CVCM:     True
@4000000064c7d7bf2847d22c INFO:SerialBattery:> MIN CELL VOLTAGE: 2.9V | MAX CELL VOLTAGE: 3.45V
@4000000064c7d7bf2847dde4 INFO:SerialBattery:> CCCM CV:  True  | DCCM CV:  True
@4000000064c7d7bf2847e99c INFO:SerialBattery:> CCCM T:   True  | DCCM T:   True
@4000000064c7d7bf2847f554 INFO:SerialBattery:> CCCM SOC: True  | DCCM SOC: True
@4000000064c7d7bf290cbc54 INFO:SerialBattery:Serial Number/Unique Identifier: 20221006
@4000000064c7d7c002543eac INFO:SerialBattery:DeviceInstance = 2
@4000000064c7d7c00265460c INFO:SerialBattery:com.victronenergy.battery.ttyUSB0
@4000000064c7d7c017151884 INFO:SerialBattery:publish config values = 1
@4000000064c7d80311b637c4 INFO:SerialBattery:refresh_data: result: False
@4000000064c7d838154e3364 INFO:SerialBattery:refresh_data: result: False
@4000000064c7d8b92202043c INFO:SerialBattery:refresh_data: result: False
@4000000064c7d8d1204e0ec4 INFO:SerialBattery:refresh_data: result: False
@4000000064c7d8e92c510a14 INFO:SerialBattery:refresh_data: result: False
@4000000064c7d8ee2789ae64 ERROR:SerialBattery:Exception occurred: TypeError("int() argument must be a string, a bytes-like object or a number, not 'NoneType'") of type <class 'TypeError'> in /opt/victronenergy/dbus-serialbattery/dbushelper.py line #643
@4000000064c7d92a2976306c ERROR:SerialBattery:Exception occurred: TypeError("int() argument must be a string, a bytes-like object or a number, not 'NoneType'") of type <class 'TypeError'> in /opt/victronenergy/dbus-serialbattery/dbushelper.py line #643
@4000000064c7d93026922f04 INFO:SerialBattery:refresh_data: result: False
@4000000064c7d93128ebbb1c INFO:SerialBattery:refresh_data: result: False
@4000000064c7d9cc30402a4c INFO:SerialBattery:refresh_data: result: False
@4000000064c7d9cd32f883ec INFO:SerialBattery:refresh_data: result: False
@4000000064c7da00349b6a34 INFO:SerialBattery:refresh_data: result: False
@4000000064c7da1b36368c34 INFO:SerialBattery:refresh_data: result: False
@4000000064c7db0e07cf3abc INFO:SerialBattery:refresh_data: result: False
@4000000064c7db8f17c814d4 INFO:SerialBattery:refresh_data: result: False
@4000000064c7dba713a6634c INFO:SerialBattery:refresh_data: result: False
@4000000064c7dbc012247e3c INFO:SerialBattery:refresh_data: result: False
@4000000064c7dc1021ecf1b4 INFO:SerialBattery:refresh_data: result: False
@4000000064c7dc8d1f60a954 INFO:SerialBattery:refresh_data: result: False
@4000000064c7dcdb24ebaedc INFO:SerialBattery:refresh_data: result: False
@4000000064c7dcdc277a50cc INFO:SerialBattery:refresh_data: result: False
@4000000064c7dcf725e410cc INFO:SerialBattery:refresh_data: result: False
@4000000064c7dcf827b127dc INFO:SerialBattery:refresh_data: result: False
@4000000064c7dd2d291b3374 INFO:SerialBattery:refresh_data: result: False
@4000000064c7dd2e2b7bd024 INFO:SerialBattery:refresh_data: result: False
@4000000064c7dd5f2c7464dc INFO:SerialBattery:refresh_data: result: False
@4000000064c7dd6331bdaa5c ERROR:SerialBattery:Exception occurred: TypeError("int() argument must be a string, a bytes-like object or a number, not 'NoneType'") of type <class 'TypeError'> in /opt/victronenergy/dbus-serialbattery/dbushelper.py line #643
@4000000064c7dd932faf38d4 INFO:SerialBattery:refresh_data: result: False
@4000000064c7dd9f35ef3a64 ERROR:SerialBattery:Exception occurred: TypeError("int() argument must be a string, a bytes-like object or a number, not 'NoneType'") of type <class 'TypeError'> in /opt/victronenergy/dbus-serialbattery/dbushelper.py line #643
@4000000064c7ddaf33beaa7c INFO:SerialBattery:refresh_data: result: False
@4000000064c7dddb37ef5fc4 ERROR:SerialBattery:Exception occurred: TypeError("int() argument must be a string, a bytes-like object or a number, not 'NoneType'") of type <class 'TypeError'> in /opt/victronenergy/dbus-serialbattery/dbushelper.py line #643
@4000000064c7de173ac858f4 ERROR:SerialBattery:Exception occurred: TypeError("int() argument must be a string, a bytes-like object or a number, not 'NoneType'") of type <class 'TypeError'> in /opt/victronenergy/dbus-serialbattery/dbushelper.py line #643
@4000000064c7df2c11944844 INFO:SerialBattery:refresh_data: result: False
@4000000064c7df75153f00c4 INFO:SerialBattery:refresh_data: result: False
@4000000064c7e0bb2b3d9e44 INFO:SerialBattery:refresh_data: result: False
@4000000064c7e0ee30503b94 INFO:SerialBattery:refresh_data: result: False
@4000000064c7e1072d016a6c INFO:SerialBattery:refresh_data: result: False
@4000000064c7e108315ff9fc INFO:SerialBattery:refresh_data: result: False

Any other information that may be helpful

Connection type Daly Serial USB UART adapter

USB Isolator between USB Hub and USB UART atapter Ocnvlia ADUM3160 USB Isolatormodul

USB Hub CSL - 7 Port USB 3.2 Hub Aktiv

mr-manuel commented 1 year ago

If the adapter is changing often from ttyUSB0 to ttyUSB1 then probably a connection is loose or your hub is not working properly. Check in the discussions for a good USB hub. The driver cannot change anything in this case.

Please post the logs again in the proper format. See Driver log files.

harald0815 commented 1 year ago

the error also occurs when I connect the USB-UART adapter directly to the cerbo

harald0815 commented 1 year ago

here is the current driver log after the error occurred

INFO: Start service dbus-cgwacs.ttyUSB0 once
INFO: Start service gps-dbus.ttyUSB0 once
INFO: Start service vedirect-interface.ttyUSB0 once
INFO: Start service dbus-serialbattery.ttyUSB0 once

root@einstein:~# tail -F -n 100 /data/log/dbus-serialbattery.ttyUSB1/current
INFO:SerialBattery:> Connection voltage: 52.7V | Current: 0.0A | SoC: 42.0%
INFO:SerialBattery:> Cell count: 16 | Cells populated: 0
INFO:SerialBattery:> LINEAR LIMITATION ENABLE: True
INFO:SerialBattery:> MAX BATTERY CHARGE CURRENT: 120.0A | MAX BATTERY DISCHARGE CURRENT: 140.0A
INFO:SerialBattery:> CVCM:     True
INFO:SerialBattery:> MIN CELL VOLTAGE: 2.9V | MAX CELL VOLTAGE: 3.45V
INFO:SerialBattery:> CCCM CV:  True  | DCCM CV:  True
INFO:SerialBattery:> CCCM T:   True  | DCCM T:   True
INFO:SerialBattery:> CCCM SOC: True  | DCCM SOC: True
INFO:SerialBattery:Serial Number/Unique Identifier: 20221006
INFO:SerialBattery:DeviceInstance = 1
INFO:SerialBattery:com.victronenergy.battery.ttyUSB1
INFO:SerialBattery:publish config values = 1
INFO:SerialBattery:refresh_data: result: False
INFO:SerialBattery:refresh_data: result: False
ERROR:SerialBattery:[Errno 2] could not open port /dev/ttyUSB1: [Errno 2] No such file or directory: '/dev/ttyUSB1'
ERROR:SerialBattery:[Errno 2] could not open port /dev/ttyUSB1: [Errno 2] No such file or directory: '/dev/ttyUSB1'
ERROR:SerialBattery:[Errno 2] could not open port /dev/ttyUSB1: [Errno 2] No such file or directory: '/dev/ttyUSB1'
Traceback (most recent call last):
File "/opt/victronenergy/dbus-serialbattery/dbushelper.py", line 351, in publish_battery
result = self.battery.refresh_data()
File "/opt/victronenergy/dbus-serialbattery/bms/daly.py", line 94, in refresh_data
with open_serial_port(self.port, self.baud_rate) as ser:
AttributeError: __enter__
/opt/victronenergy/serial-starter/run-service.sh: line 15: kill: (2201) - No such process
INFO:SerialBattery:
INFO:SerialBattery:Starting dbus-serialbattery
INFO:SerialBattery:dbus-serialbattery v1.0.20230724beta

INFO:SerialBattery:-- Testing BMS: 1 of 3 rounds
INFO:SerialBattery:Testing Daly at address "\x40"
ERROR:SerialBattery:>>> ERROR: No reply - returning
INFO:SerialBattery:Testing Daly at address "\x80"
ERROR:SerialBattery:>>> ERROR: No reply - returning
INFO:SerialBattery:Testing Ecs
ERROR:SerialBattery:>>> ERROR: No reply - returning
INFO:SerialBattery:Testing HeltecModbus
ERROR:SerialBattery:>>> ERROR: No reply - returning
INFO:SerialBattery:Testing HLPdataBMS4S
ERROR:SerialBattery:>>> ERROR: No reply - returning
INFO:SerialBattery:Testing Jkbms
ERROR:SerialBattery:>>> ERROR: No reply - returning
INFO:SerialBattery:Testing Lifepower
ERROR:SerialBattery:>>> ERROR: No reply - returning
INFO:SerialBattery:Testing LltJbd
ERROR:SerialBattery:>>> ERROR: No reply - returning
INFO:SerialBattery:Testing Renogy at address "\x30"
ERROR:SerialBattery:>>> ERROR: No reply - returning
INFO:SerialBattery:Testing Renogy at address "\xf7"
ERROR:SerialBattery:>>> ERROR: No reply - returning
INFO:SerialBattery:Testing Seplos
ERROR:SerialBattery:>>> ERROR: No reply - returning

INFO:SerialBattery:-- Testing BMS: 2 of 3 rounds
INFO:SerialBattery:Testing Daly at address "\x40"
ERROR:SerialBattery:>>> ERROR: No reply - returning
INFO:SerialBattery:Testing Daly at address "\x80"
ERROR:SerialBattery:>>> ERROR: No reply - returning
INFO:SerialBattery:Testing Ecs
ERROR:SerialBattery:>>> ERROR: No reply - returning
INFO:SerialBattery:Testing HeltecModbus
ERROR:SerialBattery:>>> ERROR: No reply - returning
INFO:SerialBattery:Testing HLPdataBMS4S
ERROR:SerialBattery:>>> ERROR: No reply - returning
INFO:SerialBattery:Testing Jkbms
ERROR:SerialBattery:>>> ERROR: No reply - returning
INFO:SerialBattery:Testing Lifepower
ERROR:SerialBattery:>>> ERROR: No reply - returning
INFO:SerialBattery:Testing LltJbd
ERROR:SerialBattery:>>> ERROR: No reply - returning
INFO:SerialBattery:Testing Renogy at address "\x30"
ERROR:SerialBattery:>>> ERROR: No reply - returning
INFO:SerialBattery:Testing Renogy at address "\xf7"
ERROR:SerialBattery:>>> ERROR: No reply - returning
INFO:SerialBattery:Testing Seplos
ERROR:SerialBattery:>>> ERROR: No reply - returning

INFO:SerialBattery:-- Testing BMS: 3 of 3 rounds
INFO:SerialBattery:Testing Daly at address "\x40"
ERROR:SerialBattery:>>> ERROR: No reply - returning
INFO:SerialBattery:Testing Daly at address "\x80"
ERROR:SerialBattery:>>> ERROR: No reply - returning
INFO:SerialBattery:Testing Ecs
ERROR:SerialBattery:>>> ERROR: No reply - returning
INFO:SerialBattery:Testing HeltecModbus
ERROR:SerialBattery:>>> ERROR: No reply - returning
INFO:SerialBattery:Testing HLPdataBMS4S
ERROR:SerialBattery:>>> ERROR: No reply - returning
INFO:SerialBattery:Testing Jkbms
ERROR:SerialBattery:>>> ERROR: No reply - returning
INFO:SerialBattery:Testing Lifepower
ERROR:SerialBattery:>>> ERROR: No reply - returning
INFO:SerialBattery:Testing LltJbd
ERROR:SerialBattery:>>> ERROR: No reply - returning
Renogy at address "\x30"
ERROR:SerialBattery:>>> ERROR: No reply - returning
INFO:SerialBattery:Testing Renogy at address "\xf7"
ERROR:SerialBattery:>>> ERROR: No reply - returning
INFO:SerialBattery:Testing Seplos
ERROR:SerialBattery:>>> ERROR: No reply - returning
ERROR:SerialBattery:ERROR >>> No battery connection at /dev/ttyUSB1
*** CCGX booted (0) ***
*** CCGX booted (0) ***
mr-manuel commented 1 year ago
ERROR:SerialBattery:[Errno 2] could not open port /dev/ttyUSB1: [Errno 2] No such file or directory: '/dev/ttyUSB1'
ERROR:SerialBattery:[Errno 2] could not open port /dev/ttyUSB1: [Errno 2] No such file or directory: '/dev/ttyUSB1'
ERROR:SerialBattery:[Errno 2] could not open port /dev/ttyUSB1: [Errno 2] No such file or directory: '/dev/ttyUSB1'

This indicates that there is an issue between the Venus OS and the serial adapter. In this case the driver has no issue.

Have you tried another adapter?

Please post the logs again in the proper format. See Driver log files.

We always need the logs with the timestamps to see the timings, else it's difficult to help you.

pos-ei-don commented 1 year ago

I belive that some adapters need a massive amount of power from usb. I had several, which did not work with bad USB-Hubs (and I had a lot of bad hubs!!) or when several adapters got connected! So be careful!

towatai commented 1 year ago

Does your BMS offer the possibility to use an RS485 adapter instead of the UART adapter? I had similar problems, sometimes it ran for days, then suddenly several times a day the errors, really completely sporadic.

i completely disassembled and reassembled my entire system several times, tried different active USB hubs, nothing to do.

Then rather out of perplexity I just reconnected my two dalys for a long time via RS485->USB adapter, since then it's been running. I noticed that the system takes some time longer to connect to the BMS when the whole thing is connected via UART->USB adapter (some seconds). With the RS485 adapter the BMS is recognized almost instantaneously.

By the way, I use two Daly Smart BMS, 150A, 8S with a UART as well as CAN/RS485 interface.

bstrdb commented 1 year ago

@harald0815 did you already solved this issue? i guess i have a similar problem... it my setup it worked serveral weeks with the old driver 0.4. after updating to 1.0 the connection got lost about every second day. @towatai not all daly bms provide a RS485-port :(

harald0815 commented 1 year ago

Hello, unfortunately I could not solve the problem yet. I've already tried an older version of Venus OS and the driver with an earlier version, unfortunately without success. Also a complete reset, other USB to UART adapters, direct USB connection to the Cerbo and various USB isolators, also without getting any closer to the goal. I am currently using my Smart Shunt as a battery monitor again. and the Daly BMS just hangs on for fun. But I've noticed in the meantime that the connection is made again and again after it's broken off. (without restart)

Oh, and unfortunately I don't have an RS485 interface either.

mr-manuel commented 1 year ago

Please post the logs again in the proper format. See Driver log files.

Post the requested logs with the correct timestamp else we cannot help you.

rustyfreeman commented 10 months ago

I have the same issue. Roll back to 0.14.3 fixed it for me.

bstrdb commented 10 months ago

@rustyfreeman interesting... how did you do the rollback?

sinho10 commented 2 months ago

I have the same issue. Roll back to 0.14.3 fixed it for me.

How have you done the downgrade.? In my case my old Hub crashed and nothing worked so I Updated the serial driver and the Venus OS and since then, with the same (new) Hub, i have this issue... A downgrade would be nice to isolate the problem AND i would not cost any money ;)

mr-manuel commented 2 months ago

Please open a new issue with fresh logs, so we can fix the issue rather then do a downgrade.

You would find everything in the docs: Downgrade from >= v1.0.0 to <= v0.14.3

sinho10 commented 2 months ago

Okay i will update everything back to latest gratest and post the Logs in a new Issue.