Closed kevin-jake closed 1 year ago
Could you enable the debug output of the uart
component:
logger:
level: DEBUG
uart:
id: uart0
baud_rate: 9600
tx_pin: GPIO4
rx_pin: GPIO5
debug:
direction: BOTH
and provide a log including multiple "Invalid header" warnings?
Could you enable the debug output of the
uart
component:logger: level: DEBUG uart: id: uart0 baud_rate: 9600 tx_pin: GPIO4 rx_pin: GPIO5 debug: direction: BOTH
and provide a log including multiple "Invalid header" warnings?
Got this on the logs ( I cleaned up logs that might not be useful):
[21:03:16][D][uart_debug:114]: >>> DD:A5:03:00:FF:FD:77
[21:03:16][W][jbd_bms:124]: Invalid header
[21:03:16][W][jbd_bms:124]: Invalid header
[21:03:16][W][jbd_bms:124]: Invalid header
[21:03:16][W][jbd_bms:124]: Invalid header
[21:03:16][W][jbd_bms:124]: Invalid header
[21:03:16][W][jbd_bms:124]: Invalid header
[21:03:16][W][jbd_bms:124]: Invalid header
[21:03:16][W][jbd_bms:124]: Invalid header
[21:03:16][W][jbd_bms:124]: Invalid header
[21:03:16][W][jbd_bms:124]: Invalid header
[21:03:16][W][jbd_bms:124]: Invalid header
[21:03:16][W][jbd_bms:124]: Invalid header
[21:03:16][W][jbd_bms:124]: Invalid header
[21:03:16][W][jbd_bms:124]: Invalid header
[21:03:16][W][jbd_bms:124]: Invalid header
[21:03:16][W][jbd_bms:124]: Invalid header
[21:03:16][W][jbd_bms:124]: Invalid header
[21:03:16][W][jbd_bms:124]: Invalid header
[21:03:16][D][uart_debug:114]: <<< DD:03:00:1D:04:FC:FF:34:00:00:02:1C:00:05:2B:92:00:00:00:00:00:00:20:00:03:04:03:0B:CA:0B:C1:0B:BF:FA:3B:77
[21:03:16][D][uart_debug:114]: <<< FF
[21:03:18][D][uart_debug:114]: >>> DD:A5:03:00:FF:FD:77
[21:03:18][D][jbd_bms:248]: Hardware info:
[21:03:18][D][jbd_bms:249]: Device model: JBD-SP04S020A-L4S-80A-B-U
...
...
[21:03:18][D][uart_debug:114]: <<< DD:03:00:1D:04:FB:FE:88:00:00:02:1C:00:05:2B:92:00:00:00:00:00:00:20:00:03:04:03:0B:CA:0B:C1:0B:BF:F9:E9:77
[21:03:18][D][uart_debug:114]: >>> DD:A5:04:00:FF:FC:77
...
[21:03:18][D][uart_debug:114]: <<< DD:04:00:08:0C:77:0C:79:0C:72:0C:79:FD:ED:77
[21:03:20][D][uart_debug:114]: >>> DD:A5:03:00:FF:FD:77
...
...
[21:03:20][D][uart_debug:114]: <<< DD:03:00:1D:04:FD:FF:34:00:00:02:1C:00:05:2B:92:00:00:00:00:00:00:20:00:03:04:03:0B:CA:0B:C1:0B:BF:FA:3A:77
[21:03:20][D][uart_debug:114]: >>> DD:A5:04:00:FF:FC:77
...
[21:03:20][D][uart_debug:114]: <<< DD:04:00:08:0C:79:0C:79:0C:73:0C:7A:FD:E9:77
[21:03:22][D][uart_debug:114]: >>> DD:A5:03:00:FF:FD:77
[21:03:22][W][jbd_bms:147]: JbdBms CRC Check failed! FA48 != FA44
[21:03:22][D][uart_debug:114]: <<< DD:03:00:1D:04:FC:FF:2B:00:00:02:1C:00:05:2B:92:00:00:00:00:00:00:20:00:03:04:03:0B:CA:0B:C1:0B:BB:FA:44:77
[21:03:22][D][uart_debug:114]: <<< FF
[21:03:24][D][uart_debug:114]: >>> DD:A5:03:00:FF:FD:77
...
[21:03:24][D][uart_debug:114]: <<< DD:03:00:1D:04:FC:FF:34:00:00:02:1C:00:05:2B:92:00:00:00:00:00:00:20:00:03:04:03:0B:CA:0B:C1:0B:BF:FA:3B:77
[21:03:24][D][api:102]: Accepted 10.150.6.250
[21:03:24][D][api.connection:917]: Home Assistant 2022.10.5 (10.150.6.250): Connected successfully
[21:03:24][D][uart_debug:114]: >>> DD:A5:04:00:FF:FC:77
[21:03:24][W][jbd_bms:124]: Invalid header
[21:03:24][W][jbd_bms:124]: Invalid header
[21:03:24][W][jbd_bms:124]: Invalid header
[21:03:24][W][jbd_bms:124]: Invalid header
[21:03:24][W][jbd_bms:124]: Invalid header
[21:03:24][W][jbd_bms:124]: Invalid header
[21:03:24][W][jbd_bms:124]: Invalid header
[21:03:24][D][uart_debug:114]: <<< 7F:77:10:20:21:C8:31:F2:0C:70:0C:77:FD:F2:77
[21:03:26][D][uart_debug:114]: >>> DD:A5:03:00:FF:FD:77
[21:03:26][D][jbd_bms:248]: Hardware info:
[21:03:26][D][jbd_bms:249]: Device model: JBD-SP04S020A-L4S-80A-B-U
..
[21:03:26][D][jbd_bms:265]: Date of manufacture: 2021.12.18
...
[21:03:26][D][text_sensor:067]: 'jbd-bms-uart errors': Sending state ''
...
[21:03:26][D][uart_debug:114]: <<< DD:03:00:1D:04:FC:FF:2B:00:00:02:1C:00:05:2B:92:00:00:00:00:00:00:20:00:03:04:03:0B:CA:0B:C1:0B:BF:FA:44:77
[21:03:26][D][uart_debug:114]: >>> DD:A5:04:00:FF:FC:77
..
[21:03:26][D][uart_debug:114]: <<< DD:04:00:08:0C:76:0C:76:0C:6D:0C:78:FD:F7:77
[21:03:28][D][uart_debug:114]: >>> DD:A5:03:00:FF:FD:77
[21:03:28][D][jbd_bms:248]: Hardware info:
[21:03:28][D][jbd_bms:249]: Device model: JBD-SP04S020A-L4S-80A-B-U
...
[21:03:28][D][jbd_bms:265]: Date of manufacture: 2021.12.18
...
[21:03:28][D][uart_debug:114]: <<< DD:03:00:1D:04:FC:FF:13:00:00:02:1C:00:05:2B:92:00:00:00:00:00:00:20:00:03:04:03:0B:CA:0B:C1:0B:BF:FA:5C:77
[21:03:28][D][uart_debug:114]: >>> DD:A5:04:00:FF:FC:77
...
[21:03:28][D][uart_debug:114]: <<< DD:04:00:08:0C:79:0C:79:0C:74:0C:7A:FD:E8:77
[21:03:30][D][uart_debug:114]: >>> DD:A5:03:00:FF:FD:77
....
[21:03:30][D][uart_debug:114]: <<< DD:03:00:1D:04:FD:FF:34:00:00:02:1C:00:05:2B:92:00:00:00:00:00:00:20:00:03:04:03:0B:CA:0B:C1:0B:BF:FA:3A:77
[21:03:30][D][uart_debug:114]: >>> DD:A5:04:00:FF:FC:77
...
[21:03:30][D][uart_debug:114]: <<< DD:04:00:08:0C:77:0C:7A:0C:74:0C:7B:FD:E8:77:FF
[21:03:32][D][uart_debug:114]: >>> DD:A5:03:00:FF:FD:77
...
[21:03:32][D][uart_debug:114]: <<< DD:03:00:1D:04:FC:FF:1C:00:00:02:1C:00:05:2B:92:00:00:00:00:00:00:20:00:03:04:03:0B:CA:0B:C1:0B:BF:FA:53:77
[21:03:32][D][uart_debug:114]: >>> DD:A5:04:00:FF:FC:77
...
[21:03:32][D][uart_debug:114]: <<< DD:04:00:08:0C:78:0C:79:0C:74:0C:7B:FD:E8:77
[21:03:34][D][uart_debug:114]: >>> DD:A5:03:00:FF:FD:77
...
[21:03:34][D][uart_debug:114]: <<< DD:03:00:1D:04:FD:FF:34:00:00:02:1C:00:05:2B:92:00:00:00:00:00:00:20:00:03:04:03:0B:CA:0B:C1:0B:BF:FA:3A:77
[21:03:34][D][uart_debug:114]: >>> DD:A5:04:00:FF:FC:77
[21:03:34][W][jbd_bms:147]: JbdBms CRC Check failed! FDF0 != F5F0
Could you try to increase the rx_timeout
from 150ms to 200ms and try again?
Invalid Headers occur less but still the Balancing, Charging and Discharging switches are still not working. Not sure if this is because of the password is it applicable for BMS that has this Date of manufacture: 2021.12.18 ?
Are we talking about the binary sensors or switches?
switches
I increased timeout to 500ms. Looks fine now for the invalid header issue. Thanks for the tip man!
its the switches. I can see the commands being sent on the logs but its not taking effect. Also is it possible to change other settings for the BMS in home assistant?
Switches aren't supported yet / they are untested: https://github.com/syssi/esphome-jbd-bms/blob/main/components/jbd_bms/switch/jbd_switch.cpp#L12
No other controls are implemented yet.
Ok thanks for this if I got a chance to explore this maybe I'll just raise a PR but still need to learn the registers and how it communicates to the BMS.
Thank you for the great work!
You could use this implementation / skeleton for some guidance to implement additional entities (number, button, etc.): https://github.com/syssi/esphome-jk-bms/tree/main/components/jk_bms_ble
I recommend to extract the commands/registers from a btsnoop capture to be sure to not pass garbage to the BMS.
Hi Invalid Headers occured again today and became more frequent, is there something i should do like resetting the bms or something?
[19:28:34][W][jbd_bms:124]: Invalid header
[19:28:34][W][jbd_bms:124]: Invalid header
[19:28:35][W][jbd_bms:124]: Invalid header
[19:28:35][D][uart_debug:114]: <<< FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:DD:03:00:1D:05:15:FC:92:00:00:02:1C:00:0B:2B:92:00:00:00:00:00:00:20:00:03:04:03:0B:DB:0B:CD:0B:CB:FA:97:77:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF
[19:28:35][W][jbd_bms:124]: Invalid header
[19:28:35][W][jbd_bms:124]: Invalid header
[19:28:35][W][jbd_bms:124]: Invalid header
[19:28:35][W][jbd_bms:124]: Invalid header
[19:28:35][D][uart_debug:114]: <<< FF:FF:FF:FF:FF:FF:FF
[19:28:35][W][jbd_bms:124]: Invalid header
[19:28:35][W][jbd_bms:124]: Invalid header
[19:28:35][W][jbd_bms:124]: Invalid header
[19:28:35][W][jbd_bms:124]: Invalid header
[19:28:35][W][jbd_bms:124]: Invalid header
[19:28:35][D][uart_debug:114]: <<< FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF
[19:28:36][W][jbd_bms:124]: Invalid header
[19:28:36][D][uart_debug:114]: <<< FF
[19:28:36][D][uart_debug:114]: >>> DD:A5:03:00:FF:FD:77
[19:28:36][W][jbd_bms:124]: Invalid header
[19:28:36][W][jbd_bms:124]: Invalid header
[19:28:36][W][jbd_bms:124]: Invalid header
[19:28:36][W][jbd_bms:124]: Invalid header
[19:28:36][W][jbd_bms:124]: Invalid header
[19:28:36][W][jbd_bms:124]: Invalid header
[19:28:36][W][jbd_bms:124]: Invalid header
[19:28:36][W][jbd_bms:124]: Invalid header
[19:28:36][W][jbd_bms:124]: Invalid header
[19:28:36][W][jbd_bms:124]: Invalid header
[19:28:36][W][jbd_bms:124]: Invalid header
[19:28:36][W][jbd_bms:124]: Invalid header
[19:28:36][W][jbd_bms:124]: Invalid header
[19:28:36][W][jbd_bms:124]: Invalid header
[19:28:36][W][jbd_bms:124]: Invalid header
[19:28:36][W][jbd_bms:124]: Invalid header
[19:28:36][W][jbd_bms:124]: Invalid header
[19:28:36][W][jbd_bms:124]: Invalid header
[19:28:36][W][jbd_bms:124]: Invalid header
[19:28:36][W][jbd_bms:124]: Invalid header
[19:28:36][W][jbd_bms:124]: Invalid header
[19:28:36][W][jbd_bms:124]: Invalid header
[19:28:36][W][jbd_bms:124]: Invalid header
[19:28:36][D][uart_debug:114]: <<< FF:DD:03:00:1D:05:16:FD:15:00:00:02:1C:00:0B:2B:92:00:00:00:00:00:00:20:00:03:04:03:0B:DB:0B:CD:0B:CB:FB:12:77:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF
[19:28:36][W][jbd_bms:124]: Invalid header
[19:28:36][D][uart_debug:114]: <<< FF:FF
[19:28:36][W][jbd_bms:124]: Invalid header
[19:28:36][W][jbd_bms:124]: Invalid header
[19:28:36][W][jbd_bms:124]: Invalid header
[19:28:36][W][jbd_bms:124]: Invalid header
Another user did report in the past the serial interface of the BMS is unstable in case of charging the battery.
oh ok so this is a known issue. Perhaps in the BMS itself?
Yes. If you have a logic analyzer you could try to record the traffic while charging & discharging. I assume you will see gaps/some silence between the bytes of a frame depending on the "load".
Let's close this issue because its a hardware issue probably and cannot be solved here.
Hi I have successfully integrated this on my JBD 4s 80A BMS however I am getting invalid header errors. Any idea how to fix this? Also it seems that the binary sensors (Balancing, Discharging and Charging) is not working?? Please see the sample logs I am having: