fl4p / batmon-ha

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

DALY BMS checksum errors #206

Open danbi opened 9 months ago

danbi commented 9 months ago

Since few weeks I observe frequent checksum errors when querying my DALY BMSs. Here is one example. What confuses me is that the expected checksum is always the same, but it always gets a different one. It is the same for all BMSes, not just this one.

The Bluetooth connection is far from ideal, but when it works it works stable... until it doesn't.

Paste log output between BEGIN and END:
BEGIN 
18:57:36 INFO [sampling] connecting bms DalyBt(40:16:06:01:20:12,battery3)
18:57:36 INFO [main] mqtt watchdog loop started with timeout 300.0s
18:57:40 WARNING [daly] tried rx/tx/sx uuids 17/15/48: Characteristic with UUID 17 could not be found!
18:57:40 INFO [sampling] connected bms DalyBt(40:16:06:01:20:12,battery3)!
18:57:40 INFO [sampling] battery3 subscribing for {'charge': True, 'discharge': True} switch change
18:57:40 INFO [sampling] battery3: BmsSampl(89.7%,U=53.0V,I=-7.70A,P=-408W,Q=287/320Ah,mos=nan°C)
18:57:41 WARNING [daly] checksum fail, expected 149, got 241. bytearray(b'\x08\x00\x00\x00\x00\x00\xa5\x01')
18:57:41 WARNING [daly] checksum fail, expected 149, got 121. bytearray(b'\x00\x00\x00\x00;\x87\xa5\x01')
18:57:41 WARNING [daly] checksum fail, expected 149, got 123. bytearray(b'\x00\x00\x00\x00;\x88\xa5\x01')
18:57:41 WARNING [daly] checksum fail, expected 149, got 125. bytearray(b'\x00\x00\x00\x00;\x89\xa5\x01')
18:57:41 WARNING [daly] checksum fail, expected 149, got 127. bytearray(b'\x00\x00\x00\x00;\x8a\xa5\x01')
18:57:41 WARNING [daly] checksum fail, expected 149, got 129. bytearray(b'\x00\x00\x00\x00;\x8b\xa5\x01')
18:57:41 WARNING [daly] checksum fail, expected 149, got 131. bytearray(b'\x00\x00\x00\x00;\x8c\xa5\x01')
18:57:41 WARNING [daly] checksum fail, expected 149, got 133. bytearray(b'\x00\x00\x00\x00;\x8d\xa5\x01')
18:57:41 WARNING [daly] msg too short: bytearray(b'\x08\x10\x00\x00\x00\x00\x00\x00;\x8e')
18:57:41 INFO [sampling] battery3 volt=[3315,3315,3315,3316,3319,3318,3317,3319,3318,3319,3317,3318,3317,3319,3316,3318] temp=[nan]
18:57:41 INFO [sampling] Sending HA discovery for battery3 (num_samples=0)
1
END
grostim commented 4 months ago

Hi !

I have the same errors:

13:13:46 INFO [main] Fetching 1 BMS + 0 virtual + 0 others serially, period=1.00s, keep_alive=True
13:13:46 INFO [sampling] connecting bms DalyBt(40:18:05:01:04:B5,VeloTim)
13:13:46 INFO [main] mqtt watchdog loop started with timeout 300.0s
13:13:54 WARNING [daly] tried rx/tx/sx uuids 17/15/48: Characteristic with UUID 17 could not be found!
13:13:54 INFO [sampling] connected bms DalyBt(40:18:05:01:04:B5,VeloTim)!
13:13:54 INFO [sampling] VeloTim subscribing for {'charge': False, 'discharge': True} switch change
13:13:54 INFO [sampling] VeloTim: BmsSampl(100.0%,U=53.7V,I=0.00A,P=0W,Q=13/13Ah,mos=nan°C)
13:13:55 INFO [sampling] VeloTim volt=[4117,4103,4096,4113,4104,4102,4102,4109,4102,4200,4199,4199,4198] temp=[nan]
13:13:55 INFO [sampling] Sending HA discovery for VeloTim (num_samples=0)
13:13:58 WARNING [daly] checksum fail, expected 8, got 207. bytearray(b'\x15\x10\x08\x10\x00\x10\x11\x10')
13:13:58 WARNING [daly] checksum fail, expected 16, got 78. bytearray(b'\x10\r\x10\x06\x10g\x10g')
13:13:58 WARNING [daly] checksum fail, expected 0, got 221. bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00')
13:13:58 WARNING [daly] checksum fail, expected 0, got 59. bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00')
13:13:58 WARNING [daly] checksum fail, expected 104, got 12. bytearray(b'&\x02\x19u0\x03\xe8\x10')
13:13:58 WARNING [daly] checksum fail, expected 0, got 25. bytearray(b'\x00;\x00\x00\x00\x86\x00\r')
13:13:58 WARNING [daly] checksum fail, expected 104, got 57. bytearray(b'\x01\x00\x00\x00\x01\x10&\x00')
13:13:58 WARNING [daly] msg too short: bytearray(b'\x00\x00\x00\x12\x00\x00\x00\x00\x00\x00\xf1\xf5')
13:13:58 WARNING [daly] checksum fail, expected 8, got 207. bytearray(b'\x15\x10\x08\x10\x00\x10\x11\x10')
13:13:58 WARNING [daly] checksum fail, expected 16, got 78. bytearray(b'\x10\r\x10\x06\x10g\x10g')
13:13:58 WARNING [daly] checksum fail, expected 0, got 221. bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00')
13:13:58 WARNING [daly] checksum fail, expected 0, got 59. bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00')
13:13:58 WARNING [daly] checksum fail, expected 104, got 12. bytearray(b'&\x02\x19u0\x03\xe8\x10')
13:13:58 WARNING [daly] checksum fail, expected 0, got 25. bytearray(b'\x00;\x00\x00\x00\x86\x00\r')
13:13:58 WARNING [daly] checksum fail, expected 104, got 57. bytearray(b'\x01\x00\x00\x00\x01\x10&\x00')
13:13:58 WARNING [daly] msg too short: bytearray(b'\x00\x00\x00\x12\x00\x00\x00\x00\x00\x00\xf1\xf5')
13:14:28 WARNING [daly] checksum fail, expected 8, got 207. bytearray(b'\x15\x10\x08\x10\x00\x10\x11\x10')
13:14:28 WARNING [daly] checksum fail, expected 16, got 79. bytearray(b'\x10\r\x10\x06\x10h\x10g')
13:14:28 WARNING [daly] checksum fail, expected 0, got 220. bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00')
13:14:28 WARNING [daly] checksum fail, expected 0, got 59. bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00')
13:14:28 WARNING [daly] checksum fail, expected 103, got 12. bytearray(b'&\x02\x19u0\x03\xe8\x10')
13:14:28 WARNING [daly] checksum fail, expected 0, got 25. bytearray(b'\x00;\x00\x00\x00\x86\x00\r')
13:14:28 WARNING [daly] checksum fail, expected 103, got 57. bytearray(b'\x01\x00\x00\x00\x01\x10&\x00')
13:14:28 WARNING [daly] msg too short: bytearray(b'\x00\x00\x00\x12\x00\x00\x00\x00\x00\x00:!')
13:14:28 WARNING [daly] checksum fail, expected 8, got 207. bytearray(b'\x15\x10\x08\x10\x00\x10\x11\x10')
13:14:28 WARNING [daly] checksum fail, expected 16, got 79. bytearray(b'\x10\r\x10\x06\x10h\x10g')
13:14:28 WARNING [daly] checksum fail, expected 0, got 220. bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00')
13:14:28 WARNING [daly] checksum fail, expected 0, got 59. bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00')
13:14:28 WARNING [daly] checksum fail, expected 103, got 12. bytearray(b'&\x02\x19u0\x03\xe8\x10')
13:14:28 WARNING [daly] checksum fail, expected 0, got 25. bytearray(b'\x00;\x00\x00\x00\x86\x00\r')
13:14:28 WARNING [daly] checksum fail, expected 103, got 57. bytearray(b'\x01\x00\x00\x00\x01\x10&\x00')
13:14:28 WARNING [daly] msg too short: bytearray(b'\x00\x00\x00\x12\x00\x00\x00\x00\x00\x00:!')
13:14:30 WARNING [daly] checksum fail, expected 149, got 173. bytearray(b'\x04\x10h\x10g\x10f\x01')
13:14:30 WARNING [daly] msg too short: bytearray(b'\x08\x05\x10f\x10g\x10f\xe8\x93')
13:14:30 WARNING [daly] checksum fail, expected 149, got 173. bytearray(b'\x04\x10h\x10g\x10f\x01')
13:14:30 WARNING [daly] msg too short: bytearray(b'\x08\x05\x10f\x10g\x10f\xe8\x93')
13:14:30 ERROR [sampling] VeloTim error fetching voltage
Traceback (most recent call last):
  File "/app/bmslib/sampling.py", line 323, in cached_fetch_voltages
    voltages = await bms.fetch_voltages()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/bmslib/models/daly.py", line 302, in fetch_voltages
    assert v[0] == i + 1, "out-of-order frame %s != #%s" % (v, i + 1)
           ^^^^^^^^^^^^^
AssertionError: out-of-order frame (1, 4117, 4104, 4096) != #4

Have you found a solution ?

jcottis commented 4 months ago

Getting these timeouts also, Batmon working intermittently, works for a while and then stops i.e. no readings, any clues?

07:49:49 INFO [sampling] connecting bms DalyBt(40:16:09:01:4F:05,House Bank) 07:49:51 WARNING [daly] tried rx/tx/sx uuids 17/15/48: Characteristic with UUID 17 could not be found! 07:49:51 INFO [sampling] connected bms DalyBt(40:16:09:01:4F:05,House Bank)! 07:49:51 INFO [sampling] House Bank: BmsSampl(99.6%,U=27.3V,I=0.00A,P=0W,Q=199/200Ah,mos=nan°C) 07:49:51 INFO [sampling] House Bank volt=[3421,3421,3421,3421,3421,3421,3407,3421] temp=None 07:50:54 INFO [sampling] House Bank: BmsSampl(99.6%,U=27.4V,I=-2.60A,P=-71W,Q=199/200Ah,mos=nan°C) 07:50:55 INFO [sampling] House Bank volt=[3431,3431,3431,3431,3431,3431,3415,3429] temp=None 07:51:16 WARNING [daly] checksum fail, expected 149, got 78. bytearray(b'\n\x00\x00\x00\x00\x00\x00\x01') 07:51:16 WARNING [daly] msg too short: bytearray(b'\x08\x0b\x00\x00\x00\x00\x00\x00\xe42') 07:51:37 WARNING [daly] checksum fail, expected 149, got 78. bytearray(b'\n\x00\x00\x00\x00\x00\x00\x01') 07:51:37 WARNING [daly] msg too short: bytearray(b'\x08\x0b\x00\x00\x00\x00\x00\x00\xe42') 07:51:58 INFO [sampling] House Bank: BmsSampl(99.6%,U=27.4V,I=-2.90A,P=-79W,Q=199/200Ah,mos=nan°C) 07:51:58 INFO [sampling] House Bank volt=[3439,3439,3439,3439,3439,3439,3421,3439] temp=None 07:52:09 WARNING [daly] checksum fail, expected 149, got 73. bytearray(b'\x05\x00\x00\x00\x00\x00\x00\x01') 07:52:09 WARNING [daly] checksum fail, expected 149, got 197. bytearray(b'\x00\x00\x00\x00\xe4-\xa5\x01') 07:52:09 WARNING [daly] checksum fail, expected 149, got 199. bytearray(b'\x00\x00\x00\x00\xe4.\xa5\x01') 07:52:09 WARNING [daly] checksum fail, expected 149, got 201. bytearray(b'\x00\x00\x00\x00\xe4/\xa5\x01') 07:52:09 WARNING [daly] checksum fail, expected 149, got 203. bytearray(b'\x00\x00\x00\x00\xe40\xa5\x01') 07:52:09 WARNING [daly] checksum fail, expected 149, got 205. bytearray(b'\x00\x00\x00\x00\xe41\xa5\x01') 07:52:09 WARNING [daly] msg too short: bytearray(b'\x08\x0b\x00\x00\x00\x00\x00\x00\xe42')

fl4p commented 4 months ago

This looks like data getting scrambled during BLE transmission. Try to put the devices as close as possible to see if it improves. And turn of any inverters.

jcottis commented 4 months ago

Thanks Fabian, I will give these suggestions a try.

Appreciate your assistance, thanks again.

Kind Regards

John Cottis

0418 471 360

From: Fabian @.> Sent: Sunday, July 14, 2024 6:41 PM To: fl4p/batmon-ha @.> Cc: jcottis @.>; Comment @.> Subject: Re: [fl4p/batmon-ha] DALY BMS checksum errors (Issue #206)

This looks like data getting scrambled during BLE transmission. Try to put the devices as close as possible to see if it improves. And turn of any inverters.

— Reply to this email directly, view it on GitHub https://github.com/fl4p/batmon-ha/issues/206#issuecomment-2227267254 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ALTC4XQLNYRWF5V6LB4RH7LZMI2QNAVCNFSM6AAAAABKHKRIIWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRXGI3DOMRVGQ . You are receiving this because you commented. https://github.com/notifications/beacon/ALTC4XXDIBIZEBABK66JK7TZMI2QNA5CNFSM6AAAAABKHKRIIWWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTUEYFTLM.gif Message ID: @. @.> >