Skip to content

Conversation

@RondaYummy
Copy link

In my opinion, the bytes should have been in this order, given their length. Is that right?

| 226-227 | 2 | Temperature Sensor 3 | int16 | 0.1 | °C | - |
| 186-187 | 2 | Emergency time countdown | uint16 | 1 | s | >0 = Emergency active |
| 70-73 | 4 | Enabled cells bitmask | Raw | - | - | 0xFF 0xFF 0xFF 0xFF = 32 cells |
| 74-137 | 64 | Cell resistances 1-32 | uint16 | 0.001 | Ohm | 2 bytes per cell |
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| 74-137 | 64 | Cell resistances 1-32 | uint16 | 0.001 | Ohm | 2 bytes per cell |
| 80-143 | 64 | Cell resistances 1-32 | uint16 | 0.001 | Ohm | 2 bytes per cell |
# i=0...31
float cell_resistance = (float) jk_get_16bit(i * 2 + 64 + 16) * 0.001f;

| 186-187 | 2 | Emergency time countdown | uint16 | 1 | s | >0 = Emergency active |
| 70-73 | 4 | Enabled cells bitmask | Raw | - | - | 0xFF 0xFF 0xFF 0xFF = 32 cells |
| 74-137 | 64 | Cell resistances 1-32 | uint16 | 0.001 | Ohm | 2 bytes per cell |
| 138-139 | 2 | Power tube temperature | int16 | 0.1 | °C | - |
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| 138-139 | 2 | Power tube temperature | int16 | 0.1 | °C | - |
| 144-145 | 2 | Power tube temperature | int16 | 0.1 | °C | - |
this->publish_state_(this->power_tube_temperature_sensor_, (float) ((int16_t) jk_get_16bit(112 + 32)) * 0.1f);

| 140-143 | 4 | Wire resistance warning bitmask | Raw | - | - | 1 bit per cell/wire |
| 144-147 | 4 | Battery voltage | uint32 | 0.001 | V | - |
| 148-151 | 4 | Battery power | uint32 | 0.001 | W | - |
| 152-155 | 4 | Charge current | int32 | 0.001 | A | - |
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| 152-155 | 4 | Charge current | int32 | 0.001 | A | - |
| 158-161 | 4 | Charge current | int32 | 0.001 | A | - |
this->publish_state_(this->current_sensor_, (float) ((int32_t) jk_get_32bit(126 + 32)) * 0.001f);

@syssi
Copy link
Owner

syssi commented Feb 11, 2025

Your interpretation of the cell info frame (protocol version JK02_32S) isn't correct too. Could you give it another try?

@RondaYummy
Copy link
Author

RondaYummy commented Feb 11, 2025

I don't understand why these indices don't work for me, but if you just add +32, it works for me.

For example:
power_tube_temp = int.from_bytes(data[112+32:114+32], byteorder='little', signed=True) * 0.1 battery_voltage = int.from_bytes(data[118+32:122+32], byteorder='little', signed=True) * 0.001 battery_power = int.from_bytes(data[122+32:126+32], byteorder='little', signed=True) * 0.001 charge_current = int.from_bytes(data[126+32:130+32], byteorder='little', signed=True) * 0.001 temperature_sensor_1 = int.from_bytes(data[130+32:132+32], byteorder='little', signed=True) * 0.1 temperature_sensor_2 = int.from_bytes(data[132+32:134+32], byteorder='little', signed=True) * 0.1 state_of_charge = data[141+32] remaining_capacity = int.from_bytes(data[142+32:146+32], byteorder='little') * 0.001 nominal_capacity = int.from_bytes(data[146+32:150+32], byteorder='little') * 0.001 cycle_count = int.from_bytes(data[150+32:154+32], byteorder='little') total_cycle_capacity = int.from_bytes(data[154+32:157+32], byteorder='little') * 0.001 state_of_health = data[158+32] charging_status = data[166+32] discharging_status = data[167+32] precharging_status = data[168+32] temperature_sensor_5 = int.from_bytes(data[222+32:224+32], byteorder='little', signed=True) * 0.1 temperature_sensor_4 = int.from_bytes(data[224+32:226+32], byteorder='little', signed=True) * 0.1 temperature_sensor_3 = int.from_bytes(data[226+32:228+32], byteorder='little', signed=True) * 0.1 emergency_time_countdown = int.from_bytes(data[186+32:187+32], byteorder='little')

    But apparently, these indices do not coincide with those that should have been, and those that are correct do not work for me and produce data that is not at all expected. I must be missing something...

@syssi
Copy link
Owner

syssi commented Feb 11, 2025

Which hardware/software version do you own?

@RondaYummy
Copy link
Author

JK_BD6A20S6P, hw 17U, sw 17.02
JK_BD6A17S6P, hw 11.XA, sw 11.48

@syssi
Copy link
Owner

syssi commented Feb 11, 2025

Hmm... there is the risk the payload has changed a bit between V11 and V17. Could you provide a cell info frame per hardware version?

@RondaYummy
Copy link
Author

Yes, I will provide it a little later. However, the parsing shows identical data on all versions

@RondaYummy
Copy link
Author

JK_BD6A20S6P, hw 17U, sw 17.02:
55aaeb9002fbe40fe60fe80fe90fe90fe60fe70fe70fe80fe80fe80fe60f00000000000000000000000000000000000000000000000000000000000000000000000000000000ff0f0000e80f060004009300930092008f008e008f008f008f00920092009200940000000000000000000000000000000000000000000000000000000000000000000000000000000000770000000000dcbe0000000000000000000073007400000008000000005c6d8b0100b0ad010006000000b3290b0064000000f5dc5f0001010000000000000000000000000000ff0001000000e803000000008b8d3f40000000001613000000000001030700004c07090000000000770030f830f8e80321e70000200000008051010000010100000000000000000000feff7fdc2f0109810b000000ef

JK_BD6A17S6P, hw 11.XA, sw 11.48:
55aaeb9002dae70feb0feb0feb0feb0feb0feb0feb0feb0feb0feb0fe90f00000000000000000000000000000000000000000000000000000000000000000000000000000000ff0f0000ea0f040001009b009c009800960098009900980098009b009a0098009b00000000000000000000000000000000000000000000000000000000000000000000000000000000007d0000000000fabe000000000000000000006f00740000000800000000597f800100b0ad010014000000c9a7210064000000f9de5f0001010000000000000000000000000000ff0001000000b503000000002a883e40000000001913000000010001000600005b070900000000007d0000000000b503817401001b0000008051010000000000000000000000000000feff7fdc0f01088003000000ec

@RondaYummy
Copy link
Author

I also have a small question: why can devices send Setting Info even when I haven't sent a command to receive it? Can you tell me why?

@syssi
Copy link
Owner

syssi commented Feb 13, 2025

I don't know. This project isn't affected by the mentioned issue.

@RondaYummy
Copy link
Author

And how do you deal with the fact that you get Setting Info & Cell info at the same time, the device will beep whenever I ask for both, which is quite uncomfortable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants