syssi / esphome-jk-bms

ESPHome component to monitor and control a Jikong Battery Management System (JK-BMS) via UART-TTL or BLE

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JK BMS B2A20S20P Heat CAN/RS485 problem with connection

Tesla72PL opened this issue · comments

Hello, I uploaded the following code for ESP8266 D1 mini and unfortunately nothing works - what am I doing wrong?

substitutions:
  name: jk-bms
  device_description: "Monitor a JK-BMS via UART-TTL"
  external_components_source: github://syssi/esphome-jk-bms@main
  tx_pin: GPIO1
  rx_pin: GPIO3

esphome:
  name: ${name}
  comment: ${device_description}
  project:
    name: "syssi.esphome-jk-bms"
    version: 1.4.0

esp8266:
  board: d1_mini

external_components:
  - source: ${external_components_source}
    refresh: 0s

api:
  encryption:
    key: "..."

ota:
  password: "..."

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Jk-Battery-01-Info"
    password: "..."

logger:
  baud_rate: 0
  level: DEBUG

# If you use Home Assistant please remove this `mqtt` section and uncomment the `api` component!
# The native API has many advantages over MQTT: https://esphome.io/components/api.html#advantages-over-mqtt

uart:
  - id: uart0
    baud_rate: 115200
    rx_buffer_size: 384
    tx_pin: ${tx_pin}
    rx_pin: ${rx_pin}
    debug:
     direction: BOTH

jk_modbus:
  - id: modbus0
    uart_id: uart0
    rx_timeout: 50ms

jk_bms:
  - id: bms0
    jk_modbus_id: modbus0
    update_interval: 5s

binary_sensor:
  - platform: jk_bms
    balancing:
      name: "${name} balancing"
    balancing_switch:
      name: "${name} balancing switch"
    charging:
      name: "${name} charging"
    charging_switch:
      name: "${name} charging switch"
    discharging:
      name: "${name} discharging"
    discharging_switch:
      name: "${name} discharging switch"
    dedicated_charger_switch:
      name: "${name} dedicated charger switch"
    online_status:
      name: "${name} online status"

sensor:
  - platform: jk_bms
    min_cell_voltage:
      name: "${name} min cell voltage"
    max_cell_voltage:
      name: "${name} max cell voltage"
    min_voltage_cell:
      name: "${name} min voltage cell"
    max_voltage_cell:
      name: "${name} max voltage cell"
    delta_cell_voltage:
      name: "${name} delta cell voltage"
    average_cell_voltage:
      name: "${name} average cell voltage"
    cell_voltage_1:
      name: "${name} cell voltage 1"
    cell_voltage_2:
      name: "${name} cell voltage 2"
    cell_voltage_3:
      name: "${name} cell voltage 3"
    cell_voltage_4:
      name: "${name} cell voltage 4"
    cell_voltage_5:
      name: "${name} cell voltage 5"
    cell_voltage_6:
      name: "${name} cell voltage 6"
    cell_voltage_7:
      name: "${name} cell voltage 7"
    cell_voltage_8:
      name: "${name} cell voltage 8"
    cell_voltage_9:
      name: "${name} cell voltage 9"
    cell_voltage_10:
      name: "${name} cell voltage 10"
    cell_voltage_11:
      name: "${name} cell voltage 11"
    cell_voltage_12:
      name: "${name} cell voltage 12"
    cell_voltage_13:
      name: "${name} cell voltage 13"
    cell_voltage_14:
      name: "${name} cell voltage 14"
    cell_voltage_15:
      name: "${name} cell voltage 15"
    cell_voltage_16:
      name: "${name} cell voltage 16"
    cell_voltage_17:
      name: "${name} cell voltage 17"
    cell_voltage_18:
      name: "${name} cell voltage 18"
    cell_voltage_19:
      name: "${name} cell voltage 19"
    cell_voltage_20:
      name: "${name} cell voltage 20"
    cell_voltage_21:
      name: "${name} cell voltage 21"
    cell_voltage_22:
      name: "${name} cell voltage 22"
    cell_voltage_23:
      name: "${name} cell voltage 23"
    cell_voltage_24:
      name: "${name} cell voltage 24"
    power_tube_temperature:
      name: "${name} power tube temperature"
    temperature_sensor_1:
      name: "${name} temperature sensor 1"
    temperature_sensor_2:
      name: "${name} temperature sensor 2"
    total_voltage:
      name: "${name} total voltage"
    current:
      name: "${name} current"
    power:
      name: "${name} power"
    charging_power:
      name: "${name} charging power"
    discharging_power:
      name: "${name} discharging power"
    capacity_remaining:
      name: "${name} capacity remaining"
    capacity_remaining_derived:
      name: "${name} capacity remaining derived"
    temperature_sensors:
      name: "${name} temperature sensors"
    charging_cycles:
      name: "${name} charging cycles"
    total_charging_cycle_capacity:
      name: "${name} total charging cycle capacity"
    battery_strings:
      name: "${name} battery strings"
    errors_bitmask:
      name: "${name} errors bitmask"
    operation_mode_bitmask:
      name: "${name} operation mode bitmask"
    total_voltage_overvoltage_protection:
      name: "${name} total voltage overvoltage protection"
    total_voltage_undervoltage_protection:
      name: "${name} total voltage undervoltage protection"
    cell_voltage_overvoltage_protection:
      name: "${name} cell voltage overvoltage protection"
    cell_voltage_overvoltage_recovery:
      name: "${name} cell voltage overvoltage recovery"
    cell_voltage_overvoltage_delay:
      name: "${name} cell voltage overvoltage delay"
    cell_voltage_undervoltage_protection:
      name: "${name} cell voltage undervoltage protection"
    cell_voltage_undervoltage_recovery:
      name: "${name} cell voltage undervoltage recovery"
    cell_voltage_undervoltage_delay:
      name: "${name} cell voltage undervoltage delay"
    cell_pressure_difference_protection:
      name: "${name} cell pressure difference protection"
    discharging_overcurrent_protection:
      name: "${name} discharging overcurrent protection"
    discharging_overcurrent_delay:
      name: "${name} discharging overcurrent delay"
    charging_overcurrent_protection:
      name: "${name} charging overcurrent protection"
    charging_overcurrent_delay:
      name: "${name} charging overcurrent delay"
    balance_starting_voltage:
      name: "${name} balance starting voltage"
    balance_opening_pressure_difference:
      name: "${name} balance opening pressure difference"
    power_tube_temperature_protection:
      name: "${name} power tube temperature protection"
    power_tube_temperature_recovery:
      name: "${name} power tube temperature recovery"
    temperature_sensor_temperature_protection:
      name: "${name} temperature sensor temperature protection"
    temperature_sensor_temperature_recovery:
      name: "${name} temperature sensor temperature recovery"
    temperature_sensor_temperature_difference_protection:
      name: "${name} temperature sensor temperature difference protection"
    charging_high_temperature_protection:
      name: "${name} charging high temperature protection"
    discharging_high_temperature_protection:
      name: "${name} discharging high temperature protection"
    charging_low_temperature_protection:
      name: "${name} charging low temperature protection"
    charging_low_temperature_recovery:
      name: "${name} charging low temperature recovery"
    discharging_low_temperature_protection:
      name: "${name} discharging low temperature protection"
    discharging_low_temperature_recovery:
      name: "${name} discharging low temperature recovery"
    total_battery_capacity_setting:
      name: "${name} total battery capacity setting"
    current_calibration:
      name: "${name} current calibration"
    device_address:
      name: "${name} device address"
    sleep_wait_time:
      name: "${name} sleep wait time"
    alarm_low_volume:
      name: "${name} alarm low volume"
    manufacturing_date:
      name: "${name} manufacturing date"
    total_runtime:
      name: "${name} total runtime"
#    start_current_calibration:
#      name: "${name} start current calibration"
    actual_battery_capacity:
      name: "${name} actual battery capacity"
#    protocol_version:
#      name: "${name} protocol version"

text_sensor:
  - platform: jk_bms
    errors:
      name: "${name} errors"
    operation_mode:
      name: "${name} operation mode"
    battery_type:
      name: "${name} battery type"
    password:
      name: "${name} password"
    device_type:
      name: "${name} device type"
    software_version:
      name: "${name} software version"
    manufacturer:
      name: "${name} manufacturer"
    total_runtime_formatted:
      name: "${name} total runtime formatted"

Please check the controls tab of the Android app.Do you see here a switch to choose between CAN and RS485?

I have setting rs485, wires is connect to esp rx->tx and tx>rx and ground like on your photo in readme.
Screenshot_2023-04-17-23-53-01-05_bd59be8c3f820c1e3d6fc2892aab342d

Where did you buy the BMS?

Hankzor
I wonder if this rs485 port is working, because perhaps it is damaged, and I do not know how to check it.

Esp8266 works after loading a file directly from the computer, it connects to wi-fi.
Then I check if there is a connection via wi-fi after disconnecting from the computer and without connecting to the RS485 port of the bms - it continues to connect properly.
When I connect to the bms, once there something happens and it stops working and no longer connects via wi-fi....

Good question. In general your setup should work:

  1. Your wiring sounds correct
  2. You are using the hardware UART of an ESP8266 + the logger doesn't write to GPIO1/3 because of baud_rate: 0
  3. You did enable the RS485 switch. This switch is new and wasn't available in the past.

Could you enable the debug mode of the uart component and provide some logs:

logger:
  baud_rate: 0
  level: DEBUG

uart:
  id: uart0
  baud_rate: 115200
  rx_buffer_size: 384
  tx_pin: ${tx_pin}
  rx_pin: ${rx_pin}
  debug:
    direction: BOTH

I would like to know there is no response at all or noise.

When I connect to the bms, once there something happens and it stops working and no longer connects via wi-fi....

That's not good! How do you power the ESP?

When I connect to the bms, once there something happens and it stops working and no longer connects via wi-fi....

That's not good! How do you power the ESP?

By usb type c connect 5V

Do you mean a USB power plug? I would like to make sure you don't power the ESP using the battery + buck converter.

Do you mean a USB power plug? I would like to make sure you don't power the ESP using the battery + buck converter.

Yes with usb plug, i know in other case i must power with 3,3V

Good question. In general your setup should work:

  1. Your wiring sounds correct
  2. You are using the hardware UART of an ESP8266 + the logger doesn't write to GPIO1/3 because of baud_rate: 0
  3. You did enable the RS485 switch. This switch is new and wasn't available in the past.

Could you enable the debug mode of the uart component and provide some logs:

logger:
  baud_rate: 0
  level: DEBUG

uart:
  id: uart0
  baud_rate: 115200
  rx_buffer_size: 384
  tx_pin: ${tx_pin}
  rx_pin: ${rx_pin}
  debug:
    direction: BOTH

I would like to know there is no response at all or noise.

Ok, when i come back from work i try it 👍🏼

logs_jk-battery-01-info_logs_without_connect_bms.txt
logs_jk-battery-01-info_logs_with_bms.txt
jk-battery-01-info.yaml.txt

When Esp is connect with bms by wire i cant install .

logs_jk-battery-01-info_run.txt

I have to disconnect the cable to do anything

and very often i have after re-conect to bms something it:

logs_jk-battery-01-info_logs.txt
IMG_20230418_180432

Your wiring looks good but the labels of your BMS are confusing. My left port is labeled as "CAN". The right port is labeled as GPS/RS485. May be the hardware layout has changed?!

Rather not, the CAN/RS485 port on the left is a secondary port. I think it's most likely, however, that the default port is broken, so probably nothing will be done here, and I don't have the money to buy another bms, so thanks anyway for showing interest....
Sa8cb128d46b6425e848ec323975a9606k

from HANZKOR I also received this document - maybe it will be useful to you, for me it is dark magic
485.pdf

I know the protocol description. It's the implemented protocol for the UART-TTL connection.

Could you do some measurements? I would like a complete documentation of your issue here.

  1. Please measure the voltage between
    GND <-> RX
    GND <-> TX
    GND <-> VBAT
  2. Please measure the resistance between
    GND <-> RX
    GND <-> TX

Take measurements resistance on the device on or off?

the voltage when BMS was turn on
GND <-> RX 3,31V
GND <-> TX 3,32V
GND <-> VBAT50,21V
the resistance when BMS was turn on
GND <-> RX 95,48 ohm
GND <-> TX 0,00 ohm

the resistance when BMS was turn off
GND <-> RX 6,19 kohm
GND <-> TX 3,11 Mohm

commented

It is also the GPS port for my bms.
Did you try other GPIOs on the ESP?

I order new BMS and we wil know all 😉

Hi,

i have a JK-BD6A20S10P. This works fine with the Bluetooth module.

I know wanted to connect it through RS485 also. I got stuck at the same Point. Connecting it to the "GPS" Port with the jst Connector but no Communication.

Mine looks the same as the above picture shows, but i don't have the settings in the APP (CAN/RS485).

When i connect everything my ESP still produces LOG files, so i guess it doesn't hang up like yours.

I will try some more things, including Voltage and resistance Measurements, but any idea is welcomed!

Waiting for your test's with your newly orderd BMS.

kind Regards
Max

@maxsarges Please provide the software and hardware version of your BMS too. I guess the CAN/RS485 switch is available since firmware version 11.

Hi,

I have Version 10, maybe thats the reason why i don't have the Button.

I have also checked for an App Update, but i have latest one.

Screenshot_20230429-214649.png

OK, I bought and instal JK-B1a20s15p, and i have now this error on the end

INFO Reading configuration /config/esphome/jk-bms.yaml...
INFO Updating https://github.com/syssi/esphome-jk-bms.git@main
INFO Starting log output from jk-bms.local using esphome API
INFO Successfully connected to jk-bms.local
[19:10:21][I][app:102]: ESPHome version 2023.4.3 compiled on May  2 2023, 19:02:08
[19:10:21][I][app:104]: Project syssi.esphome-jk-bms version 1.4.0
[19:10:21][C][wifi:505]: WiFi:
[19:10:21][C][wifi:363]:   Local MAC: 08:3A:8D:CC:CC:FA
[19:10:21][C][wifi:364]:   SSID: [redacted]
[19:10:21][C][wifi:365]:   IP Address: 192.168.0.106
[19:10:21][C][wifi:366]:   BSSID: [redacted]
[19:10:21][C][wifi:368]:   Hostname: 'jk-bms'
[19:10:21][C][wifi:370]:   Signal strength: -37 dB ▂▄▆█
[19:10:21][C][wifi:374]:   Channel: 10
[19:10:21][C][wifi:375]:   Subnet: 255.255.255.0
[19:10:21][C][wifi:376]:   Gateway: 192.168.0.1
[19:10:21][C][wifi:377]:   DNS1: 192.168.0.1
[19:10:21][C][wifi:378]:   DNS2: 0.0.0.0
[19:10:21][C][logger:294]: Logger:
[19:10:21][C][logger:295]:   Level: DEBUG
[19:10:21][C][logger:296]:   Log Baud Rate: 0
[19:10:21][C][logger:297]:   Hardware UART: UART0
[19:10:21][C][uart.arduino_esp8266:102]: UART Bus:
[19:10:21][C][uart.arduino_esp8266:103]:   TX Pin: GPIO1
[19:10:21][C][uart.arduino_esp8266:104]:   RX Pin: GPIO3
[19:10:21][C][uart.arduino_esp8266:106]:   RX Buffer Size: 384
[19:10:21][C][uart.arduino_esp8266:108]:   Baud Rate: 115200 baud
[19:10:21][C][uart.arduino_esp8266:109]:   Data Bits: 8
[19:10:21][C][uart.arduino_esp8266:110]:   Parity: NONE
[19:10:21][C][uart.arduino_esp8266:111]:   Stop bits: 1
[19:10:21][C][uart.arduino_esp8266:113]:   Using hardware serial interface.
[19:10:21][C][jk_modbus:097]: JkModbus:
[19:10:21][C][jk_modbus:098]:   RX timeout: 50 ms
[19:10:21][C][jk_bms:578]: JkBms:
[19:10:21][C][jk_bms:579]:   Address: 0x4E
[19:10:21][C][jk_bms:580]:   Fake traffic enabled: NO
[19:10:21][C][jk_bms:581]: Minimum Cell Voltage 'jk-bms min cell voltage'
[19:10:21][C][jk_bms:581]:   Device Class: 'voltage'
[19:10:21][C][jk_bms:581]:   State Class: 'measurement'
[19:10:21][C][jk_bms:581]:   Unit of Measurement: 'V'
[19:10:21][C][jk_bms:581]:   Accuracy Decimals: 3
[19:10:21][C][jk_bms:582]: Maximum Cell Voltage 'jk-bms max cell voltage'
[19:10:21][C][jk_bms:582]:   Device Class: 'voltage'
[19:10:21][C][jk_bms:582]:   State Class: 'measurement'
[19:10:21][C][jk_bms:582]:   Unit of Measurement: 'V'
[19:10:21][C][jk_bms:582]:   Accuracy Decimals: 3
[19:10:21][C][jk_bms:583]: Minimum Voltage Cell 'jk-bms min voltage cell'
[19:10:21][C][jk_bms:583]:   State Class: 'measurement'
[19:10:21][C][jk_bms:583]:   Unit of Measurement: ''
[19:10:21][C][jk_bms:583]:   Accuracy Decimals: 0
[19:10:21][C][jk_bms:583]:   Icon: 'mdi:battery-minus-outline'
[19:10:21][C][jk_bms:584]: Maximum Voltage Cell 'jk-bms max voltage cell'
[19:10:21][C][jk_bms:584]:   State Class: 'measurement'
[19:10:21][C][jk_bms:584]:   Unit of Measurement: ''
[19:10:21][C][jk_bms:584]:   Accuracy Decimals: 0
[19:10:21][C][jk_bms:584]:   Icon: 'mdi:battery-plus-outline'
[19:10:21][C][jk_bms:585]: Delta Cell Voltage 'jk-bms delta cell voltage'
[19:10:21][C][jk_bms:585]:   Device Class: 'voltage'
[19:10:21][C][jk_bms:585]:   State Class: 'measurement'
[19:10:21][C][jk_bms:585]:   Unit of Measurement: 'V'
[19:10:21][C][jk_bms:585]:   Accuracy Decimals: 3
[19:10:21][C][jk_bms:586]: Average Cell Voltage 'jk-bms average cell voltage'
[19:10:21][C][jk_bms:586]:   Device Class: 'voltage'
[19:10:21][C][jk_bms:586]:   State Class: 'measurement'
[19:10:21][C][jk_bms:586]:   Unit of Measurement: 'V'
[19:10:21][C][jk_bms:586]:   Accuracy Decimals: 3
[19:10:21][C][jk_bms:587]: Cell Voltage 1 'jk-bms cell voltage 1'
[19:10:21][C][jk_bms:587]:   Device Class: 'voltage'
[19:10:21][C][jk_bms:590]:   Accuracy Decimals: 3
[19:10:21][C][jk_bms:591]: Cell Voltage 5 'jk-bms cell voltage 5'
[19:10:21][C][jk_bms:591]:   Device Class: 'voltage'
[19:10:21][C][jk_bms:591]:   State Class: 'measurement'
[19:10:21][C][jk_bms:591]:   Unit of Measurement: 'V'
[19:10:21][C][jk_bms:591]:   Accuracy Decimals: 3
[19:10:21][C][jk_bms:592]: Cell Voltage 6 'jk-bms cell voltage 6'
[19:10:21][C][jk_bms:592]:   Device Class: 'voltage'
[19:10:21][C][jk_bms:592]:   State Class: 'measurement'
[19:10:21][C][jk_bms:592]:   Unit of Measurement: 'V'
[19:10:21][C][jk_bms:592]:   Accuracy Decimals: 3
[19:10:21][C][jk_bms:593]: Cell Voltage 7 'jk-bms cell voltage 7'
[19:10:21][C][jk_bms:593]:   Device Class: 'voltage'
[19:10:21][C][jk_bms:593]:   State Class: 'measurement'
[19:10:21][C][jk_bms:593]:   Unit of Measurement: 'V'
[19:10:21][C][jk_bms:593]:   Accuracy Decimals: 3
[19:10:21][C][jk_bms:594]: Cell Voltage 8 'jk-bms cell voltage 8'
[19:10:21][C][jk_bms:594]:   Device Class: 'voltage'
[19:10:21][C][jk_bms:594]:   State Class: 'measurement'
[19:10:21][C][jk_bms:594]:   Unit of Measurement: 'V'
[19:10:21][C][jk_bms:594]:   Accuracy Decimals: 3
[19:10:21][C][jk_bms:595]: Cell Voltage 9 'jk-bms cell voltage 9'
[19:10:21][C][jk_bms:595]:   Device Class: 'voltage'
[19:10:21][C][jk_bms:595]:   State Class: 'measurement'
[19:10:21][C][jk_bms:595]:   Unit of Measurement: 'V'
[19:10:21][C][jk_bms:595]:   Accuracy Decimals: 3
[19:10:21][C][jk_bms:596]: Cell Voltage 10 'jk-bms cell voltage 10'
[19:10:21][C][jk_bms:596]:   Device Class: 'voltage'
[19:10:21][C][jk_bms:596]:   State Class: 'measurement'
[19:10:21][C][jk_bms:596]:   Unit of Measurement: 'V'
[19:10:21][C][jk_bms:596]:   Accuracy Decimals: 3
[19:10:21][C][jk_bms:597]: Cell Voltage 11 'jk-bms cell voltage 11'
[19:10:21][C][jk_bms:597]:   Device Class: 'voltage'
[19:10:21][C][jk_bms:597]:   State Class: 'measurement'
[19:10:21][C][jk_bms:597]:   Unit of Measurement: 'V'
[19:10:21][C][jk_bms:597]:   Accuracy Decimals: 3
[19:10:21][C][jk_bms:600]:   Device Class: 'voltage'
[19:10:21][C][jk_bms:600]:   State Class: 'measurement'
[19:10:21][C][jk_bms:600]:   Unit of Measurement: 'V'
[19:10:21][C][jk_bms:600]:   Accuracy Decimals: 3
[19:10:21][C][jk_bms:601]: Cell Voltage 15 'jk-bms cell voltage 15'
[19:10:21][C][jk_bms:601]:   Device Class: 'voltage'
[19:10:21][C][jk_bms:601]:   State Class: 'measurement'
[19:10:21][C][jk_bms:601]:   Unit of Measurement: 'V'
[19:10:21][C][jk_bms:601]:   Accuracy Decimals: 3
[19:10:21][C][jk_bms:602]: Cell Voltage 16 'jk-bms cell voltage 16'
[19:10:21][C][jk_bms:602]:   Device Class: 'voltage'
[19:10:21][C][jk_bms:602]:   State Class: 'measurement'
[19:10:21][C][jk_bms:602]:   Unit of Measurement: 'V'
[19:10:21][C][jk_bms:602]:   Accuracy Decimals: 3
[19:10:21][C][jk_bms:603]: Cell Voltage 17 'jk-bms cell voltage 17'
[19:10:21][C][jk_bms:603]:   Device Class: 'voltage'
[19:10:21][C][jk_bms:603]:   State Class: 'measurement'
[19:10:21][C][jk_bms:603]:   Unit of Measurement: 'V'
[19:10:21][C][jk_bms:603]:   Accuracy Decimals: 3
[19:10:21][C][jk_bms:604]: Cell Voltage 18 'jk-bms cell voltage 18'
[19:10:21][C][jk_bms:604]:   Device Class: 'voltage'
[19:10:21][C][jk_bms:604]:   State Class: 'measurement'
[19:10:21][C][jk_bms:604]:   Unit of Measurement: 'V'
[19:10:21][C][jk_bms:604]:   Accuracy Decimals: 3
[19:10:21][C][jk_bms:605]: Cell Voltage 19 'jk-bms cell voltage 19'
[19:10:21][C][jk_bms:605]:   Device Class: 'voltage'
[19:10:21][C][jk_bms:605]:   State Class: 'measurement'
[19:10:21][C][jk_bms:605]:   Unit of Measurement: 'V'
[19:10:21][C][jk_bms:605]:   Accuracy Decimals: 3
[19:10:21][C][jk_bms:606]: Cell Voltage 20 'jk-bms cell voltage 20'
[19:10:21][C][jk_bms:606]:   Device Class: 'voltage'
[19:10:21][C][jk_bms:606]:   State Class: 'measurement'
[19:10:21][C][jk_bms:606]:   Unit of Measurement: 'V'
[19:10:21][C][jk_bms:606]:   Accuracy Decimals: 3
[19:10:21][C][jk_bms:607]: Cell Voltage 21 'jk-bms cell voltage 21'
[19:10:21][C][jk_bms:609]:   Unit of Measurement: 'V'
[19:10:21][C][jk_bms:609]:   Accuracy Decimals: 3
[19:10:21][C][jk_bms:610]: Cell Voltage 24 'jk-bms cell voltage 24'
[19:10:21][C][jk_bms:610]:   Device Class: 'voltage'
[19:10:21][C][jk_bms:610]:   State Class: 'measurement'
[19:10:21][C][jk_bms:610]:   Unit of Measurement: 'V'
[19:10:21][C][jk_bms:610]:   Accuracy Decimals: 3
[19:10:21][C][jk_bms:611]: Power Tube Temperature 'jk-bms power tube temperature'
[19:10:21][C][jk_bms:611]:   Device Class: 'temperature'
[19:10:21][C][jk_bms:611]:   State Class: 'measurement'
[19:10:21][C][jk_bms:611]:   Unit of Measurement: '°C'
[19:10:21][C][jk_bms:611]:   Accuracy Decimals: 0
[19:10:21][C][jk_bms:612]: Temperature Sensor 1 'jk-bms temperature sensor 1'
[19:10:21][C][jk_bms:612]:   Device Class: 'temperature'
[19:10:21][C][jk_bms:612]:   State Class: 'measurement'
[19:10:21][C][jk_bms:612]:   Unit of Measurement: '°C'
[19:10:21][C][jk_bms:612]:   Accuracy Decimals: 0
[19:10:21][C][jk_bms:613]: Temperature Sensor 2 'jk-bms temperature sensor 2'
[19:10:21][C][jk_bms:613]:   Device Class: 'temperature'
[19:10:21][C][jk_bms:613]:   State Class: 'measurement'
[19:10:21][C][jk_bms:613]:   Unit of Measurement: '°C'
[19:10:21][C][jk_bms:613]:   Accuracy Decimals: 0
[19:10:21][C][jk_bms:614]: Total Voltage 'jk-bms total voltage'
[19:10:21][C][jk_bms:614]:   Device Class: 'voltage'
[19:10:21][C][jk_bms:614]:   State Class: 'measurement'
[19:10:21][C][jk_bms:614]:   Unit of Measurement: 'V'
[19:10:21][C][jk_bms:614]:   Accuracy Decimals: 2
[19:10:21][C][jk_bms:615]: Current 'jk-bms current'
[19:10:21][C][jk_bms:615]:   Device Class: 'current'
[19:10:21][C][jk_bms:615]:   State Class: 'measurement'
[19:10:21][C][jk_bms:615]:   Unit of Measurement: 'A'
[19:10:21][C][jk_bms:615]:   Accuracy Decimals: 2
[19:10:21][C][jk_bms:615]:   Icon: 'mdi:current-dc'
[19:10:21][C][jk_bms:616]: Power 'jk-bms power'
[19:10:21][C][jk_bms:616]:   Device Class: 'power'
[19:10:21][C][jk_bms:618]:   Device Class: 'power'
[19:10:21][C][jk_bms:618]:   State Class: 'measurement'
[19:10:21][C][jk_bms:618]:   Unit of Measurement: 'W'
[19:10:21][C][jk_bms:618]:   Accuracy Decimals: 2
[19:10:21][C][jk_bms:619]: Capacity Remaining 'jk-bms capacity remaining'
[19:10:21][C][jk_bms:619]:   State Class: 'measurement'
[19:10:21][C][jk_bms:619]:   Unit of Measurement: '%'
[19:10:21][C][jk_bms:619]:   Accuracy Decimals: 0
[19:10:21][C][jk_bms:619]:   Icon: 'mdi:battery-50'
[19:10:21][C][jk_bms:620]: Capacity Remaining Derived 'jk-bms capacity remaining derived'
[19:10:21][C][jk_bms:620]:   State Class: 'measurement'
[19:10:21][C][jk_bms:620]:   Unit of Measurement: 'Ah'
[19:10:21][C][jk_bms:620]:   Accuracy Decimals: 0
[19:10:21][C][jk_bms:620]:   Icon: 'mdi:battery-50'
[19:10:21][C][jk_bms:621]: Temperature Sensors 'jk-bms temperature sensors'
[19:10:21][C][jk_bms:621]:   State Class: 'measurement'
[19:10:21][C][jk_bms:621]:   Unit of Measurement: ''
[19:10:21][C][jk_bms:621]:   Accuracy Decimals: 0
[19:10:21][C][jk_bms:622]: Charging Cycles 'jk-bms charging cycles'
[19:10:21][C][jk_bms:622]:   State Class: 'measurement'
[19:10:21][C][jk_bms:622]:   Unit of Measurement: ''
[19:10:21][C][jk_bms:622]:   Accuracy Decimals: 0
[19:10:21][C][jk_bms:622]:   Icon: 'mdi:battery-sync'
[19:10:21][C][jk_bms:623]: Total Charging Cycle Capacity 'jk-bms total charging cycle capacity'
[19:10:21][C][jk_bms:623]:   State Class: 'measurement'
[19:10:21][C][jk_bms:623]:   Unit of Measurement: 'Ah'
[19:10:21][C][jk_bms:623]:   Accuracy Decimals: 0
[19:10:21][C][jk_bms:623]:   Icon: 'mdi:counter'
[19:10:21][C][jk_bms:624]: Battery Strings 'jk-bms battery strings'
[19:10:21][C][jk_bms:624]:   State Class: 'measurement'
[19:10:21][C][jk_bms:624]:   Unit of Measurement: ''
[19:10:21][C][jk_bms:624]:   Accuracy Decimals: 0
[19:10:21][C][jk_bms:624]:   Icon: 'mdi:car-battery'
[19:10:21][C][jk_bms:625]: Errors Bitmask 'jk-bms errors bitmask'
[19:10:21][C][jk_bms:625]:   Icon: 'mdi:alert-circle-outline'
[19:10:21][C][jk_bms:626]: Operation Mode Bitmask 'jk-bms operation mode bitmask'
[19:10:21][C][jk_bms:626]:   State Class: 'measurement'
[19:10:21][C][jk_bms:626]:   Unit of Measurement: ''
[19:10:21][C][jk_bms:626]:   Accuracy Decimals: 0
[19:10:21][C][jk_bms:626]:   Icon: 'mdi:heart-pulse'
[19:10:21][C][jk_bms:627]: Total Voltage Overvoltage Protection 'jk-bms total voltage overvoltage protection'
[19:10:21][C][jk_bms:627]:   Device Class: 'voltage'
[19:10:21][C][jk_bms:627]:   State Class: 'measurement'
[19:10:21][C][jk_bms:627]:   Unit of Measurement: 'V'
[19:10:21][C][jk_bms:627]:   Accuracy Decimals: 2
[19:10:21][C][jk_bms:628]: Total Voltage Undervoltage Protection 'jk-bms total voltage undervoltage protection'
[19:10:21][C][jk_bms:628]:   Device Class: 'voltage'
[19:10:21][C][jk_bms:628]:   State Class: 'measurement'
[19:10:21][C][jk_bms:628]:   Unit of Measurement: 'V'
[19:10:21][C][jk_bms:628]:   Accuracy Decimals: 2
[19:10:21][C][jk_bms:629]: Cell Voltage Overvoltage Protection 'jk-bms cell voltage overvoltage protection'
[19:10:21][C][jk_bms:629]:   Device Class: 'voltage'
[19:10:21][C][jk_bms:629]:   State Class: 'measurement'
[19:10:21][C][jk_bms:629]:   Unit of Measurement: 'V'
[19:10:21][C][jk_bms:629]:   Accuracy Decimals: 3
[19:10:21][C][jk_bms:630]: Cell Voltage Overvoltage Recovery 'jk-bms cell voltage overvoltage recovery'
[19:10:21][C][jk_bms:630]:   Device Class: 'voltage'
[19:10:21][C][jk_bms:630]:   State Class: 'measurement'
[19:10:21][C][jk_bms:630]:   Unit of Measurement: 'V'
[19:10:21][C][jk_bms:630]:   Accuracy Decimals: 3
[19:10:21][C][jk_bms:631]: Cell Voltage Overvoltage Delay 'jk-bms cell voltage overvoltage delay'
[19:10:21][C][jk_bms:631]:   State Class: 'measurement'
[19:10:21][C][jk_bms:631]:   Unit of Measurement: 's'
[19:10:21][C][jk_bms:631]:   Accuracy Decimals: 0
[19:10:21][C][jk_bms:631]:   Icon: 'mdi:timelapse'
[19:10:21][C][jk_bms:632]: Cell Voltage Undervoltage Protection 'jk-bms cell voltage undervoltage protection'
[19:10:21][C][jk_bms:633]: Cell Voltage Undervoltage Recovery 'jk-bms cell voltage undervoltage recovery'
[19:10:21][C][jk_bms:633]:   Device Class: 'voltage'
[19:10:21][C][jk_bms:633]:   State Class: 'measurement'
[19:10:21][C][jk_bms:633]:   Unit of Measurement: 'V'
[19:10:21][C][jk_bms:633]:   Accuracy Decimals: 3
[19:10:21][C][jk_bms:634]: Cell Voltage Undervoltage Delay 'jk-bms cell voltage undervoltage delay'
[19:10:21][C][jk_bms:634]:   State Class: 'measurement'
[19:10:21][C][jk_bms:634]:   Unit of Measurement: 's'
[19:10:21][C][jk_bms:634]:   Accuracy Decimals: 0
[19:10:21][C][jk_bms:634]:   Icon: 'mdi:timelapse'
[19:10:21][C][jk_bms:635]: Cell Pressure Difference Protection 'jk-bms cell pressure difference protection'
[19:10:21][C][jk_bms:635]:   Device Class: 'voltage'
[19:10:21][C][jk_bms:635]:   State Class: 'measurement'
[19:10:21][C][jk_bms:635]:   Unit of Measurement: 'V'
[19:10:21][C][jk_bms:635]:   Accuracy Decimals: 3
[19:10:21][C][jk_bms:636]: Discharging Overcurrent Protection 'jk-bms discharging overcurrent protection'
[19:10:21][C][jk_bms:636]:   Device Class: 'current'
[19:10:21][C][jk_bms:636]:   State Class: 'measurement'
[19:10:21][C][jk_bms:636]:   Unit of Measurement: 'A'
[19:10:21][C][jk_bms:636]:   Accuracy Decimals: 0
[19:10:21][C][jk_bms:636]:   Icon: 'mdi:current-dc'
[19:10:21][C][jk_bms:637]: Discharging Overcurrent Delay 'jk-bms discharging overcurrent delay'
[19:10:21][C][jk_bms:637]:   State Class: 'measurement'
[19:10:21][C][jk_bms:637]:   Unit of Measurement: 's'
[19:10:21][C][jk_bms:637]:   Accuracy Decimals: 0
[19:10:21][C][jk_bms:637]:   Icon: 'mdi:timelapse'
[19:10:21][C][jk_bms:638]: Charging Overcurrent Protection 'jk-bms charging overcurrent protection'
[19:10:21][C][jk_bms:638]:   Device Class: 'current'
[19:10:21][C][jk_bms:638]:   State Class: 'measurement'
[19:10:21][C][jk_bms:638]:   Unit of Measurement: 'A'
[19:10:21][C][jk_bms:638]:   Accuracy Decimals: 0
[19:10:21][C][jk_bms:638]:   Icon: 'mdi:current-dc'
[19:10:21][C][jk_bms:639]: Charging Overcurrent Delay 'jk-bms charging overcurrent delay'
[19:10:21][C][jk_bms:641]: Balance Opening Pressure Difference 'jk-bms balance opening pressure difference'
[19:10:21][C][jk_bms:641]:   Device Class: 'voltage'
[19:10:21][C][jk_bms:641]:   State Class: 'measurement'
[19:10:21][C][jk_bms:641]:   Unit of Measurement: 'V'
[19:10:21][C][jk_bms:641]:   Accuracy Decimals: 3
[19:10:21][C][jk_bms:642]: Power Tube Temperature Protection 'jk-bms power tube temperature protection'
[19:10:21][C][jk_bms:642]:   Device Class: 'temperature'
[19:10:21][C][jk_bms:642]:   State Class: 'measurement'
[19:10:21][C][jk_bms:642]:   Unit of Measurement: '°C'
[19:10:21][C][jk_bms:642]:   Accuracy Decimals: 0
[19:10:21][C][jk_bms:643]: Power Tube Temperature Recovery 'jk-bms power tube temperature recovery'
[19:10:21][C][jk_bms:643]:   Device Class: 'temperature'
[19:10:21][C][jk_bms:643]:   State Class: 'measurement'
[19:10:21][C][jk_bms:643]:   Unit of Measurement: '°C'
[19:10:21][C][jk_bms:643]:   Accuracy Decimals: 0
[19:10:21][C][jk_bms:644]: Temperature Sensor Temperature Protection 'jk-bms temperature sensor temperature protection'
[19:10:21][C][jk_bms:644]:   Device Class: 'temperature'
[19:10:21][C][jk_bms:644]:   State Class: 'measurement'
[19:10:21][C][jk_bms:644]:   Unit of Measurement: '°C'
[19:10:21][C][jk_bms:644]:   Accuracy Decimals: 0
[19:10:21][C][jk_bms:645]: Temperature Sensor Temperature Recovery 'jk-bms temperature sensor temperature recovery'
[19:10:21][C][jk_bms:645]:   Device Class: 'temperature'
[19:10:21][C][jk_bms:645]:   State Class: 'measurement'
[19:10:21][C][jk_bms:645]:   Unit of Measurement: '°C'
[19:10:21][C][jk_bms:645]:   Accuracy Decimals: 0
[19:10:21][C][jk_bms:646]: Temperature Sensor Temperature Difference Protection 'jk-bms temperature sensor temperature difference protection'
[19:10:21][C][jk_bms:646]:   Device Class: 'temperature'
[19:10:21][C][jk_bms:646]:   State Class: 'measurement'
[19:10:21][C][jk_bms:646]:   Unit of Measurement: '°C'
[19:10:21][C][jk_bms:646]:   Accuracy Decimals: 0
[19:10:21][C][jk_bms:648]: Charging High Temperature Protection 'jk-bms charging high temperature protection'
[19:10:21][C][jk_bms:648]:   Accuracy Decimals: 0
[19:10:21][C][jk_bms:649]: Discharging High Temperature Protection 'jk-bms discharging high temperature protection'
[19:10:21][C][jk_bms:649]:   Device Class: 'temperature'
[19:10:21][C][jk_bms:649]:   State Class: 'measurement'
[19:10:21][C][jk_bms:649]:   Unit of Measurement: '°C'
[19:10:21][C][jk_bms:649]:   Accuracy Decimals: 0
[19:10:21][C][jk_bms:650]: Charging Low Temperature Protection 'jk-bms charging low temperature protection'
[19:10:21][C][jk_bms:650]:   Device Class: 'temperature'
[19:10:21][C][jk_bms:650]:   State Class: 'measurement'
[19:10:21][C][jk_bms:650]:   Unit of Measurement: '°C'
[19:10:21][C][jk_bms:650]:   Accuracy Decimals: 0
[19:10:21][C][jk_bms:651]: Charging Low Temperature Recovery 'jk-bms charging low temperature recovery'
[19:10:21][C][jk_bms:651]:   Device Class: 'temperature'
[19:10:21][C][jk_bms:651]:   State Class: 'measurement'
[19:10:21][C][jk_bms:651]:   Unit of Measurement: '°C'
[19:10:21][C][jk_bms:651]:   Accuracy Decimals: 0
[19:10:21][C][jk_bms:652]: Discharging Low Temperature Protection 'jk-bms discharging low temperature protection'
[19:10:21][C][jk_bms:652]:   Device Class: 'temperature'
[19:10:21][C][jk_bms:652]:   State Class: 'measurement'
[19:10:21][C][jk_bms:652]:   Unit of Measurement: '°C'
[19:10:21][C][jk_bms:652]:   Accuracy Decimals: 0
[19:10:21][C][jk_bms:653]: Discharging Low Temperature Recovery 'jk-bms discharging low temperature recovery'
[19:10:21][C][jk_bms:653]:   Device Class: 'temperature'
[19:10:21][C][jk_bms:653]:   State Class: 'measurement'
[19:10:21][C][jk_bms:653]:   Unit of Measurement: '°C'
[19:10:21][C][jk_bms:653]:   Accuracy Decimals: 0
[19:10:21][C][jk_bms:654]: Total Battery Capacity Setting 'jk-bms total battery capacity setting'
[19:10:21][C][jk_bms:654]:   State Class: 'measurement'
[19:10:21][C][jk_bms:654]:   Unit of Measurement: 'Ah'
[19:10:21][C][jk_bms:654]:   Accuracy Decimals: 0
[19:10:21][C][jk_bms:654]:   Icon: 'mdi:battery-sync'
[19:10:21][C][jk_bms:659]:   State Class: 'measurement'
[19:10:21][C][jk_bms:659]:   Unit of Measurement: '%'
[19:10:21][C][jk_bms:659]:   Accuracy Decimals: 0
[19:10:21][C][jk_bms:659]:   Icon: 'mdi:volume-high'
[19:10:21][C][jk_bms:660]: Password 'jk-bms password'
[19:10:21][C][jk_bms:660]:   Icon: 'mdi:lock-outline'
[19:10:21][C][jk_bms:661]: Device Type 'jk-bms device type'
[19:10:21][C][jk_bms:662]: Manufacturing Date 'jk-bms manufacturing date'
[19:10:21][C][jk_bms:662]:   State Class: 'measurement'
[19:10:21][C][jk_bms:662]:   Unit of Measurement: ''
[19:10:21][C][jk_bms:662]:   Accuracy Decimals: 0
[19:10:21][C][jk_bms:663]: Total Runtime 'jk-bms total runtime'
[19:10:21][C][jk_bms:663]:   State Class: 'total_increasing'
[19:10:21][C][jk_bms:663]:   Unit of Measurement: 'h'
[19:10:21][C][jk_bms:663]:   Accuracy Decimals: 0
[19:10:21][C][jk_bms:663]:   Icon: 'mdi:timelapse'
[19:10:21][C][jk_bms:664]: Software Version 'jk-bms software version'
[19:10:21][C][jk_bms:666]: Manufacturer 'jk-bms manufacturer'
[19:10:21][C][jk_bms:668]: Balancing 'jk-bms balancing'
[19:10:21][C][jk_bms:669]: Balancing Switch 'jk-bms balancing switch'
[19:10:21][C][jk_bms:670]: Charging 'jk-bms charging'
[19:10:21][C][jk_bms:671]: Charging Switch 'jk-bms charging switch'
[19:10:21][C][jk_bms:672]: Discharging 'jk-bms discharging'
[19:10:21][C][jk_bms:673]: Discharging Switch 'jk-bms discharging switch'
[19:10:21][C][jk_bms:674]: Dedicated Charger Switch 'jk-bms dedicated charger switch'
[19:10:21][C][jk_bms:675]: Total Runtime Formatted 'jk-bms total runtime formatted'
[19:10:21][C][jk_bms:675]:   Icon: 'mdi:timelapse'
[19:10:21][C][mdns:108]: mDNS:
[19:10:21][C][mdns:109]:   Hostname: jk-bms
[19:10:21][C][ota:093]: Over-The-Air Updates:
[19:10:21][C][ota:094]:   Address: jk-bms.local:8266
[19:10:21][C][ota:097]:   Using Password.
[19:10:21][C][api:138]: API Server:
[19:10:21][C][api:139]:   Address: jk-bms.local:6053
[19:10:21][C][api:141]:   Using noise encryption: YES
[19:10:52][W][jk_modbus:050]: Invalid header
[19:11:07][W][jk_modbus:050]: Invalid header
[19:12:12][W][jk_modbus:050]: Invalid header

my ESP code:

substitutions:
  name: "jk-bms"
  device_description: "Monitor a JK-BMS via UART-TTL"
  external_components_source: github://syssi/esphome-jk-bms@main
  tx_pin: GPIO1
  rx_pin: GPIO3

esphome:
  name: ${name}
  comment: ${device_description}
  project:
    name: "syssi.esphome-jk-bms"
    version: 1.4.0

esp8266:
  board: d1_mini

external_components:
  - source: ${external_components_source}
    refresh: 0s

logger:
  baud_rate: 0
  level: DEBUG

api:
  encryption:
    key: "****"

ota:
  password: "****"

wifi:
  ssid: !secret wifi_ssid_1
  password: !secret wifi_password_1

  ap:
    ssid: "Jk-Battery-01-Info"
    password: "******"

uart:
  - id: uart_0
    baud_rate: 115200
    rx_buffer_size: 384
    tx_pin: ${tx_pin}
    rx_pin: ${rx_pin}

jk_modbus:
  - id: modbus0
    uart_id: uart_0
    rx_timeout: 50ms

jk_bms:
  - id: bms0
    jk_modbus_id: modbus0
    update_interval: 5s

binary_sensor:
  - platform: jk_bms
    balancing:
      name: "${name} balancing"
    balancing_switch:
      name: "${name} balancing switch"
    charging:
      name: "${name} charging"
    charging_switch:
      name: "${name} charging switch"
    discharging:
      name: "${name} discharging"
    discharging_switch:
      name: "${name} discharging switch"
    dedicated_charger_switch:
      name: "${name} dedicated charger switch"
    online_status:
      name: "${name} online status"

sensor:
  - platform: jk_bms
    min_cell_voltage:
      name: "${name} min cell voltage"
    max_cell_voltage:
      name: "${name} max cell voltage"
    min_voltage_cell:
      name: "${name} min voltage cell"
    max_voltage_cell:
      name: "${name} max voltage cell"
    delta_cell_voltage:
      name: "${name} delta cell voltage"
    average_cell_voltage:
      name: "${name} average cell voltage"
    cell_voltage_1:
      name: "${name} cell voltage 1"
    cell_voltage_2:
      name: "${name} cell voltage 2"
    cell_voltage_3:
      name: "${name} cell voltage 3"
    cell_voltage_4:
      name: "${name} cell voltage 4"
    cell_voltage_5:
      name: "${name} cell voltage 5"
    cell_voltage_6:
      name: "${name} cell voltage 6"
    cell_voltage_7:
      name: "${name} cell voltage 7"
    cell_voltage_8:
      name: "${name} cell voltage 8"
    cell_voltage_9:
      name: "${name} cell voltage 9"
    cell_voltage_10:
      name: "${name} cell voltage 10"
    cell_voltage_11:
      name: "${name} cell voltage 11"
    cell_voltage_12:
      name: "${name} cell voltage 12"
    cell_voltage_13:
      name: "${name} cell voltage 13"
    cell_voltage_14:
      name: "${name} cell voltage 14"
    cell_voltage_15:
      name: "${name} cell voltage 15"
    cell_voltage_16:
      name: "${name} cell voltage 16"
    cell_voltage_17:
      name: "${name} cell voltage 17"
    cell_voltage_18:
      name: "${name} cell voltage 18"
    cell_voltage_19:
      name: "${name} cell voltage 19"
    cell_voltage_20:
      name: "${name} cell voltage 20"
    cell_voltage_21:
      name: "${name} cell voltage 21"
    cell_voltage_22:
      name: "${name} cell voltage 22"
    cell_voltage_23:
      name: "${name} cell voltage 23"
    cell_voltage_24:
      name: "${name} cell voltage 24"
    power_tube_temperature:
      name: "${name} power tube temperature"
    temperature_sensor_1:
      name: "${name} temperature sensor 1"
    temperature_sensor_2:
      name: "${name} temperature sensor 2"
    total_voltage:
      name: "${name} total voltage"
    current:
      name: "${name} current"
    power:
      name: "${name} power"
    charging_power:
      name: "${name} charging power"
    discharging_power:
      name: "${name} discharging power"
    capacity_remaining:
      name: "${name} capacity remaining"
    capacity_remaining_derived:
      name: "${name} capacity remaining derived"
    temperature_sensors:
      name: "${name} temperature sensors"
    charging_cycles:
      name: "${name} charging cycles"
    total_charging_cycle_capacity:
      name: "${name} total charging cycle capacity"
    battery_strings:
      name: "${name} battery strings"
    errors_bitmask:
      name: "${name} errors bitmask"
    operation_mode_bitmask:
      name: "${name} operation mode bitmask"
    total_voltage_overvoltage_protection:
      name: "${name} total voltage overvoltage protection"
    total_voltage_undervoltage_protection:
      name: "${name} total voltage undervoltage protection"
    cell_voltage_overvoltage_protection:
      name: "${name} cell voltage overvoltage protection"
    cell_voltage_overvoltage_recovery:
      name: "${name} cell voltage overvoltage recovery"
    cell_voltage_overvoltage_delay:
      name: "${name} cell voltage overvoltage delay"
    cell_voltage_undervoltage_protection:
      name: "${name} cell voltage undervoltage protection"
    cell_voltage_undervoltage_recovery:
      name: "${name} cell voltage undervoltage recovery"
    cell_voltage_undervoltage_delay:
      name: "${name} cell voltage undervoltage delay"
    cell_pressure_difference_protection:
      name: "${name} cell pressure difference protection"
    discharging_overcurrent_protection:
      name: "${name} discharging overcurrent protection"
    discharging_overcurrent_delay:
      name: "${name} discharging overcurrent delay"
    charging_overcurrent_protection:
      name: "${name} charging overcurrent protection"
    charging_overcurrent_delay:
      name: "${name} charging overcurrent delay"
    balance_starting_voltage:
      name: "${name} balance starting voltage"
    balance_opening_pressure_difference:
      name: "${name} balance opening pressure difference"
    power_tube_temperature_protection:
      name: "${name} power tube temperature protection"
    power_tube_temperature_recovery:
      name: "${name} power tube temperature recovery"
    temperature_sensor_temperature_protection:
      name: "${name} temperature sensor temperature protection"
    temperature_sensor_temperature_recovery:
      name: "${name} temperature sensor temperature recovery"
    temperature_sensor_temperature_difference_protection:
      name: "${name} temperature sensor temperature difference protection"
    charging_high_temperature_protection:
      name: "${name} charging high temperature protection"
    discharging_high_temperature_protection:
      name: "${name} discharging high temperature protection"
    charging_low_temperature_protection:
      name: "${name} charging low temperature protection"
    charging_low_temperature_recovery:
      name: "${name} charging low temperature recovery"
    discharging_low_temperature_protection:
      name: "${name} discharging low temperature protection"
    discharging_low_temperature_recovery:
      name: "${name} discharging low temperature recovery"
    total_battery_capacity_setting:
      name: "${name} total battery capacity setting"
    current_calibration:
      name: "${name} current calibration"
    device_address:
      name: "${name} device address"
    sleep_wait_time:
      name: "${name} sleep wait time"
    alarm_low_volume:
      name: "${name} alarm low volume"
    manufacturing_date:
      name: "${name} manufacturing date"
    total_runtime:
      name: "${name} total runtime"
#    start_current_calibration:
#      name: "${name} start current calibration"
    actual_battery_capacity:
      name: "${name} actual battery capacity"
#    protocol_version:
#      name: "${name} protocol version"

text_sensor:
  - platform: jk_bms
    errors:
      name: "${name} errors"
    operation_mode:
      name: "${name} operation mode"
    battery_type:
      name: "${name} battery type"
    password:
      name: "${name} password"
    device_type:
      name: "${name} device type"
    software_version:
      name: "${name} software version"
    manufacturer:
      name: "${name} manufacturer"
    total_runtime_formatted:
      name: "${name} total runtime formatted"

Please enable the debug output of the uart component:

https://github.com/syssi/esphome-jk-bms#debugging

[20:58:27][C][mdns:109]:   Hostname: jk-bms
[20:58:27][C][ota:093]: Over-The-Air Updates:
[20:58:27][C][ota:094]:   Address: jk-bms.local:8266
[20:58:27][C][ota:097]:   Using Password.
[20:58:27][D][uart_debug:114]: >>> 4E:57:00:13:00:00:00:00:06:03:00:00:00:00:00:00:68:00:00:01:29
[20:58:27][C][api:138]: API Server:
[20:58:27][C][api:139]:   Address: jk-bms.local:6053
[20:58:27][C][api:141]:   Using noise encryption: YES
[20:58:31][D][binary_sensor:036]: 'jk-bms online status': Sending state OFF
[20:58:31][D][text_sensor:064]: 'jk-bms errors': Sending state 'Offline'
[20:58:31][D][sensor:109]: 'jk-bms min cell voltage': Sending state nan V with 3 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms max cell voltage': Sending state nan V with 3 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms min voltage cell': Sending state nan  with 0 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms max voltage cell': Sending state nan  with 0 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms delta cell voltage': Sending state nan V with 3 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms average cell voltage': Sending state nan V with 3 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms power tube temperature': Sending state nan °C with 0 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms temperature sensor 1': Sending state nan °C with 0 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms temperature sensor 2': Sending state nan °C with 0 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms total voltage': Sending state nan V with 2 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms current': Sending state nan A with 2 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms power': Sending state nan W with 2 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms charging power': Sending state nan W with 2 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms discharging power': Sending state nan W with 2 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms capacity remaining': Sending state nan % with 0 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms capacity remaining derived': Sending state nan Ah with 0 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms temperature sensors': Sending state nan  with 0 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms charging cycles': Sending state nan  with 0 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms total charging cycle capacity': Sending state nan Ah with 0 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms battery strings': Sending state nan  with 0 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms errors bitmask': Sending state nan  with 0 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms operation mode bitmask': Sending state nan  with 0 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms total voltage overvoltage protection': Sending state nan V with 2 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms total voltage undervoltage protection': Sending state nan V with 2 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms cell voltage overvoltage protection': Sending state nan V with 3 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms cell voltage overvoltage recovery': Sending state nan V with 3 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms cell voltage overvoltage delay': Sending state nan s with 0 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms cell voltage undervoltage protection': Sending state nan V with 3 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms cell voltage undervoltage recovery': Sending state nan V with 3 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms cell voltage undervoltage delay': Sending state nan s with 0 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms cell pressure difference protection': Sending state nan V with 3 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms discharging overcurrent protection': Sending state nan A with 0 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms discharging overcurrent delay': Sending state nan s with 0 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms charging overcurrent protection': Sending state nan A with 0 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms charging overcurrent delay': Sending state nan s with 0 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms balance starting voltage': Sending state nan V with 3 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms balance opening pressure difference': Sending state nan V with 3 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms power tube temperature protection': Sending state nan °C with 0 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms power tube temperature recovery': Sending state nan °C with 0 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms temperature sensor temperature protection': Sending state nan °C with 0 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms temperature sensor temperature recovery': Sending state nan °C with 0 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms temperature sensor temperature difference protection': Sending state nan °C with 0 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms charging high temperature protection': Sending state nan °C with 0 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms discharging high temperature protection': Sending state nan °C with 0 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms charging low temperature protection': Sending state nan °C with 0 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms charging low temperature recovery': Sending state nan °C with 0 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms discharging low temperature protection': Sending state nan °C with 0 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms discharging low temperature recovery': Sending state nan °C with 0 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms total battery capacity setting': Sending state nan Ah with 0 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms current calibration': Sending state nan A with 3 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms device address': Sending state nan  with 0 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms sleep wait time': Sending state nan s with 0 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms alarm low volume': Sending state nan % with 0 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms manufacturing date': Sending state nan  with 0 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms total runtime': Sending state nan h with 0 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms actual battery capacity': Sending state nan Ah with 0 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms cell voltage 1': Sending state nan V with 3 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms cell voltage 2': Sending state nan V with 3 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms cell voltage 3': Sending state nan V with 3 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms cell voltage 4': Sending state nan V with 3 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms cell voltage 5': Sending state nan V with 3 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms cell voltage 6': Sending state nan V with 3 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms cell voltage 7': Sending state nan V with 3 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms cell voltage 8': Sending state nan V with 3 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms cell voltage 9': Sending state nan V with 3 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms cell voltage 10': Sending state nan V with 3 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms cell voltage 11': Sending state nan V with 3 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms cell voltage 12': Sending state nan V with 3 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms cell voltage 13': Sending state nan V with 3 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms cell voltage 14': Sending state nan V with 3 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms cell voltage 15': Sending state nan V with 3 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms cell voltage 16': Sending state nan V with 3 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms cell voltage 17': Sending state nan V with 3 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms cell voltage 18': Sending state nan V with 3 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms cell voltage 19': Sending state nan V with 3 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms cell voltage 20': Sending state nan V with 3 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms cell voltage 21': Sending state nan V with 3 decimals of accuracy
[20:58:31][D][sensor:109]: 'jk-bms cell voltage 22': Sending state nan V with 3 decimals of accuracy
[20:58:32][D][sensor:109]: 'jk-bms cell voltage 23': Sending state nan V with 3 decimals of accuracy
[20:58:32][D][sensor:109]: 'jk-bms cell voltage 24': Sending state nan V with 3 decimals of accuracy
[20:58:32][D][uart_debug:114]: >>> 4E:57:00:13:00:00:00:00:06:03:00:00:00:00:00:00:68:00:00:01:29
[20:58:35][D][api:102]: Accepted 192.168.0.20
[20:58:35][D][api.connection:961]: Home Assistant 2023.4.6 (192.168.0.20): Connected successfully
[20:58:36][D][uart_debug:114]: >>> 4E:57:00:13:00:00:00:00:06:03:00:00:00:00:00:00:68:00:00:01:29
[20:58:41][D][uart_debug:114]: >>> 4E:57:00:13:00:00:00:00:06:03:00:00:00:00:00:00:68:00:00:01:29
[20:58:46][D][uart_debug:114]: >>> 4E:57:00:13:00:00:00:00:06:03:00:00:00:00:00:00:68:00:00:01:29
[20:58:51][D][uart_debug:114]: >>> 4E:57:00:13:00:00:00:00:06:03:00:00:00:00:00:00:68:00:00:01:29
[20:58:56][D][uart_debug:114]: >>> 4E:57:00:13:00:00:00:00:06:03:00:00:00:00:00:00:68:00:00:01:29
[20:59:01][D][uart_debug:114]: >>> 4E:57:00:13:00:00:00:00:06:03:00:00:00:00:00:00:68:00:00:01:29
[20:59:06][D][uart_debug:114]: >>> 4E:57:00:13:00:00:00:00:06:03:00:00:00:00:00:00:68:00:00:01:29
[20:59:11][D][uart_debug:114]: >>> 4E:57:00:13:00:00:00:00:06:03:00:00:00:00:00:00:68:00:00:01:29
WARNING jk-bms.local: Connection error occurred: [Errno 104] Connection reset by peer
INFO Processing unexpected disconnect from ESPHome API for jk-bms.local
WARNING Disconnected from API
WARNING Can't connect to ESPHome API for jk-bms.local: Error connecting to ('192.168.0.151', 6053): [Errno 113] Connect call failed ('192.168.0.151', 6053)
INFO Trying to reconnect to jk-bms.local in the background
INFO Successfully connected to jk-bms.local
[20:59:51][D][uart_debug:114]: <<< FF
[20:59:56][D][uart_debug:114]: >>> 4E:57:00:13:00:00:00:00:06:03:00:00:00:00:00:00:68:00:00:01:29
[21:00:01][D][uart_debug:114]: >>> 4E:57:00:13:00:00:00:00:06:03:00:00:00:00:00:00:68:00:00:01:29
[21:00:02][D][api:102]: Accepted 192.168.0.20
[21:00:06][D][uart_debug:114]: >>> 4E:57:00:13:00:00:00:00:06:03:00:00:00:00:00:00:68:00:00:01:29
[21:00:11][D][uart_debug:114]: >>> 4E:57:00:13:00:00:00:00:06:03:00:00:00:00:00:00:68:00:00:01:29
[21:00:16][D][uart_debug:114]: >>> 4E:57:00:13:00:00:00:00:06:03:00:00:00:00:00:00:68:00:00:01:29
[21:00:16][W][jk_modbus:050]: Invalid header
[21:00:16][D][uart_debug:114]: <<< FF:FF:FF
[21:00:21][D][uart_debug:114]: >>> 4E:57:00:13:00:00:00:00:06:03:00:00:00:00:00:00:68:00:00:01:29
[21:00:26][D][uart_debug:114]: >>> 4E:57:00:13:00:00:00:00:06:03:00:00:00:00:00:00:68:00:00:01:29
[21:00:31][D][uart_debug:114]: >>> 4E:57:00:13:00:00:00:00:06:03:00:00:00:00:00:00:68:00:00:01:29
[21:00:31][D][uart_debug:114]: <<< FF
[21:00:32][W][api.connection:075]: 192.168.0.20: Socket operation failed: CONNECTION_CLOSED errno=11
[21:00:36][D][uart_debug:114]: >>> 4E:57:00:13:00:00:00:00:06:03:00:00:00:00:00:00:68:00:00:01:29
[21:00:41][D][uart_debug:114]: >>> 4E:57:00:13:00:00:00:00:06:03:00:00:00:00:00:00:68:00:00:01:29
[21:00:46][D][uart_debug:114]: >>> 4E:57:00:13:00:00:00:00:06:03:00:00:00:00:00:00:68:00:00:01:29
[21:00:51][D][uart_debug:114]: >>> 4E:57:00:13:00:00:00:00:06:03:00:00:00:00:00:00:68:00:00:01:29
[21:00:56][D][uart_debug:114]: >>> 4E:57:00:13:00:00:00:00:06:03:00:00:00:00:00:00:68:00:00:01:29
[21:01:01][D][uart_debug:114]: >>> 4E:57:00:13:00:00:00:00:06:03:00:00:00:00:00:00:68:00:00:01:29
[21:01:01][D][uart_debug:114]: <<< FF
[21:01:06][D][uart_debug:114]: >>> 4E:57:00:13:00:00:00:00:06:03:00:00:00:00:00:00:68:00:00:01:29
[21:01:11][D][uart_debug:114]: >>> 4E:57:00:13:00:00:00:00:06:03:00:00:00:00:00:00:68:00:00:01:29
[21:01:16][D][uart_debug:114]: >>> 4E:57:00:13:00:00:00:00:06:03:00:00:00:00:00:00:68:00:00:01:29
[21:01:21][D][uart_debug:114]: >>> 4E:57:00:13:00:00:00:00:06:03:00:00:00:00:00:00:68:00:00:01:29
[21:01:26][D][uart_debug:114]: >>> 4E:57:00:13:00:00:00:00:06:03:00:00:00:00:00:00:68:00:00:01:29
[21:01:26][D][uart_debug:114]: <<< FF
[21:01:31][D][uart_debug:114]: >>> 4E:57:00:13:00:00:00:00:06:03:00:00:00:00:00:00:68:00:00:01:29
[21:01:32][D][api:102]: Accepted 192.168.0.20
[21:01:36][D][uart_debug:114]: >>> 4E:57:00:13:00:00:00:00:06:03:00:00:00:00:00:00:68:00:00:01:29
[21:01:41][D][uart_debug:114]: >>> 4E:57:00:13:00:00:00:00:06:03:00:00:00:00:00:00:68:00:00:01:29
[21:01:46][D][uart_debug:114]: >>> 4E:57:00:13:00:00:00:00:06:03:00:00:00:00:00:00:68:00:00:01:29
[21:01:51][D][uart_debug:114]: >>> 4E:57:00:13:00:00:00:00:06:03:00:00:00:00:00:00:68:00:00:01:29
[21:01:56][D][uart_debug:114]: >>> 4E:57:00:13:00:00:00:00:06:03:00:00:00:00:00:00:68:00:00:01:29
[21:02:01][D][uart_debug:114]: >>> 4E:57:00:13:00:00:00:00:06:03:00:00:00:00:00:00:68:00:00:01:29
[21:02:02][W][api.connection:075]: 192.168.0.20: Socket operation failed: CONNECTION_CLOSED errno=11
[21:02:06][D][uart_debug:114]: >>> 4E:57:00:13:00:00:00:00:06:03:00:00:00:00:00:00:68:00:00:01:29
[21:02:11][D][uart_debug:114]: >>> 4E:57:00:13:00:00:00:00:06:03:00:00:00:00:00:00:68:00:00:01:29
[21:02:16][D][uart_debug:114]: >>> 4E:57:00:13:00:00:00:00:06:03:00:00:00:00:00:00:68:00:00:01:29
[21:02:21][D][uart_debug:114]: >>> 4E:57:00:13:00:00:00:00:06:03:00:00:00:00:00:00:68:00:00:01:29
[21:02:26][D][uart_debug:114]: >>> 4E:57:00:13:00:00:00:00:06:03:00:00:00:00:00:00:68:00:00:01:29

>>> indicates outgoing traffic (the cell info requests).
<<< indicates incoming traffic.

It looks like your new BMS doesn't respond too. The received 0xFF looks like garbage. Please double check your data cable and make sure GND is attached properly and the cable length is less than 10 centimeters.

I dont know why it is not working...
Screenshot_2023-05-02-23-05-55-21_c3a231c25ed346e59462e84656a70e50
1683061617388

I change device to esp32 dev and... WORKING!!!! :) - i dont know why not working with ESP8266...

1683062868351

Does both devices work now?

No, only ESP32 work correctly

My question was about your BMS (first and second one).

Could you tell me the model name, software and hardware version of the working BMS? I would like to extend the docs.

Good job! And happy birthday(?) ;-)

I'll check it out when I swap them again - for now, I'm glad it's started at all

IMG_20230503_094351

Good job! And happy birthday(?) ;-)

Thank you, but birthday of starting device - yes? My english is very weak so sorry 😊

Your screenshot contains a birthday cake at the top. I guessed it's your birthday today. ;-)

Your screenshot contains a birthday cake at the top. I guessed it's your birthday today. ;-)

Ha, ha , ha ok, now I understand - no, thats only reminder - my friend has a birthday :)

Ok, now I'm happy. UI Card work in HA - nice 😊😎

Screenshot_2023-05-03-12-22-26-47_c3a231c25ed346e59462e84656a70e50

Do you mean a USB power plug? I would like to make sure you don't power the ESP using the battery + buck converter.

@syssi, why shouldn’t a buck converter and battery power be used? asking this honestly after I grilled two esp32 and a buck converter 🫣.

@JakobTewes I cannot provide a good answer. I'm a software developer with limited skills in electrical circuits. I'm just aware of users who release magic smoke (destroyed the serial port of the BMS, ESP or buck converter).

commented

Most buck convertes forward full input voltage to output if they fail, so there is that danger already.
In addition they could output voltage spikes if the output capacitor is small. The serial connections are very sensitiv to voltage spikes. Especially those, which can't handle 5V logic level. (ESP, the JK-BMS are both 3.3V)
And if a serial interface get's a spike and grills the controller, usually the controller creates a short after that. -> also kills the buck converter.

So maybe you can avoid this dangers with a big capacitor after the buck converter + zener diodes which limit max voltage in addition. They need to be stronger than the converter, so they don't break if the converter fails. 😁

Hi all,
looking at the new Version 11 from the JK-BMS I got this information:

Hello Torsten,I had talked with factory and our purchase manager again.They said for these two version,they are just different software, the function is the same.As for the two functions you mentioned, the software just reserves them, but they cannot be used. If you need to use it, we need to buy another version from the factory.

So it seems to be the case, that there are no new HW components yet, only the SW is updated.

I have the version with CAN switch to RS485 and I can confirm that it will activate the modebus protocol (as somehow I managed to damage the gps circuit) also I can read some holding registers using an usb adapter, but not all the values are present or I don't know how to read them (only 0-29 works), I'm waiting for a rs485 to ttl adapter to see if I can use it on esp

@lucize Could you provide the pinout of the CAN/RS485 port and a request + response example?

sorry, I'm not good with modebus, for the moment I have this:

can/rs485 | gps
GND - B - A | ....

the temp is negative for my faulty board

modbus

edit:
tried to use rs485 to ttl adapter and seems that no data is coming back (this is a fork to use can adapter on the inverter)
logs_jk-bms_run.txt

I've tried it yesterday many times with different settings, boards and UART's.

But so far no success. Maybe the Board is faulty, but i don't think so.

Maybe it has something to do with GND. Both signals refer to GND of the BMS.

I have for sure connected TX / RX and GND to my ESP32. But maybe the ESP boards differ a little bit. So far this is the only guess i have, but until know i have no solution for that.

Does anybody has another idea what i can do?

Kind regards Max

@maxsarges Could you create a new issue an describe your setup + provide some photos of the wiring? These details are important:

  1. BMS model
  2. Software and hardware version of the BMS
  3. Where did you buy the BMS?
  4. Did you buy the model with or without CAN support?
  5. How do you power your ESP?
  6. Which GPIOs do you use?
commented

Here you go @syssi , mine not working at all too:

BMS model - JK_B2A24S15P
Software and hardware version of the BMS - Hard: V11.XW Soft: V11.25
Where did you buy the BMS? - Hankzor
Did you buy the model with or without CAN support? - With CAN
How do you power your ESP? - USB-C
Which GPIOs do you use? 1/3

Tried also with MAX232 UART-TTL
Port is working good for sure, used it before with other software monitor via usb to serial converter

Code used:
espjk.txt

Log(modbus errors on the end)
logs_jk-bms_logs.txt

1686507543872
IMG_20230611_191635

Tried also with MAX232 UART-TTL

What does this mean? Did you attach the MAX232 to the RS232 port of your computer? I hope you haven't pushed -12/+12V into the UART-TTL port.

Port is working good for sure, used it before with other software monitor via usb to serial converter

@vjlb Could you verify the other software monitor via the serial converter is still working? It's super interesting one software works and the other / this project isn't working.

@vjlb Could you change your YAML to this feature branch + flash the ESP and provide another log? I would like to know some more details about the invalid header warnings:

substitutions:
  external_components_source: github://syssi/esphome-jk-bms@debug-decoder
commented

Tried also with MAX232 UART-TTL

What does this mean? Did you attach the MAX232 to the RS232 port of your computer? I hope you haven't pushed -12/+12V into the UART-TTL port.

Not to PC mate, connected like this:
Sem título

I use same connection on this software to monitor my inverter over MQTT:
https://github.com/softwarecrash/Solar2MQTT

Port is working good for sure, used it before with other software monitor via usb to serial converter

@vjlb Could you verify the other software monitor via the serial converter is still working? It's super interesting one software works and the other / this project isn't working.

That's the one i used before to monitor BMS over USB to Serial, but i prefer the ESP solution over the Raspberry PI:
https://github.com/dj-nitehawk/Hybrid-Inverter-Monitor

Will test the branch you suggested

commented

@vjlb Could you change your YAML to this feature branch + flash the ESP and provide another log? I would like to know some more details about the invalid header warnings:

substitutions:
  external_components_source: github://syssi/esphome-jk-bms@debug-decoder

Is this my bad?
Trying it wirelessly

INFO ESPHome 2023.5.5
INFO Reading configuration /config/esphome/jk-bms.yaml...
INFO Updating https://github.com/syssi/esphome-jk-bms.git@debug-decoder
INFO Generating C++ source...
INFO Compiling app...
Processing jk-bms (board: d1_mini; framework: arduino; platform: platformio/espressif8266@3.2.0)

HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
Dependency Graph
|-- ESP8266WiFi @ 1.0
|-- ESP8266mDNS @ 1.2
Compiling /data/jk-bms/.pioenvs/jk-bms/src/esphome/components/jk_modbus/jk_modbus.cpp.o
Compiling /data/jk-bms/.pioenvs/jk-bms/src/main.cpp.o
In file included from src/esphome/components/uart/uart.h:6,
from src/esphome/components/jk_modbus/jk_modbus.h:4,
from src/esphome/components/jk_modbus/jk_modbus.cpp:1:
src/esphome/components/jk_modbus/jk_modbus.cpp: In member function 'virtual void esphome::jk_modbus::JkModbus::loop()':
src/esphome/components/jk_modbus/jk_modbus.cpp:13:14: error: 'format_hex_pretty' was not declared in this scope
13 | format_hex_pretty(&this->rx_buffer_.front(), this->rx_buffer_.size()).c_str());
| ^~~~~~~~~~~~~~~~~
src/esphome/core/log.h:114:88: note: in definition of macro 'esph_log_w'
114 | esp_log_printf_(ESPHOME_LOG_LEVEL_WARN, tag, LINE, ESPHOME_LOG_FORMAT(format), ##VA_ARGS)
| ^~~~~~~~~~~
src/esphome/components/jk_modbus/jk_modbus.cpp:12:5: note: in expansion of macro 'ESP_LOGW'
12 | ESP_LOGW(TAG, "Buffer cleared due to timeout: %s",
| ^~~~~~~~
src/esphome/components/jk_modbus/jk_modbus.cpp:25:16: error: 'format_hex_pretty' was not declared in this scope
25 | format_hex_pretty(&this->rx_buffer_.front(), this->rx_buffer_.size()).c_str());
| ^~~~~~~~~~~~~~~~~
src/esphome/core/log.h:114:88: note: in definition of macro 'esph_log_w'
114 | esp_log_printf_(ESPHOME_LOG_LEVEL_WARN, tag, LINE, ESPHOME_LOG_FORMAT(format), ##VA_ARGS)
| ^~~~~~~~~~~
src/esphome/components/jk_modbus/jk_modbus.cpp:24:7: note: in expansion of macro 'ESP_LOGW'
24 | ESP_LOGW(TAG, "Buffer cleared due to reset: %s",
| ^~~~~~~~
*** [/data/jk-bms/.pioenvs/jk-bms/src/esphome/components/jk_modbus/jk_modbus.cpp.o] Error 1
========================== [FAILED] Took 2.56 seconds ==========================

I've pushed a probably missing include. Please try again!

Please don't use a MAX232 with a JK-BMS! The high logic level could destroy the opto-couplers / UART-TTL port of the BMS.

commented

Please don't use a MAX232 with a JK-BMS! The high logic level could destroy the opto-couplers / UART-TTL port of the BMS.

Noted!
Will test with other software to make sure it works

commented

Just finished install on RPI, it's working with other monitor software over the same port:
image

Here is the log, very fast outputing those errors BTW:
"Buffer cleared timeout"

logs_jk-bms_logs (1).txt

commented

Looks like sometimes i now get some tiny data, but i lowered the cable lenght

logs_jk-bms_logs (2).txt

This is my code & connect to HA through ESP32 via Bluetooth

`substitutions:
name: jk-bms
device_description: "Monitor and control a JK-BMS v11 via bluetooth"
external_components_source: github://syssi/esphome-jk-bms@main
mac_address: C8:47:8C:ED:1A:2F

Defaults to "JK02" (hardware version >= 6.0 and < 11.0)

Please use "JK02_32S" if you own a new JK-BMS >= hardware version 11.0 (f.e. JK-B2A8S20P hw 11.XW, sw 11.26)

Please use "JK04" if you have some old JK-BMS <= hardware version 3.0 (f.e. JK-B2A16S hw 3.0, sw. 3.3.0)

protocol_version: JK02_32S

esphome:
name: ${name}
comment: ${device_description}
project:
name: "syssi.esphome-jk-bms"
version: 1.5.0

esp32:
board: wemos_d1_mini32
framework:
type: esp-idf

external_components:

  • source: ${external_components_source}
    refresh: 0s

wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password

ota:

logger:
level: DEBUG

If you don't use Home Assistant please remove this api section and uncomment the mqtt component!

api:
encryption:
key: sjN3JULMjM2T90efzTxKXp56Gt/DVqbGoagTtTBHHIo=

mqtt:

broker: !secret mqtt_host

username: !secret mqtt_username

password: !secret mqtt_password

id: mqtt_client

esp32_ble_tracker:
on_ble_advertise:
then:
- lambda: |-
if (x.get_name().rfind("JK-", 0) == 0) {
ESP_LOGI("ble_adv", "New JK-BMS found");
ESP_LOGI("ble_adv", " Name: %s", x.get_name().c_str());
ESP_LOGI("ble_adv", " MAC address: %s", x.address_str().c_str());
ESP_LOGD("ble_adv", " Advertised service UUIDs:");
for (auto uuid : x.get_service_uuids()) {
ESP_LOGD("ble_adv", " - %s", uuid.to_string().c_str());
}
}

ble_client:

  • mac_address: ${mac_address}
    id: client0

jk_bms_ble:

  • ble_client_id: client0
    protocol_version: ${protocol_version}
    throttle: 5s
    id: bms0

binary_sensor:

  • platform: jk_bms_ble
    balancing:
    name: "${name} balancing"
    charging:
    name: "${name} charging"
    discharging:
    name: "${name} discharging"
    online_status:
    name: "${name} online status"

button:

  • platform: jk_bms_ble
    retrieve_settings:
    name: "${name} retrieve settings"
    retrieve_device_info:
    name: "${name} retrieve device info"

number:

  • platform: jk_bms_ble
    jk_bms_ble_id: bms0
    balance_trigger_voltage:
    name: "${name} balance trigger voltage"
    cell_count:
    name: "${name} cell count"
    total_battery_capacity:
    name: "${name} total battery capacity"
    cell_voltage_overvoltage_protection:
    name: "${name} cell voltage overvoltage protection"
    cell_voltage_overvoltage_recovery:
    name: "${name} cell voltage overvoltage recovery"
    cell_voltage_undervoltage_protection:
    name: "${name} cell voltage undervoltage protection"
    cell_voltage_undervoltage_recovery:
    name: "${name} cell voltage undervoltage recovery"
    balance_starting_voltage:
    name: "${name} balance starting voltage"
    voltage_calibration:
    name: "${name} voltage calibration"
    current_calibration:
    name: "${name} current calibration"
    power_off_voltage:
    name: "${name} power off voltage"
    max_balance_current:
    name: "${name} max balance current"
    max_charge_current:
    name: "${name} max charge current"
    max_discharge_current:
    name: "${name} max discharge current"

sensor:

  • platform: jk_bms_ble
    jk_bms_ble_id: bms0
    min_cell_voltage:
    name: "${name} min cell voltage"
    max_cell_voltage:
    name: "${name} max cell voltage"
    min_voltage_cell:
    name: "${name} min voltage cell"
    max_voltage_cell:
    name: "${name} max voltage cell"
    delta_cell_voltage:
    name: "${name} delta cell voltage"
    average_cell_voltage:
    name: "${name} average cell voltage"
    cell_voltage_1:
    name: "${name} cell voltage 1"
    cell_voltage_2:
    name: "${name} cell voltage 2"
    cell_voltage_3:
    name: "${name} cell voltage 3"
    cell_voltage_4:
    name: "${name} cell voltage 4"
    cell_voltage_5:
    name: "${name} cell voltage 5"
    cell_voltage_6:
    name: "${name} cell voltage 6"
    cell_voltage_7:
    name: "${name} cell voltage 7"
    cell_voltage_8:
    name: "${name} cell voltage 8"
    cell_voltage_9:
    name: "${name} cell voltage 9"
    cell_voltage_10:
    name: "${name} cell voltage 10"
    cell_voltage_11:
    name: "${name} cell voltage 11"
    cell_voltage_12:
    name: "${name} cell voltage 12"
    cell_voltage_13:
    name: "${name} cell voltage 13"
    cell_voltage_14:
    name: "${name} cell voltage 14"
    cell_voltage_15:
    name: "${name} cell voltage 15"
    cell_voltage_16:
    name: "${name} cell voltage 16"
    cell_resistance_1:
    name: "${name} cell resistance 1"
    cell_resistance_2:
    name: "${name} cell resistance 2"
    cell_resistance_3:
    name: "${name} cell resistance 3"
    cell_resistance_4:
    name: "${name} cell resistance 4"
    cell_resistance_5:
    name: "${name} cell resistance 5"
    cell_resistance_6:
    name: "${name} cell resistance 6"
    cell_resistance_7:
    name: "${name} cell resistance 7"
    cell_resistance_8:
    name: "${name} cell resistance 8"
    cell_resistance_9:
    name: "${name} cell resistance 9"
    cell_resistance_10:
    name: "${name} cell resistance 10"
    cell_resistance_11:
    name: "${name} cell resistance 11"
    cell_resistance_12:
    name: "${name} cell resistance 12"
    cell_resistance_13:
    name: "${name} cell resistance 13"
    cell_resistance_14:
    name: "${name} cell resistance 14"
    cell_resistance_15:
    name: "${name} cell resistance 15"
    cell_resistance_16:
    name: "${name} cell resistance 16"
    total_voltage:
    name: "${name} total voltage"
    current:
    name: "${name} current"
    power:
    name: "${name} power"
    charging_power:
    name: "${name} charging power"
    discharging_power:
    name: "${name} discharging power"
    temperature_sensor_1:
    name: "${name} temperature sensor 1"
    temperature_sensor_2:
    name: "${name} temperature sensor 2"
    power_tube_temperature:
    name: "${name} power tube temperature"
    state_of_charge:
    name: "${name} state of charge"
    capacity_remaining:
    name: "${name} capacity remaining"
    total_battery_capacity_setting:
    name: "${name} total battery capacity setting"
    charging_cycles:
    name: "${name} charging cycles"
    total_charging_cycle_capacity:
    name: "${name} total charging cycle capacity"
    total_runtime:
    name: "${name} total runtime"
    balancing_current:
    name: "${name} balancing current"
    errors_bitmask:
    name: "${name} errors bitmask"

switch:

  • platform: jk_bms_ble
    charging:
    name: "${name} charging"
    discharging:
    name: "${name} discharging"
    balancer:
    name: "${name} balancer"
    emergency:
    name: "${name} emergency"
    disable_temperature_sensors:
    name: "${name} disable temperature sensors"
    display_always_on:
    name: "${name} display always on"

  • platform: ble_client
    ble_client_id: client0
    name: "${name} enable bluetooth connection"

text_sensor:

  • platform: jk_bms_ble
    errors:
    name: "${name} errors"
    total_runtime_formatted:
    name: "${name} total runtime formatted"`

Untitled

merci je galère depuis 3 jours et j'étais dans le même cas et en Bluetooth ca fonctionne

@JakobTewes I cannot provide a good answer. I'm a software developer with limited skills in electrical circuits. I'm just aware of users who release magic smoke (destroyed the serial port of the BMS, ESP or buck converter).

Can you assist me i have the same issue
how does one upgrade the firmware?

Hello, I uploaded the following code for ESP8266 D1 mini and unfortunately nothing works - what am I doing wrong?

substitutions:
  name: jk-bms
  device_description: "Monitor a JK-BMS via UART-TTL"
  external_components_source: github://syssi/esphome-jk-bms@main
  tx_pin: GPIO1
  rx_pin: GPIO3

esphome:
  name: ${name}
  comment: ${device_description}
  project:
    name: "syssi.esphome-jk-bms"
    version: 1.4.0

esp8266:
  board: d1_mini

external_components:
  - source: ${external_components_source}
    refresh: 0s

api:
  encryption:
    key: "..."

ota:
  password: "..."

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Jk-Battery-01-Info"
    password: "..."

logger:
  baud_rate: 0
  level: DEBUG

# If you use Home Assistant please remove this `mqtt` section and uncomment the `api` component!
# The native API has many advantages over MQTT: https://esphome.io/components/api.html#advantages-over-mqtt

uart:
  - id: uart0
    baud_rate: 115200
    rx_buffer_size: 384
    tx_pin: ${tx_pin}
    rx_pin: ${rx_pin}
    debug:
     direction: BOTH

jk_modbus:
  - id: modbus0
    uart_id: uart0
    rx_timeout: 50ms

jk_bms:
  - id: bms0
    jk_modbus_id: modbus0
    update_interval: 5s

binary_sensor:
  - platform: jk_bms
    balancing:
      name: "${name} balancing"
    balancing_switch:
      name: "${name} balancing switch"
    charging:
      name: "${name} charging"
    charging_switch:
      name: "${name} charging switch"
    discharging:
      name: "${name} discharging"
    discharging_switch:
      name: "${name} discharging switch"
    dedicated_charger_switch:
      name: "${name} dedicated charger switch"
    online_status:
      name: "${name} online status"

sensor:
  - platform: jk_bms
    min_cell_voltage:
      name: "${name} min cell voltage"
    max_cell_voltage:
      name: "${name} max cell voltage"
    min_voltage_cell:
      name: "${name} min voltage cell"
    max_voltage_cell:
      name: "${name} max voltage cell"
    delta_cell_voltage:
      name: "${name} delta cell voltage"
    average_cell_voltage:
      name: "${name} average cell voltage"
    cell_voltage_1:
      name: "${name} cell voltage 1"
    cell_voltage_2:
      name: "${name} cell voltage 2"
    cell_voltage_3:
      name: "${name} cell voltage 3"
    cell_voltage_4:
      name: "${name} cell voltage 4"
    cell_voltage_5:
      name: "${name} cell voltage 5"
    cell_voltage_6:
      name: "${name} cell voltage 6"
    cell_voltage_7:
      name: "${name} cell voltage 7"
    cell_voltage_8:
      name: "${name} cell voltage 8"
    cell_voltage_9:
      name: "${name} cell voltage 9"
    cell_voltage_10:
      name: "${name} cell voltage 10"
    cell_voltage_11:
      name: "${name} cell voltage 11"
    cell_voltage_12:
      name: "${name} cell voltage 12"
    cell_voltage_13:
      name: "${name} cell voltage 13"
    cell_voltage_14:
      name: "${name} cell voltage 14"
    cell_voltage_15:
      name: "${name} cell voltage 15"
    cell_voltage_16:
      name: "${name} cell voltage 16"
    cell_voltage_17:
      name: "${name} cell voltage 17"
    cell_voltage_18:
      name: "${name} cell voltage 18"
    cell_voltage_19:
      name: "${name} cell voltage 19"
    cell_voltage_20:
      name: "${name} cell voltage 20"
    cell_voltage_21:
      name: "${name} cell voltage 21"
    cell_voltage_22:
      name: "${name} cell voltage 22"
    cell_voltage_23:
      name: "${name} cell voltage 23"
    cell_voltage_24:
      name: "${name} cell voltage 24"
    power_tube_temperature:
      name: "${name} power tube temperature"
    temperature_sensor_1:
      name: "${name} temperature sensor 1"
    temperature_sensor_2:
      name: "${name} temperature sensor 2"
    total_voltage:
      name: "${name} total voltage"
    current:
      name: "${name} current"
    power:
      name: "${name} power"
    charging_power:
      name: "${name} charging power"
    discharging_power:
      name: "${name} discharging power"
    capacity_remaining:
      name: "${name} capacity remaining"
    capacity_remaining_derived:
      name: "${name} capacity remaining derived"
    temperature_sensors:
      name: "${name} temperature sensors"
    charging_cycles:
      name: "${name} charging cycles"
    total_charging_cycle_capacity:
      name: "${name} total charging cycle capacity"
    battery_strings:
      name: "${name} battery strings"
    errors_bitmask:
      name: "${name} errors bitmask"
    operation_mode_bitmask:
      name: "${name} operation mode bitmask"
    total_voltage_overvoltage_protection:
      name: "${name} total voltage overvoltage protection"
    total_voltage_undervoltage_protection:
      name: "${name} total voltage undervoltage protection"
    cell_voltage_overvoltage_protection:
      name: "${name} cell voltage overvoltage protection"
    cell_voltage_overvoltage_recovery:
      name: "${name} cell voltage overvoltage recovery"
    cell_voltage_overvoltage_delay:
      name: "${name} cell voltage overvoltage delay"
    cell_voltage_undervoltage_protection:
      name: "${name} cell voltage undervoltage protection"
    cell_voltage_undervoltage_recovery:
      name: "${name} cell voltage undervoltage recovery"
    cell_voltage_undervoltage_delay:
      name: "${name} cell voltage undervoltage delay"
    cell_pressure_difference_protection:
      name: "${name} cell pressure difference protection"
    discharging_overcurrent_protection:
      name: "${name} discharging overcurrent protection"
    discharging_overcurrent_delay:
      name: "${name} discharging overcurrent delay"
    charging_overcurrent_protection:
      name: "${name} charging overcurrent protection"
    charging_overcurrent_delay:
      name: "${name} charging overcurrent delay"
    balance_starting_voltage:
      name: "${name} balance starting voltage"
    balance_opening_pressure_difference:
      name: "${name} balance opening pressure difference"
    power_tube_temperature_protection:
      name: "${name} power tube temperature protection"
    power_tube_temperature_recovery:
      name: "${name} power tube temperature recovery"
    temperature_sensor_temperature_protection:
      name: "${name} temperature sensor temperature protection"
    temperature_sensor_temperature_recovery:
      name: "${name} temperature sensor temperature recovery"
    temperature_sensor_temperature_difference_protection:
      name: "${name} temperature sensor temperature difference protection"
    charging_high_temperature_protection:
      name: "${name} charging high temperature protection"
    discharging_high_temperature_protection:
      name: "${name} discharging high temperature protection"
    charging_low_temperature_protection:
      name: "${name} charging low temperature protection"
    charging_low_temperature_recovery:
      name: "${name} charging low temperature recovery"
    discharging_low_temperature_protection:
      name: "${name} discharging low temperature protection"
    discharging_low_temperature_recovery:
      name: "${name} discharging low temperature recovery"
    total_battery_capacity_setting:
      name: "${name} total battery capacity setting"
    current_calibration:
      name: "${name} current calibration"
    device_address:
      name: "${name} device address"
    sleep_wait_time:
      name: "${name} sleep wait time"
    alarm_low_volume:
      name: "${name} alarm low volume"
    manufacturing_date:
      name: "${name} manufacturing date"
    total_runtime:
      name: "${name} total runtime"
#    start_current_calibration:
#      name: "${name} start current calibration"
    actual_battery_capacity:
      name: "${name} actual battery capacity"
#    protocol_version:
#      name: "${name} protocol version"

text_sensor:
  - platform: jk_bms
    errors:
      name: "${name} errors"
    operation_mode:
      name: "${name} operation mode"
    battery_type:
      name: "${name} battery type"
    password:
      name: "${name} password"
    device_type:
      name: "${name} device type"
    software_version:
      name: "${name} software version"
    manufacturer:
      name: "${name} manufacturer"
    total_runtime_formatted:
      name: "${name} total runtime formatted"

Hi from romania. code for esp32 wemos that is working you can give to me? Thanks.