dreadnought / python-daly-bms

Python module for Daly BMS devices
MIT License
82 stars 37 forks source link

Missing data/connection for a few hours #33

Closed hermann4 closed 7 months ago

hermann4 commented 1 year ago

Hello! First of all thanks for your awesome peace of software! I am currently requesting the data of a daly-bms 8s via UART to USB onto a raspberry pi every 30 seconds. This works most of the time but I encounter connection issues around once every 24hrs. They can last from 1h up to 8hrs. Restarting the raspberry won't help, so I don't think this is the problem. Also the problem will be gone by itself without me needing to help.

Output I am getting is: DEBUG [daly_bms.py:112] 0 empty response for command 94 DEBUG [daly_bms.py:85] 1. try failed, retrying... DEBUG [daly_bms.py:95] -- 94 ------------------------ DEBUG [daly_bms.py:65] w a5409408000000000000000081 DEBUG [daly_bms.py:112] 0 empty response for command 94 DEBUG [daly_bms.py:85] 2. try failed, retrying... DEBUG [daly_bms.py:95] -- 94 ------------------------ DEBUG [daly_bms.py:65] w a5409408000000000000000081 DEBUG [daly_bms.py:112] 0 empty response for command 94 DEBUG [daly_bms.py:85] 3. try failed, retrying... DEBUG [daly_bms.py:95] -- 94 ------------------------ DEBUG [daly_bms.py:65] w a5409408000000000000000081 DEBUG [daly_bms.py:112] 0 empty response for command 94 DEBUG [daly_bms.py:85] 4. try failed, retrying... DEBUG [daly_bms.py:95] -- 94 ------------------------ DEBUG [daly_bms.py:65] w a5409408000000000000000081 DEBUG [daly_bms.py:112] 0 empty response for command 94 DEBUG [daly_bms.py:85] 5. try failed, retrying... ERROR [daly_bms.py:90] 94 failed after 5 tries ERROR [daly_bms.py:242] get_status has to be called at least once before calling get_cell_voltages ERROR [daly_bms.py:242] get_status has to be called at least once before calling get_cell_voltages DEBUG [daly_bms.py:95] -- 97 ------------------------ DEBUG [daly_bms.py:65] w a5409708000000000000000084 DEBUG [daly_bms.py:112] 0 empty response for command 97 DEBUG [daly_bms.py:85] 1. try failed, retrying... DEBUG [daly_bms.py:95] -- 97 ------------------------ DEBUG [daly_bms.py:65] w a5409708000000000000000084 DEBUG [daly_bms.py:112] 0 empty response for command 97 DEBUG [daly_bms.py:85] 2. try failed, retrying... DEBUG [daly_bms.py:95] -- 97 ------------------------ DEBUG [daly_bms.py:65] w a5409708000000000000000084 DEBUG [daly_bms.py:112] 0 empty response for command 97 DEBUG [daly_bms.py:85] 3. try failed, retrying... DEBUG [daly_bms.py:95] -- 97 ------------------------ DEBUG [daly_bms.py:65] w a5409708000000000000000084 DEBUG [daly_bms.py:112] 0 empty response for command 97 DEBUG [daly_bms.py:85] 4. try failed, retrying... DEBUG [daly_bms.py:95] -- 97 ------------------------ DEBUG [daly_bms.py:65] w a5409708000000000000000084 DEBUG [daly_bms.py:112] 0 empty response for command 97 DEBUG [daly_bms.py:85] 5. try failed, retrying... ERROR [daly_bms.py:90] 97 failed after 5 tries DEBUG [daly_bms.py:95] -- 98 ------------------------ DEBUG [daly_bms.py:65] w a5409808000000000000000085 DEBUG [daly_bms.py:112] 0 empty response for command 98 DEBUG [daly_bms.py:85] 1. try failed, retrying... DEBUG [daly_bms.py:95] -- 98 ------------------------ DEBUG [daly_bms.py:65] w a5409808000000000000000085 DEBUG [daly_bms.py:112] 0 empty response for command 98 DEBUG [daly_bms.py:85] 2. try failed, retrying... DEBUG [daly_bms.py:95] -- 98 ------------------------ DEBUG [daly_bms.py:65] w a5409808000000000000000085 DEBUG [daly_bms.py:112] 0 empty response for command 98 DEBUG [daly_bms.py:85] 3. try failed, retrying... DEBUG [daly_bms.py:95] -- 98 ------------------------ DEBUG [daly_bms.py:65] w a5409808000000000000000085 DEBUG [daly_bms.py:112] 0 empty response for command 98 DEBUG [daly_bms.py:85] 4. try failed, retrying... DEBUG [daly_bms.py:95] -- 98 ------------------------ DEBUG [daly_bms.py:65] w a5409808000000000000000085 DEBUG [daly_bms.py:112] 0 empty response for command 98 DEBUG [daly_bms.py:85] 5. try failed, retrying... ERROR [daly_bms.py:90] 98 failed after 5 tries Traceback (most recent call last): File "/home/lfnidt/.local/bin/daly-bms-cli", line 183, in <module> result = bms.get_all() File "/home/lfnidt/.local/lib/python3.9/site-packages/dalybms/daly_bms.py", line 355, in get_all "errors": self.get_errors() File "/home/lfnidt/.local/lib/python3.9/site-packages/dalybms/daly_bms.py", line 324, in get_errors if int.from_bytes(response_data, byteorder='big') == 0: TypeError: cannot convert 'bool' object to bytes

(Excerpt). Do you have any hints what the problem could be? It'd probably help to restart the BMS but there's no way to to this without being on site right? Or should I try longer intervals to request?

dreadnought commented 1 year ago

Hi, is the BMS idle while it's not responding? For me it happens that the BMS stops responding after some time when no load is charging/discharging the battery. It automatically wakes up if the battery gets utilized. But I see this behaviour only on the Bluetooth connection, sending any command via USB makes Bluetooth work again.

hermann4 commented 1 year ago

Hi, yes this happens when there is no load, that's right. But I am not using bluetooth, instead I am using UART to USB. Maybe I should adjust the bluetooth timeout even though I am not using it? Either way, it seems to be a BMS-related issue and nothing softwarewise...

dreadnought commented 1 year ago

I don't know if it's possible to increase the timeout. My mini computer is connected to the RS485 port via USB, while the BT module is connected to the UART485 port in parallel. That works for me, but might not be possible with all BMS models.