gmanic / daly_bms_bt

BT data retrieval utility for Daly Smart BMS
MIT License
6 stars 2 forks source link

timeout waiting for 94 #3

Closed wowawabba closed 1 year ago

wowawabba commented 1 year ago

➜ daly_bms_bt git:(main) ✗ ./daly_bms_bt.py --bt 46:64:01:XX:XX:XX --hci hci1 --mqtt-user tempuser123--mqtt-password tempuser123 --mqtt-broker 192.168.1.100 INFO [daly_bms_bluetooth.py:24] Set up Bleak client, adapter hci1 INFO [daly_bms_bluetooth.py:46] Bluetooth connecting... INFO [daly_bms_bluetooth.py:52] Bluetooth connected WARNING [daly_bms_bluetooth.py:134] Timeout while waiting for 94 response WARNING [daly_bms_bluetooth.py:134] Timeout while waiting for 94 response WARNING [daly_bms_bluetooth.py:134] Timeout while waiting for 94 response ERROR [daly_bms_bluetooth.py:77] 94 failed after 3 tries ERROR [base_events.py:1758] Task exception was never retrieved future: <Task finished name='Task-1' coro=<main() done, defined at /home/adminsshuser/daly_bms_bt/./daly_bms_bt.py:123> exception=TypeError("a bytes-like object is required, not 'coroutine'")> Traceback (most recent call last): File "/home/adminsshuser/daly_bms_bt/./daly_bms_bt.py", line 132, in main await con._data_point("Status", await con.bt_bms.get_status()) File "/home/adminsshuser/daly_bms_bt/modules/daly_bms_bluetooth.py", line 179, in get_status return super().get_status(response_data=response_data) File "/home/adminsshuser/daly_bms_bt/modules/daly_bms.py", line 252, in get_status parts = struct.unpack('>b b ? ? b h x', response_data) TypeError: a bytes-like object is required, not 'coroutine' /usr/lib/python3.10/asyncio/base_events.py:1910: RuntimeWarning: coroutine 'DalyBMSBluetooth._read_request' was never awaited handle = None # Needed to break cycles when an exception occurs. RuntimeWarning: Enable tracemalloc to get the object allocation traceback ^CINFO [daly_bms_bt.py:188] Keyboard break

wowawabba commented 1 year ago

➜ daly_bms_bt git:(main) ✗ ./daly_bms_bt.py --bt 46:64:01:XX:XX:XX --hci hci1 --mqtt --mqtt-user testuser123--mqtt-password testuser123--mqtt-broker 192.168.1.100 --log-level debug --keep DEBUG [daly_bms_bt.py:180] MQTT connecting DEBUG [client.py:2529] Sending CONNECT (u1, p1, wr0, wq0, wf0, c1, k60) client_id=b'' INFO [daly_bms_bluetooth.py:24] Set up Bleak client, adapter hci1 DEBUG [daly_bms_bt.py:128] Starting oneshot INFO [daly_bms_bluetooth.py:46] Bluetooth connecting... INFO [daly_bms_bluetooth.py:52] Bluetooth connected DEBUG [daly_bms_bluetooth.py:82] -- 94 ------------------------ DEBUG [daly_bms.py:67] w a58094080000000000000000c1 DEBUG [daly_bms_bluetooth.py:130] Waiting... WARNING [daly_bms_bluetooth.py:134] Timeout while waiting for 94 response DEBUG [daly_bms_bluetooth.py:90] got False DEBUG [daly_bms_bluetooth.py:72] 1. try failed, retrying... DEBUG [daly_bms_bluetooth.py:82] -- 94 ------------------------ DEBUG [daly_bms.py:67] w a58094080000000000000000c1 DEBUG [daly_bms_bluetooth.py:130] Waiting... WARNING [daly_bms_bluetooth.py:134] Timeout while waiting for 94 response DEBUG [daly_bms_bluetooth.py:90] got False DEBUG [daly_bms_bluetooth.py:72] 2. try failed, retrying... DEBUG [daly_bms_bluetooth.py:82] -- 94 ------------------------ DEBUG [daly_bms.py:67] w a58094080000000000000000c1 DEBUG [daly_bms_bluetooth.py:130] Waiting... WARNING [daly_bms_bluetooth.py:134] Timeout while waiting for 94 response DEBUG [daly_bms_bluetooth.py:90] got False DEBUG [daly_bms_bluetooth.py:72] 3. try failed, retrying... ERROR [daly_bms_bluetooth.py:77] 94 failed after 3 tries ERROR [base_events.py:1758] Task exception was never retrieved future: <Task finished name='Task-1' coro=<main() done, defined at /home/adminsshuser/daly_bms_bt/./daly_bms_bt.py:123> exception=TypeError("a bytes-like object is required, not 'coroutine'")> Traceback (most recent call last): File "/home/adminsshuser/daly_bms_bt/./daly_bms_bt.py", line 132, in main await con._data_point("Status", await con.bt_bms.get_status()) File "/home/adminsshuser/daly_bms_bt/modules/daly_bms_bluetooth.py", line 179, in get_status return super().get_status(response_data=response_data) File "/home/adminsshuser/daly_bms_bt/modules/daly_bms.py", line 252, in get_status parts = struct.unpack('>b b ? ? b h x', response_data) TypeError: a bytes-like object is required, not 'coroutine' /usr/lib/python3.10/asyncio/base_events.py:1910: RuntimeWarning: coroutine 'DalyBMSBluetooth._read_request' was never awaited handle = None # Needed to break cycles when an exception occurs. RuntimeWarning: Enable tracemalloc to get the object allocation traceback ^CINFO [daly_bms_bt.py:188] Keyboard break

gmanic commented 1 year ago

Error handling is kind of rough in that script, agreed, but won't fix (error handling) as I switched to cable-serial-USB connection in my setup.

For this specific issue - there seems to be a communication issue between py-script (it doesn't get any response -> timeout), bluetooth (somewhere, I'm no expert here) and/or daly bms-system.

I have no daly bms in use anymore and did not follow their firmware updates (if any, which might trigger the need for changes here).

So, sorry, won't fix, as this is more a "proof of concept" for my personal setup. Feel free to fork and continue to develop.