fl4p / batmon-ha

Add-on for Home Assistant to connect JK, JBD, Daly, ANT, SOK and Supervolt BMS via Bluetooth
MIT License
246 stars 53 forks source link

DALY BMS problem - TimeoutError: timeout awaiting result 93, got 0/1 responses #205

Open WolwX opened 4 months ago

WolwX commented 4 months ago

Hello,

Impossible to get my DalyBMS working. I followed the troubleshoot steps without success.

I use Batmon with another BMS, a JBD one, and that's ok since last update, but with the DALY one, impossible to get any information since long ago.

My DALY BMS is ok in the Android App, data are ok, so I unlink it to be able to appair with Batmon, it appear on the bluetooth scan, but for some reason, impossible to work.

Daly BMS 4S 12v Serial SH39F003 Software version 210629

BEGIN 
16:36:14 INFO [sampling] batterie163ah bms debug data: {'r': None, 'buf': {}, 'rx': 17, 'tx': 15}
16:36:14 INFO [sampling] Bleak version 0.20.2
16:36:14 WARNING [sampling] disconnecting DalyBt(96:69:08:05:29:C3,batterie163ah) due to too many errors 21
16:36:16 WARNING [bt] BMS DalyBt(96:69:08:05:29:C3,batterie163ah) disconnected after 14.1s!
16:36:16 ERROR [main] 1 exceptions occurred fetching BMSs
16:36:16 ERROR [main] Error (num 146, max 200) reading BMS: timeout awaiting result 93, got 0/1 responses
16:36:17 ERROR [main] Stack: Traceback (most recent call last):
  File "/usr/lib/python3.11/asyncio/tasks.py", line 500, in wait_for
    return fut.result()
           ^^^^^^^^^^^^
asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/app/bmslib/__init__.py", line 81, in wait_for
    return await asyncio.wait_for(self._futures.get(name), timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/tasks.py", line 502, in wait_for
    raise exceptions.TimeoutError() from exc
TimeoutError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/bmslib/models/daly.py", line 166, in _q
    sample = await self._fetch_futures.wait_for(command, self.TIMEOUT)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/bmslib/__init__.py", line 84, in wait_for
    raise asyncio.TimeoutError("timeout waiting for %s" % name)
TimeoutError: timeout waiting for 147

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/main.py", line 36, in fetch_loop
    if await fn():
       ^^^^^^^^^^
  File "/app/main.py", line 319, in fn
    raise exceptions[0]
  File "/app/main.py", line 314, in fn
    await t()
  File "/app/bmslib/sampling.py", line 155, in __call__
    s = await self._sample_inner()
        ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/bmslib/sampling.py", line 237, in _sample_inner
    sample = await bms.fetch()
             ^^^^^^^^^^^^^^^^^
  File "/app/bmslib/models/daly.py", line 187, in fetch
    status = await self._fetch_status()
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/bmslib/cache/mem.py", line 160, in _mem_cache_wrapper_async
    return await _inner_wrapper_async(cache_key_obj, args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/bmslib/cache/mem.py", line 131, in _inner_wrapper_async
    ret = await target(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/bmslib/models/daly.py", line 224, in _fetch_status
    response_data = await self._q(0x93)
                    ^^^^^^^^^^^^^^^^^^^
  File "/app/bmslib/models/daly.py", line 169, in _q
    raise TimeoutError(
TimeoutError: timeout awaiting result 93, got 0/1 responses

16:44:50 INFO [sampling] batterie304ah: BmsSampl(99.1%,U=13.5V,I=5.11A,P=69W,Q=301/304Ah,mos=nan°C)
16:44:50 INFO [sampling] batterie304ah volt=[3370,3368,3371,3365] temp=[13.3, 12.2, 12.2]
END

Anyway thanks again for your work :)