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

Unable to read from JK_B2A24S20P #111

Closed RoySalisbury closed 8 months ago

RoySalisbury commented 1 year ago

Newer JK BMS will not connect. Using an older JK-B2A24S15P works but no the newer JK_B2A24S20P. I believe the packet size has changed and requires an update.


BEGIN 
18:50:59 INFO [main] mqtt watchdog loop started with timeout 900.0s
18:51:03 INFO [sampling] connected bms SmartShuntBt(E2:21:F0:89:A7:C0)!
18:51:03 INFO [sampling] smartshunt-01: BmsSampl(99.7%,U=54.2V,I=-15.16A,P=-822W,q=-5.8Ah/-6,mos=nan°C)
18:51:03 INFO [sampling] SmartShuntBt(E2:21:F0:89:A7:C0) times: connect=4.17s fetch=0.01s
18:51:03 INFO [sampling] connecting bms JKBt(C8:47:8C:EC:1E:B5)
18:51:05 INFO [jikong] normal connect failed ([org.bluez.Error.Failed] le-connection-abort-by-local), connecting with scanner
18:51:30 ERROR [sampling] bms-280-05 error: <class 'TimeoutError'>
18:51:30 INFO [sampling] bms-280-05 bms debug data: {3: bytearray(b'U\xaa\xeb\x90\x03sJK_B2A24S20P\x00\x00\x00\x0011.XW\x00\x00\x0011.26\x00\x00\x00\xdc;\x8d\x00\x03\x00\x00\x00JK_B2A24S20P\x00\x00\x00\x001234\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00230219\x00\x002120147127\x000000\x00Input Userdata\x00\x00123456\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00Input Userdata\x00\x00|\xf8\xff\xff\x1f\r\x00\x00\x00\x00\x00\x00\x90\x0f\x00\x00\x00\x00\xc0\xd8\x03\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfe\x0f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x99')}
18:51:30 INFO [sampling] Bleak version 0.13.1a1
END
zrehart commented 11 months ago

I have exactly the same problem, the new second JKBMS does not work and the first one, which is about a year old, is OK.

s6-rc: info: service s6rc-oneshot-runner: starting s6-rc: info: service s6rc-oneshot-runner successfully started s6-rc: info: service fix-attrs: starting s6-rc: info: service fix-attrs successfully started s6-rc: info: service legacy-cont-init: starting s6-rc: info: service legacy-cont-init successfully started s6-rc: info: service legacy-services: starting s6-rc: info: service legacy-services successfully started 11:56:41 INFO [main] Power cycle bluetooth hardware 11:56:44 INFO [bt] BT Discovery: 11:56:49 INFO [bt] BT Device FC-03-9F-1C-D2-CF address=FC:03:9F:1C:D2:CF 11:56:49 INFO [bt] BT Device JK-B2A24S15P address=C8:47:8C:E1:FA:37 11:56:49 INFO [bt] BT Device [TV] Samsung QN85AA 65 TV address=80:47:86:57:18:A5 11:56:49 INFO [bt] BT Device [AV] Samsung Soundbar Q700A address=10:2B:41:1B:81:49 11:56:49 INFO [bt] BT Device SmartShunt HQ2218ZEHVY address=DF:1F:21:DD:A4:1E 11:56:49 INFO [bt] BT Device JK_B2A20S20P address=C8:47:8C:EC:BF:3E 11:56:49 INFO [bt] BT Device [TV] Samsung Q80AA 55 TV address=80:47:86:5D:63:1D 11:56:49 INFO [main] Bleak version 0.13.1a1, BtBackend version bluez-v5.66 11:56:49 INFO [bt] BMS JKBt(C8:47:8C:E1:FA:37) keep alive enabled 11:56:49 INFO [bt] BMS JKBt(C8:47:8C:EC:BF:3E) keep alive enabled 11:56:49 INFO [main] connecting mqtt homeassistant@core-mosquitto 11:56:49 INFO [main] Fetching 2 BMS + 0 others serially, period=2.00s, keep_alive=True 11:56:49 INFO [sampling] connecting bms JKBt(C8:47:8C:E1:FA:37) 11:56:51 INFO [sampling] connected bms JKBt(C8:47:8C:E1:FA:37)! 11:56:51 INFO [sampling] battery1 subscribing for {'charge': True, 'discharge': True} switch change 11:56:51 INFO [mqtt_util] subscribe homeassistant/switch/battery1/charge/set 11:56:51 INFO [mqtt_util] subscribe homeassistant/switch/battery1/discharge/set 11:56:51 INFO [sampling] battery1: BmsSampl(98.8%,U=53.7V,I=-1.07A,P=-58W,q=227.3Ah/230,mos=30.2°C) 11:56:51 INFO [sampling] battery1 volt=3361,3361,3361,3361,3357,3361,3359,3354,3354,3354,3362,3362,3355,3362,3362,3361 temp=[28.0, 27.8] 11:56:51 INFO [sampling] JKBt(C8:47:8C:E1:FA:37) times: connect=1.76s fetch=0.56s 11:56:51 INFO [sampling] connecting bms JKBt(C8:47:8C:EC:BF:3E) 11:57:00 ERROR [sampling] battery2 error: <class 'TimeoutError'> 11:57:00 INFO [sampling] battery2 bms debug data: {3: bytearray(b'U\xaa\xeb\x90\x03\xa5JK_B2A20S20P\x00\x00\x00\x0011.XW\x00\x00\x0011.26H\x00\x00<#\x82\x00\x1c\x00\x00\x00JK_B2A20S20P\x00\x00\x00\x001234\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00230425\x00\x003010545162\x000000\x00Input Userdata\x00\x001\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00Input Userdata\x00\x00|\xf8\xff\xff\x9f\r\x00\x00\x00\x00\x00\x00\x90\x0f\x00\x00\x00\x00\xc0\xd8\x03\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfe\x0f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xdc')} 11:57:00 INFO [sampling] Bleak version 0.13.1a1 11:57:01 INFO [sampling] battery1: BmsSampl(98.8%,U=53.7V,I=-0.86A,P=-46W,q=227.3Ah/230,mos=30.2°C) 11:57:01 INFO [sampling] battery1 volt=3361,3361,3361,3361,3357,3361,3359,3354,3352,3352,3361,3362,3355,3361,3362,3361 temp=[28.0, 27.8]

donulf commented 9 months ago

same error here!

donulf commented 8 months ago

update: I left it installed, it seems to work but randomly. Sometimes I find it on, sometimes off... the Bluetooth of the BMS works well because I can reach it from the phone without problems, even the HA one works because I'm connected with the Victron smartshunt and it doesn't miss a beat

fl4p commented 8 months ago

to debug this further, please nebale verbose_log (or set debug: true for the JK), and look in the logs for a line like char_handle_notify= and post it here

donulf commented 8 months ago

Thank you for your answer. I enabled verbose log and added debug:true in yaml, but I can't find a line similar to char_handle_notify. In this moment the addon is working, the log say this:

16:04:47 DEBUG [manager] received D-Bus signal: org.freedesktop.DBus.Properties.PropertiesChanged (/org/bluez/hci0/dev_C8_47_8C_E9_29_34/service000e/char0011): ['org.bluez.GattCharacteristic1', {'Value': <dbus_fast.signature.Variant ('ay', bytearray(b'\x8c\xc8\x00\x00\xad\x05 \x00S\xff\xff\xdd\x00\xe3\x00\x00\x00\x08\x00\xd0\x07\x01=\xe4\xb3\x02\x00\xd0l\x04\x00\x03\x00\x00\x00\t\xef\x0f\x00d\x00\x00\x00\xbd2\x0c\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0f\x00\x01\x00\x00\x00#\x04\x03\x00\xc1\x00\x8b4@@\x00\x00\xe4\x00\x0e\x14\x00\x00\x00\x01\x00\x01\x00\x05\x00\x00\xaa8l\x00\x00\x00\x00\x00?\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'))>}, []] 16:04:47 DEBUG [jikong] bms msg(128) (buf278): 8c c8 0 0 ad 5 20 0 53 60 ff ff dd 0 e3 0 0 0 8 0 d0 7 1 3d e4 b3 2 0 d0 6c 4 0 3 0 0 0 9 ef f 0 64 0 0 0 bd 32 c 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f 0 1 0 0 0 23 4 3 0 c1 0 8b 34 40 40 0 0 e4 0 e 14 0 0 0 1 0 1 0 5 0 0 aa 38 6c 0 0 0 0 0 3f 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 16:04:47 DEBUG [manager] received D-Bus signal: org.freedesktop.DBus.Properties.PropertiesChanged (/org/bluez/hci0/dev_C8_47_8C_E9_29_34/service000e/char0011): ['org.bluez.GattCharacteristic1', {'Value': <dbus_fast.signature.Variant ('ay', bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfe\xff\x7f\xdc\x0f\x01\x00\x00\x00\x00\x00\x00\xd1'))>}, []] 16:04:47 DEBUG [jikong] bms msg(22) (buf300): 0 0 0 0 0 0 0 0 0 fe ff 7f dc f 1 0 0 0 0 0 0 d1 16:04:47 DEBUG [jikong] got response 2 (len300) 16:04:48 DEBUG [manager] received D-Bus signal: org.freedesktop.DBus.Properties.PropertiesChanged (/org/bluez/hci0/dev_C8_47_8C_E9_29_34/service000e/char0011): ['org.bluez.GattCharacteristic1', {'Value': <dbus_fast.signature.Variant ('ay', bytearray(b'U\xaa\xeb\x90\x02\xea\x83\x0c\x83\x0c\x88\x0c\x88\x0c\x8a\x0c\x8b\x0c\x8c\x0c\x85\x0c\x8c\x0c\x83\x0c\x81\x0c\x8b\x0c\x8c\x0c\x85\x0c\x8f\x0c\x8b\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x87\x0c\r\x00\x02\x082\x002\x002\x002\x002\x002\x001\x002\x002\x001\x001\x001\x001\x001\x001\x001\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'))>}, []] 16:04:48 DEBUG [jikong] header, clear buf bytearray(b'') 16:04:48 DEBUG [jikong] bms msg(128) (buf128): 55 aa eb 90 2 ea 83 c 83 c 88 c 88 c 8a c 8b c 8c c 85 c 8c c 83 c 81 c 8b c 8c c 85 c 8f c 8b c 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ff ff 0 0 87 c d 0 2 8 32 0 32 0 32 0 32 0 32 0 32 0 31 0 32 0 32 0 31 0 31 0 31 0 31 0 31 0 31 0 31 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 16:04:48 DEBUG [manager] received D-Bus signal: org.freedesktop.DBus.Properties.PropertiesChanged (/org/bluez/hci0/dev_C8_47_8C_E9_29_34/service000e/char0011): ['org.bluez.GattCharacteristic1', {'Value': <dbus_fast.signature.Variant ('ay', bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00?\x01\x00\x00\x00\x00'))>}, []] 16:04:48 DEBUG [jikong] bms msg(22) (buf150): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3f 1 0 0 0 0 16:04:48 DEBUG [manager] received D-Bus signal: org.freedesktop.DBus.Properties.PropertiesChanged (/org/bluez/hci0/dev_C8_47_8C_E9_29_34/service000e/char0011): ['org.bluez.GattCharacteristic1', {'Value': <dbus_fast.signature.Variant ('ay', bytearray(b'r\xc8\x00\x00\x8c\x01 \x00S\xff\xff\xdd\x00\xe3\x00\x00\x00\x08\x00\xb8\x07\x01=\xde\xb3\x02\x00\xd0l\x04\x00\x03\x00\x00\x00\x10\xef\x0f\x00d\x00\x00\x00\xbd2\x0c\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0f\x00\x01\x00\x00\x00#\x04\x03\x00\xc1\x00\x8b4@@\x00\x00\xe4\x00\x0b\x14\x00\x00\x00\x01\x00\x01\x00\x05\x00\x00\xaf8l\x00\x00\x00\x00\x00?\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'))>}, []] 16:04:48 DEBUG [jikong] bms msg(128) (buf278): 72 c8 0 0 8c 1 20 0 53 60 ff ff dd 0 e3 0 0 0 8 0 b8 7 1 3d de b3 2 0 d0 6c 4 0 3 0 0 0 10 ef f 0 64 0 0 0 bd 32 c 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f 0 1 0 0 0 23 4 3 0 c1 0 8b 34 40 40 0 0 e4 0 b 14 0 0 0 1 0 1 0 5 0 0 af 38 6c 0 0 0 0 0 3f 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 16:04:48 DEBUG [manager] received D-Bus signal: org.freedesktop.DBus.Properties.PropertiesChanged (/org/bluez/hci0/dev_C8_47_8C_E9_29_34/service000e/char0011): ['org.bluez.GattCharacteristic1', {'Value': <dbus_fast.signature.Variant ('ay', bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfe\xff\x7f\xdc\x0f\x01\x00\x00\x00\x00\x00\x00\x89'))>}, []] 16:04:48 DEBUG [jikong] bms msg(22) (buf300): 0 0 0 0 0 0 0 0 0 fe ff 7f dc f 1 0 0 0 0 0 0 89 16:04:48 DEBUG [jikong] got response 2 (len300) 16:04:48 DEBUG [jikong] New 11.x firmware, offset=32 16:04:48 DEBUG [client] Sending PUBLISH (d0, q0, r0, m2544), 'b'battery/soc/total_voltage'', ... (5 bytes) 16:04:48 DEBUG [mqtt_util] topic battery/soc/current data not changed 16:04:48 DEBUG [client] Sending PUBLISH (d0, q0, r0, m2545), 'b'battery/soc/balance_current'', ... (5 bytes) 16:04:48 DEBUG [mqtt_util] topic battery/soc/soc_percent data not changed 16:04:48 DEBUG [client] Sending PUBLISH (d0, q0, r0, m2546), 'b'battery/soc/power'', ... (5 bytes) 16:04:48 DEBUG [client] Sending PUBLISH (d0, q0, r0, m2547), 'b'battery/soc/capacity'', ... (5 bytes) 16:04:48 DEBUG [mqtt_util] topic battery/soc/cycle_capacity data not changed 16:04:48 DEBUG [client] Sending PUBLISH (d0, q0, r0, m2548), 'b'battery/soc/num_cycles'', ... (1 bytes) 16:04:48 DEBUG [client] Sending PUBLISH (d0, q0, r0, m2549), 'b'battery/mosfet_status/capacity_ah'', ... (6 bytes) 16:04:48 DEBUG [client] Sending PUBLISH (d0, q0, r0, m2550), 'b'battery/mosfet_status/temperature'', ... (3 bytes) 16:04:48 DEBUG [client] Sending PUBLISH (d0, q0, r0, m2551), 'b'battery/bms/uptime'', ... (9 bytes) 16:04:48 DEBUG [client] Sending PUBLISH (d0, q0, r0, m2552), 'b'battery/switch/charge'', ... (2 bytes) 16:04:48 DEBUG [client] Sending PUBLISH (d0, q0, r0, m2553), 'b'battery/switch/discharge'', ... (2 bytes) 16:04:48 INFO [sampling] battery: BmsSampl(61.1%,U=51.3V,I=-40.88A,P=-2098W,Q=177.1Ah/290,mos=0.0°C) 16:04:48 DEBUG [client] Sending PUBLISH (d0, q0, r0, m2554), 'b'battery/meter/total_charge'', ... (6 bytes) 16:04:48 DEBUG [client] Sending PUBLISH (d0, q0, r0, m2555), 'b'battery/meter/total_energy'', ... (6 bytes) 16:04:48 DEBUG [mqtt_util] topic battery/meter/total_energy_discharge data not changed 16:04:48 DEBUG [client] Sending PUBLISH (d0, q0, r0, m2556), 'b'battery/meter/total_energy_charge'', ... (5 bytes) 16:04:48 DEBUG [mqtt_util] topic battery/meter/total_cycles data not changed 16:04:48 DEBUG [mqtt_util] topic battery/meter/total_abs_diff_charge data not changed 16:04:48 DEBUG [client] Sending PUBLISH (d0, q0, r0, m2557), 'b'battery/cell_voltages/1'', ... (5 bytes) 16:04:48 DEBUG [client] Sending PUBLISH (d0, q0, r0, m2558), 'b'battery/cell_voltages/2'', ... (5 bytes) 16:04:48 DEBUG [client] Sending PUBLISH (d0, q0, r0, m2559), 'b'battery/cell_voltages/3'', ... (5 bytes) 16:04:48 DEBUG [client] Sending PUBLISH (d0, q0, r0, m2560), 'b'battery/cell_voltages/4'', ... (5 bytes) 16:04:48 DEBUG [mqtt_util] topic battery/cell_voltages/5 data not changed 16:04:48 DEBUG [mqtt_util] topic battery/cell_voltages/6 data not changed 16:04:48 DEBUG [client] Sending PUBLISH (d0, q0, r0, m2561), 'b'battery/cell_voltages/7'', ... (5 bytes) 16:04:48 DEBUG [client] Sending PUBLISH (d0, q0, r0, m2562), 'b'battery/cell_voltages/8'', ... (5 bytes) 16:04:48 DEBUG [client] Sending PUBLISH (d0, q0, r0, m2563), 'b'battery/cell_voltages/9'', ... (5 bytes) 16:04:48 DEBUG [client] Sending PUBLISH (d0, q0, r0, m2564), 'b'battery/cell_voltages/10'', ... (5 bytes) 16:04:48 DEBUG [client] Sending PUBLISH (d0, q0, r0, m2565), 'b'battery/cell_voltages/11'', ... (5 bytes) 16:04:48 DEBUG [client] Sending PUBLISH (d0, q0, r0, m2566), 'b'battery/cell_voltages/12'', ... (5 bytes) 16:04:48 DEBUG [mqtt_util] topic battery/cell_voltages/13 data not changed 16:04:48 DEBUG [mqtt_util] topic battery/cell_voltages/14 data not changed 16:04:48 DEBUG [client] Sending PUBLISH (d0, q0, r0, m2567), 'b'battery/cell_voltages/15'', ... (5 bytes) 16:04:48 DEBUG [client] Sending PUBLISH (d0, q0, r0, m2568), 'b'battery/cell_voltages/16'', ... (5 bytes) 16:04:48 DEBUG [mqtt_util] topic battery/cell_voltages/min data not changed 16:04:48 DEBUG [client] Sending PUBLISH (d0, q0, r0, m2569), 'b'battery/cell_voltages/min_index'', ... (2 bytes) 16:04:48 DEBUG [mqtt_util] topic battery/cell_voltages/max data not changed 16:04:48 DEBUG [client] Sending PUBLISH (d0, q0, r0, m2570), 'b'battery/cell_voltages/max_index'', ... (2 bytes) 16:04:48 DEBUG [mqtt_util] topic battery/cell_voltages/delta data not changed 16:04:48 DEBUG [client] Sending PUBLISH (d0, q0, r0, m2571), 'b'battery/cell_voltages/average'', ... (5 bytes) 16:04:48 DEBUG [client] Sending PUBLISH (d0, q0, r0, m2572), 'b'battery/cell_voltages/median'', ... (5 bytes) 16:04:48 DEBUG [mqtt_util] topic battery/temperatures/1 data not changed 16:04:48 DEBUG [client] Sending PUBLISH (d0, q0, r0, m2573), 'b'battery/temperatures/2'', ... (4 bytes) 16:04:48 INFO [sampling] battery volt=[3203,3203,3208,3208,3210,3211,3212,3205,3212,3203,3201,3211,3212,3205,3215,3211] temp=[22.1, 22.7] 16:04:48 INFO [sampling] JKBt(C8:47:8C:E9:29:34,battery) times: connect=0.00s fetch=0.14s 16:04:48 DEBUG [manager] received D-Bus signal: org.freedesktop.DBus.Properties.PropertiesChanged (/org/bluez/hci0/dev_C8_47_8C_E9_29_34/service000e/char0011): ['org.bluez.GattCharacteristic1', {'Value': <dbus_fast.signature.Variant ('ay', bytearray(b'U\xaa\xeb\x90\x02\xeb\x83\x0c\x83\x0c\x88\x0c\x88\x0c\x8a\x0c\x8b\x0c\x8c\x0c\x85\x0c\x8c\x0c\x83\x0c\x81\x0c\x8b\x0c\x8c\x0c\x85\x0c\x8f\x0c\x8b\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x87\x0c\r\x00\x02\x082\x002\x002\x002\x002\x002\x001\x002\x002\x001\x001\x001\x001\x001\x001\x001\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'))>}, []] 16:04:48 DEBUG [jikong] header, clear buf bytearray(b'') 16:04:48 DEBUG [jikong] bms msg(128) (buf128): 55 aa eb 90 2 eb 83 c 83 c 88 c 88 c 8a c 8b c 8c c 85 c 8c c 83 c 81 c 8b c 8c c 85 c 8f c 8b c 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ff ff 0 0 87 c d 0 2 8 32 0 32 0 32 0 32 0 32 0 32 0 31 0 32 0 32 0 31 0 31 0 31 0 31 0 31 0 31 0 31 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 16:04:48 DEBUG [manager] received D-Bus signal: org.freedesktop.DBus.Properties.PropertiesChanged (/org/bluez/hci0/dev_C8_47_8C_E9_29_34/service000e/char0011): ['org.bluez.GattCharacteristic1', {'Value': <dbus_fast.signature.Variant ('ay', bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00?\x01\x00\x00\x00\x00'))>}, []] 16:04:48 DEBUG [jikong] bms msg(22) (buf150): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3f 1 0 0 0 0 16:04:48 DEBUG [manager] received D-Bus signal: org.freedesktop.DBus.Properties.PropertiesChanged (/org/bluez/hci0/dev_C8_47_8C_E9_29_34/service000e/char0011): ['org.bluez.GattCharacteristic1', {'Value': <dbus_fast.signature.Variant ('ay', bytearray(b'r\xc8\x00\x00\x8c\x01 \x00S`\xff\xff\xdd\x00\xe3\x00\x00\x00\x08\x00\x10\x08\x01=\xd8\xb3\x02\x00\xd0l\x04\x00\x03\x00\x00\x00\x16\xef\x0f\x00d\x00\x00\x00\xbe2\x0c\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0f\x00\x01\x00\x00\x00#\x04\x03\x00\xc1\x00\x8b4@@\x00\x00\xe4\x00\x0b\x14\x00\x00\x00\x01\x00\x01\x00\x05\x00\x00\xb58l\x00\x00\x00\x00\x00?\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'))>}, []] 16:04:48 DEBUG [jikong] bms msg(128) (buf278): 72 c8 0 0 8c 1 20 0 53 60 ff ff dd 0 e3 0 0 0 8 0 10 8 1 3d d8 b3 2 0 d0 6c 4 0 3 0 0 0 16 ef f 0 64 0 0 0 be 32 c 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f 0 1 0 0 0 23 4 3 0 c1 0 8b 34 40 40 0 0 e4 0 b 14 0 0 0 1 0 1 0 5 0 0 b5 38 6c 0 0 0 0 0 3f 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 16:04:48 DEBUG [manager] received D-Bus signal: org.freedesktop.DBus.Properties.PropertiesChanged (/org/bluez/hci0/dev_C8_47_8C_E9_29_34/service000e/char0011): ['org.bluez.GattCharacteristic1', {'Value': <dbus_fast.signature.Variant ('ay', bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfe\xff\x7f\xdc\x0f\x01\x00\x00\x00\x00\x00\x00\xea'))>}, []] 16:04:48 DEBUG [jikong] bms msg(22) (buf300): 0 0 0 0 0 0 0 0 0 fe ff 7f dc f 1 0 0 0 0 0 0 ea 16:04:48 DEBUG [jikong] got response 2 (len300) 16:04:49 DEBUG [manager] received D-Bus signal: org.freedesktop.DBus.Properties.PropertiesChanged (/org/bluez/hci0/dev_C8_47_8C_E9_29_34/service000e/char0011): ['org.bluez.GattCharacteristic1', {'Value': <dbus_fast.signature.Variant ('ay', bytearray(b'U\xaa\xeb\x90\x02\xec\x8c\x0c\x86\x0c\x88\x0c\x80\x0c\x80\x0c\x85\x0c\x89\x0c\x8a\x0c\x85\x0c\x83\x0c\x81\x0c\x8b\x0c\x8c\x0c\x85\x0c\x8f\x0c\x8b\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x87\x0c\r\x00\x02\x082\x002\x002\x002\x002\x002\x001\x002\x002\x001\x001\x001\x001\x001\x001\x001\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'))>}, []] 16:04:49 DEBUG [jikong] header, clear buf bytearray(b'') 16:04:49 DEBUG [jikong] bms msg(128) (buf128): 55 aa eb 90 2 ec 8c c 86 c 88 c 80 c 80 c 85 c 89 c 8a c 85 c 83 c 81 c 8b c 8c c 85 c 8f c 8b c 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ff ff 0 0 87 c d 0 2 8 32 0 32 0 32 0 32 0 32 0 32 0 31 0 32 0 32 0 31 0 31 0 31 0 31 0 31 0 31 0 31 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 16:04:49 DEBUG [manager] received D-Bus signal: org.freedesktop.DBus.Properties.PropertiesChanged (/org/bluez/hci0/dev_C8_47_8C_E9_29_34/service000e/char0011): ['org.bluez.GattCharacteristic1', {'Value': <dbus_fast.signature.Variant ('ay', bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00?\x01\x00\x00\x00\x00'))>}, []] 16:04:49 DEBUG [jikong] bms msg(22) (buf150): 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3f 1 0 0 0 0 16:04:49 DEBUG [manager] received D-Bus signal: org.freedesktop.DBus.Properties.PropertiesChanged (/org/bluez/hci0/dev_C8_47_8C_E9_29_34/service000e/char0011): ['org.bluez.GattCharacteristic1', {'Value': <dbusfast.signature.Variant ('ay', bytearray(b'r\xc8\x00\x00\x8c\x01 \x00\x7f\xff\xff\xdd\x00\xe3\x00\x00\x00\x08\x00\xf7\x07\x01=\xd1\xb3\x02\x00\xd0l\x04\x00\x03\x00\x00\x00\x1c\xef\x0f\x00d\x00\x00\x00\xbf2\x0c\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0f\x00\x01\x00\x00\x00#\x04\x03\x00\xc2\x00\x8b4@@\x00\x00\xe4\x00\x0b\x14\x00\x00\x00\x01\x00\x01\x00\x05\x00\x00\xba8l\x00\x00\x00\x00\x00?\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'))>}, []] 16:04:49 DEBUG [jikong] bms msg(128) (buf278): 72 c8 0 0 8c 1 20 0 7f 5f ff ff dd 0 e3 0 0 0 8 0 f7 7 1 3d d1 b3 2 0 d0 6c 4 0 3 0 0 0 1c ef f 0 64 0 0 0 bf 32 c 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f 0 1 0 0 0 23 4 3 0 c2 0 8b 34 40 40 0 0 e4 0 b 14 0 0 0 1 0 1 0 5 0 0 ba 38 6c 0 0 0 0 0 3f 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 16:04:49 DEBUG [manager] received D-Bus signal: org.freedesktop.DBus.Properties.PropertiesChanged (/org/bluez/hci0/dev_C8_47_8C_E9_29_34/service000e/char0011): ['org.bluez.GattCharacteristic1', {'Value': <dbus_fast.signature.Variant ('ay', bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfe\xff\x7f\xdc\x0f\x01\x00\x00\x00\x00\x00\x00\xf1'))>}, []] 16:04:49 DEBUG [jikong] bms msg(22) (buf300): 0 0 0 0 0 0 0 0 0 fe ff 7f dc f 1 0 0 0 0 0 0 f1 16:04:49 DEBUG [jikong] got response 2 (len300) 16:04:49 DEBUG [jikong] New 11.x firmware, offset=32 16:04:49 INFO [sampling] JKBt(C8:47:8C:E9:29:34,battery) times: connect=0.00s fetch=0.04s

donulf commented 8 months ago

now is not working again. the log says:

File "/app/bmslib/sampling.py", line 113, in sample sample = await bms.fetch() ^^^^^^^^^^^^^^^^^ File "/app/bmslib/models/jikong.py", line 221, in fetch await self._fetch_futures.wait_for(0x02, self.TIMEOUT) File "/app/bmslib/init.py", line 50, 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 16:09:06 DEBUG [manager] received D-Bus signal: org.freedesktop.DBus.ObjectManager.InterfacesRemoved (/): ['/org/bluez/hci0/dev_E5_99_2F_49_C3_20', ['org.freedesktop.DBus.Properties', 'org.freedesktop.DBus.Introspectable', 'org.bluez.Device1']] 16:09:09 DEBUG [client] Sending PINGREQ 16:09:09 DEBUG [client] Received PINGRESP 16:09:11 ERROR [sampling] battery error: <class 'TimeoutError'> 16:09:11 INFO [sampling] battery bms debug data: {3: bytearray(b'U\xaa\xeb\x90\x037JK_B2A20S20P\x00\x00\x00\x0011.XW\x00\x00\x0011.25\x00\x00\x00\x0c3\x0c\x00\x05\x00\x00\x00JK_B2A20S20P\x00\x00\x00\x001234\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00231009\x00\x002092245025\x000000\x00Input Userdata\x00\x00123456\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00Input Userdata\x00\x00|\xf8\xff\xff\x1f\r\x00\x00\x00\x00\x00\x00\x90\x0f\x00\x00\x00\x00\xc0\xd8\x03\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfe\x0f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff')} 16:09:11 INFO [sampling] battery device info: DeviceInfo(JK_B2A20S20P,hw-11.XW,sw-11.25,JK_B2A20S20P,#2092245025) 16:09:11 INFO [sampling] Bleak version 0.20.2 16:09:11 ERROR [main] 1 exceptions occurred fetching BMSs 16:09:11 ERROR [main] Error (num 18, max 200) reading BMS: 16:09:11 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/main.py", line 38, in fetch_loop await fn() File "/app/main.py", line 307, in fn raise exceptions[0] File "/app/main.py", line 302, in fn await t() File "/app/bmslib/sampling.py", line 81, in call return await self.sample() ^^^^^^^^^^^^^^^^^^^ File "/app/bmslib/sampling.py", line 113, in sample sample = await bms.fetch() ^^^^^^^^^^^^^^^^^ File "/app/bmslib/models/jikong.py", line 221, in fetch await self._fetch_futures.wait_for(0x02, self.TIMEOUT) File "/app/bmslib/init.py", line 50, 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 16:09:20 ERROR [sampling] battery error: <class 'TimeoutError'> 16:09:20 WARNING [sampling] battery disconnect because no data has been flowing for some time 16:09:20 DEBUG [manager] received D-Bus signal: org.freedesktop.DBus.Properties.PropertiesChanged (/org/bluez/hci0/dev_C8_47_8C_E9_29_34/service000e/char0011): ['org.bluez.GattCharacteristic1', {'Notifying': <dbus_fast.signature.Variant ('b', False)>}, []] 16:09:20 DEBUG [client] Disconnecting (/org/bluez/hci0/dev_C8_47_8C_E9_29_34) 16:09:20 DEBUG [manager] received D-Bus signal: org.freedesktop.DBus.ObjectManager.InterfacesRemoved (/): ['/org/bluez/hci0/dev_C8_47_8C_E9_29_34', ['org.bluez.Battery1']] 16:09:23 DEBUG [manager] received D-Bus signal: org.freedesktop.DBus.Properties.PropertiesChanged (/org/bluez/hci0/dev_C8_47_8C_E9_29_34): ['org.bluez.Device1', {'ServicesResolved': <dbus_fast.signature.Variant ('b', False)>}, []] 16:09:23 DEBUG [manager] received D-Bus signal: org.freedesktop.DBus.Properties.PropertiesChanged (/org/bluez/hci0/dev_C8_47_8C_E9_29_34): ['org.bluez.Device1', {'Connected': <dbus_fast.signature.Variant ('b', False)>}, []] 16:09:23 DEBUG [client] Device disconnected (/org/bluez/hci0/dev_C8_47_8C_E9_29_34) 16:09:23 DEBUG [client] _cleanup_all(/org/bluez/hci0/dev_C8_47_8C_E9_29_34) 16:09:23 WARNING [bt] BMS JKBt(C8:47:8C:E9:29:34,battery) disconnected after 46.7s! 16:09:23 INFO [sampling] battery bms debug data: {3: bytearray(b'U\xaa\xeb\x90\x037JK_B2A20S20P\x00\x00\x00\x0011.XW\x00\x00\x0011.25\x00\x00\x00\x0c3\x0c\x00\x05\x00\x00\x00JK_B2A20S20P\x00\x00\x00\x001234\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00231009\x00\x002092245025\x000000\x00Input Userdata\x00\x00123456\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00Input Userdata\x00\x00|\xf8\xff\xff\x1f\r\x00\x00\x00\x00\x00\x00\x90\x0f\x00\x00\x00\x00\xc0\xd8\x03\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfe\x0f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff')} 16:09:23 INFO [sampling] battery device info: DeviceInfo(JK_B2A20S20P,hw-11.XW,sw-11.25,JK_B2A20S20P,#2092245025) 16:09:23 INFO [sampling] Bleak version 0.20.2 16:09:23 ERROR [main] 1 exceptions occurred fetching BMSs 16:09:23 ERROR [main] Error (num 19, max 200) reading BMS: 16:09:23 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/main.py", line 38, in fetch_loop await fn() File "/app/main.py", line 307, in fn raise exceptions[0] File "/app/main.py", line 302, in fn await t() File "/app/bmslib/sampling.py", line 81, in call return await self.sample() ^^^^^^^^^^^^^^^^^^^ File "/app/bmslib/sampling.py", line 113, in sample sample = await bms.fetch() ^^^^^^^^^^^^^^^^^ File "/app/bmslib/models/jikong.py", line 221, in fetch await self._fetch_futures.wait_for(0x02, self.TIMEOUT) File "/app/bmslib/init.py", line 50, 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 16:09:24 INFO [sampling] connecting bms JKBt(C8:47:8C:E9:29:34,battery) 16:09:24 INFO [bt] connecting battery (C8:47:8C:E9:29:34) adapter=None 16:09:24 DEBUG [client] Connecting to device @ C8:47:8C:E9:29:34 16:09:24 DEBUG [client] Connecting to BlueZ path /org/bluez/hci0/dev_C8_47_8C_E9_29_34

donulf commented 8 months ago

jk

if you look at the graph of one of the components from midnight to noon, you can clearly see the hiccup trend. I bought a USB dongle to see if it could be the internal card, as soon as it arrives I'll try and write the results here.

fl4p commented 8 months ago

Please wrap comments inside ```, for example:

``` logs here... ```

I just pushed v72, which fixes gatt characterics identification and adds more log output. Please try

donulf commented 8 months ago

Please wrap comments inside ```, for example:

logs here...

Sorry I didn't understand :-(

However, I installed v72, it's since yesterday that your addon is working like charm! here the graph today, you can clearly see the difference.. thanks a lot for your dedication :-D jk2

fl4p commented 8 months ago

nice too see its working :) and thanks for your donation

fl4p commented 8 months ago

i assume that the original issue is fixed. open a new one in case not