Closed austin202220 closed 1 year ago
Could you tell me the hardware and software version of your device? I assume your device is a JK02
device and it shouldn't be "detected" as JK02_32S
. Please check the total_voltage
and power_tube_temperature
if you see such a log message. I assume the sensor measurements are garbled in this case.
I have been running this BMS with your software since Jan 2023 or earlier. I dont really check the logs too often, but happened to be updating esphome versions from 2023.3.0 to 2023.3.2 and prior to updating I checked the logs and noticed the message.
Power tube temp and total voltage both are displaying accurate values.
JK_BD4A8S4P HW: V11.XW SW: V11.24 Ver: V4.10.1
I changed log level to DEBUG and here is the output:
Edit: redacted some ip addresses
Interesting! I haven't seen a JK-BD4A8S4P using the JK02_32S
protocol version in the wild yet. Please change the protocol version to JK02_32S
to omit the warning:
substitutions:
name: jk-bms
device_description: "Monitor and control a JK-BMS via bluetooth"
external_components_source: github://syssi/esphome-jk-bms@main
mac_address: C8:47:8C:E1:E2:E1
# Defaults to "JK02"
# Please use "JK02_32S" if you own a JK-B2A8S20P >= hardware version 11+ (f.e. JK-B2A8S20P hw 11.XW, sw 11.26)
# Please use "JK04" if you have some old JK-BMS <= hardware version 3 (f.e. JK-B2A16S hw 3.0, sw. 3.3.0)
protocol_version: JK02_32S
Just for clarity, I have been running JK02 protocol, and the logs text file linked above is from that protocol version JK02.
I will update to JK02_32S, compile, and provide logs after the update.
Here is the log file after updating to JK02_32S I also included my YAML config file in case that is needed for reference.
Note: I get the following lines of 'unknown' values. I get them on both JK02 and JK02_32S. Are these normal?
[10:22:51][D][jk_bms_ble:647]: Unknown158: 0x64 0x00 (always 0x64 0x00?) [10:22:51][D][jk_bms_ble:650]: Unknown160: 0x00 0x00 (always 0xC5 0x09?) [10:22:51][D][jk_bms_ble:663]: Unknown168: 00.00.00.00.00.00.00.00.00.00.00.00.00.00 (14) [10:22:51][D][jk_bms_ble:677]: Unknown189: 0x00 0x64 [10:22:51][D][jk_bms_ble:681]: Unknown192: 0x8B [10:22:51][D][jk_bms_ble:683]: Unknown193: 0x00 0x2B (0x00 0x8D) [10:22:51][D][jk_bms_ble:685]: Unknown195: 0x85 0x3E (0x21 0x40) [10:23:06][I][jk_bms_ble:467]: Cell info frame (version 3, 300 bytes) received
I tried to auto-detect the new frame structure (now called JK02_32S
) in the past but it has turned out the auto-detection isn't perfect and fails every now and then. This is the cause why I aim to remove the auto-detection in future and let the user choose the correct protocol version.
It looks like your BMS (software version 11+) is auto-detected properly as JK02_32S
. So it's safe to pin the protocol version to avoid the auto detection.
Are the links to text files good for posting here, or is it better if I copy and paste the actual text into the reply boxes here on github? I'm not too experienced with github / programming so want to be sure i'm posting things in the preferred format...
The attachments are perfectly fine! Please ignore the Unknown: ...
bytes. They are printed just for debugging purposes. You could reduce the log level to INFO
now to get rid of these debug ([D]
) messages.
Your device is a JK02_32S
for sure. Your logs are looking good to me.
Great thanks! Consider updating the supported / tested models list - I dont think the BD4A8S4P was on there when I checked yesterday.
I have a few other models of BMS's available for testing if interested... I have B2A20S20P, BD6A20S10P, and B1A20S15P
I'm happy about your feedback! I will add your device soon and improve the warning. It looks like there are more BMS models using software version 11 with the new protocol version next to the B2A8S20P.
-----new question about a different esp board and different bms's different from the above messages-----
I have one ESP32-WROOM that is connecting to two JK BMSs, B2A20S20P and BD6A20S10P.
I get the "You hit the unstable auto detection of the protocol version. This feature will be removed in future!Please update your configuration to protocol version JK02_32S if you are using a JK-B2A8S20P v11+" warning in the logs for this one too. Do I need to go ahead and update the protocol on this one?
I am connecting to two different model bms on one esp chip, im not sure which one is causing the warning message, or both. And not sure whats different with jk-2_32s. What do you recommend?
Please start with a single BMS setup / single BLE client connection and update the MAC address per test. As soon you know which protocol version to use you could flash your multiple BLE client connection configuration.
If the protocol version doesn't fit the temperature sensor will be probably zero and the total voltage won't match.
The difference between JK02
and JK02_32S
is the number of bytes reserved for cell voltages and resistance. The cell info frame of both protocol versions is 300 bytes long / has a fixed size. At the JK02
protocol version 24 cells are supported because there are 224 bytes reserved for cell voltages and 224 bytes reserved for resistances. At the JK02_32S
there are 2232 bytes reserved for cell voltages + resistances. This leads to a different offsets.
Got it, I'll do some testing and post the results, thanks!
I have a few other models of BMS's available for testing if interested... I have B2A20S20P, BD6A20S10P, and B1A20S15P
Is your offer still valid?
Yep, what would you like me to do?
Please collect the MAC addresses of your devices. Flash a ESP32 with this YAML
https://github.com/syssi/esphome-jk-bms/blob/main/esp32-ble-example.yaml
make sure you are able to enabled/disable the discharging mosfet using the switch entity and provide the software and hardware version per device.
JK-B1A20S15P works well using jk02 protocol. Hardware Ver: V10.XW Software Ver: V10.10 Manuf Date: 2023-04-16 Version: V4.10.1
I just notice the manuf date is today... I wonder if this is because today is the first day its ever been powered on? I bought it a few months back and just wired it up today...
Attached is a log file that you can review.
one bit that may be worth review:
[22:49:54][D][sensor:127]: 'jk-bms-3 charging cycles': Sending state 0.00000 with 0 decimals of accuracy [22:49:54][D][sensor:127]: 'jk-bms-3 total charging cycle capacity': Sending state 0.10400 Ah with 3 decimals of accuracy [22:49:54][D][jk_bms_ble:647]: Unknown158: 0x64 0x00 (always 0x64 0x00?) [22:49:54][D][jk_bms_ble:650]: Unknown160: 0x9D 0x05 (always 0xC5 0x09?) [22:49:54][D][sensor:127]: 'jk-bms-3 total runtime': Sending state 19897.00000 s with 0 decimals of accuracy [22:49:54][D][text_sensor:067]: 'jk-bms-3 total runtime formatted': Sending state '5h' [22:49:54][D][jk_bms_ble:663]: Unknown168: 5B.06.00.00.00.00.00.00.00.00.00.00.00.00.07.00.01.00.00.00.C7.03.00.00.00.00.A9.76.42.40.00.00.00.00.E2.04.00.00.00.00.00.01.00.05.00.00 (46) [22:49:54][D][jk_bms_ble:677]: Unknown189: 0x03 0x00 [22:49:54][D][jk_bms_ble:681]: Unknown192: 0x00 [22:49:55][D][api:102]: Accepted 192.168.7.43 [22:49:56][D][api.connection:920]: Home Assistant 2023.4.2 (192.168.7.43): Connected successfully [22:49:59][I][jk_bms_ble:467]: Cell info frame (version 2, 300 bytes) received [22:49:59][D][sensor:127]: 'jk-bms-3 cell voltage 1': Sending state 3.32800 V with 3 decimals of accuracy [22:49:59][D][sensor:127]: 'jk-bms-3 cell resistance 1': Sending state 0.06100 Ω with 3 decimals of accuracy
Edit: And yes, both the charge and discharge switches work
Thanks for testing! I've extended the list of supported devices. Thanks for providing the unknown bytes. These details could be helpful in future.
Manuf Date: 2023-04-16
You are right! This is the date of the first power on. I don't know it's a new feature (and written by the Android app) or it has always been like this.
[jk_bms_ble:454]: You hit the unstable auto detection of the protocol version. This feature will be removed in future!Please update your configuration to protocol version JK02_32S if you are using a JK-B2A8S20P v11+
I am getting that message in the logs. I am running a JK_BD4A8S4P, should I be concerned?