• Stars
    star
    181
  • Rank 212,110 (Top 5 %)
  • Language
    C++
  • License
    Apache License 2.0
  • Created over 3 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

esphome-jk-bms

GitHub actions GitHub stars GitHub forks GitHub watchers "Buy Me A Coffee"

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

Lovelace entities card

Supported devices

All JK-BMS models with software version >=6.0 are using the implemented protocol and should be supported.

  • JK-BD4A8S4P, hw 11.xw, sw 11.24, using JK02_32S (reported by @austin202220)
  • JK-BD6A17S6P, hw 7.2, sw 7.1.0H
  • JK-BD6A17S8P, hw 9.x, sw 9.01G (reported by @jonadis)
  • JK-BD6A20S10P, hw 10.XW, sw 10.07 (reported by @adadrag)
  • JK-BD6A20S12P, hw 11.XW, sw 11.281, using UART-TTL (reported by @asiridissa)
  • JK-BD6A24S6P, hw 6.x, sw 6.10S (reported by @ziporah)
  • JK-BD6A24S10P, hw 8.x, sw 8.0.6G (reported by @spoonwzd)
  • JK-BD6A24S10P, hw 10.xw, sw 10.09 (reported by @PMPoulsen)
  • JK-BD4A17S4P, hw 11.xw, sw 11.01 (reported by @Condor-XYZ)
  • JK-B1A8S10P, hw 11.XW, sw 11.261, using JK02_32S (reported by @Chickenbreast0)
  • JK-B1A24S15P, hw 8.x, sw 8.1.0H (reported by @killee)
  • JK-B1A20S15P, hw 8.x, sw 8.14U (reported by @trippfam07)
  • JK-B1A20S15P, hw 10.xw, sw 10.07 (reported by @romeox44)
  • JK-B1A20S15P, hw 10.xw, sw 10.10, using JK02 (reported by @austin202220)
  • JK-B1A20S15P, hw 11.xw, sw 11.26, using UART-TTL (reported by @Tesla72PL)
  • JK-B2A24S15P, hw 6.x, sw 6.1.3S (reported by @miguel300477)
  • JK-B2A24S15P, hw 8.x, sw 8.21W (reported by @mariusvaida)
  • JK-B2A24S15P, hw 10.xw, sw 10.07
  • JK-B2A24S15P, hw 10.xw, sw 10.08 (reported by @meccip)
  • JK-B2A24S150P, hw 10.xw, sw 10.10 (reported by @nayias)
  • JK-B2A24S20P, hw 8.x, sw 8.1.2H (reported by @KlausLi)
  • JK-B2A24S20P, hw 8.x, sw 8.20G (reported by @rob-oravec)
  • JK-B2A24S20P, hw 10.X-W, sw 10.02 (reported by @SeByDocKy)
  • JK-B2A24S20P, hw 10.XG, sw 10.07D30 (reported by @TheSmartGerman)
  • JK-B2A24S20P, hw 10.XW, sw 10.07 (reported by @amagr0)
  • JK-B2A8S20P, hw 9.x, sw 9.01M3, using JK02 (reported by @EasilyBoredEngineer)
  • JK-B2A8S20P, hw 9.x, sw 9.08W (reported by @vrabi-cv)
  • JK-B2A8S20P, hw 11.XW, sw 11.17, using JK02_32S (reported by @senfkorn)
  • JK-B2A8S20P, hw 11.XW, sw 11.26, using JK02_32S (reported by @riker65)
  • JK-B2A20S20P, hw 10.XW, sw 10.09 (reported by @markusgg84)
  • JK-B2A20S20P, hw 10.XW, sw 11.21h, using JK02_32S (reported by @Salve87)
  • JK-B2A20S20P, hw 11.XW, sw 11.24H, using JK02_32S (reported by @austin202220)
  • JK-B2A20S20P, hw 11.XW, sw 11.25H, using JK02_32S (reported by @iovcharyk)
  • JK-B5A24S, hw 8.x, sw 8.0.3M, using JK04 (reported by @JSladen)
  • JK-B2A16S, hw 3.0, sw 3.3.0, using JK04 (reported by @magnetus26)
  • GW-24S4EB (NEEY/Heltec 4A Smart Active Balancer), hw HW-2.8.0, sw ZH-1.2.3 (reported by @cristi2005)
  • GW-24S4EB (NEEY 4A Smart Active Balancer 4th generation), hw HW-3.2.0, sw ZH-1.2.4 (reported by @fabhund)

Untested devices

  • JK-BD6A20S6P

Requirements

Schematics

                UART-TTL
┌──────────┐                ┌─────────┐
│          │<----- RX ----->│         │
│  JK-BMS  │<----- TX ----->│ ESP32/  │
│          │<----- GND ---->│ ESP8266 │<-- 3.3V
│          │                │         │<-- GND
└──────────┘                └─────────┘

# UART-TTL socket (4 Pin, JST 1.25mm pitch)
┌─── ─────── ────┐
│                │
│ O   O   O   O  │
│GND  RX  TX VBAT│
└────────────────┘
  │   │   │
  │   │   └─── GPIO17 (`rx_pin`)
  │   └─────── GPIO16 (`tx_pin`)
  └─────────── GND

The UART-TTL (labeled as RS485) socket of the BMS can be attached to any UART pins of the ESP. A hardware UART should be preferred because of the high baudrate (115200 baud). The connector is called 4 Pin JST with 1.25mm pitch.

Installation

You can install this component with ESPHome external components feature like this:

external_components:
  - source: github://syssi/esphome-jk-bms@main

or just use the esp32-example.yaml as proof of concept:

# Install esphome
pip3 install esphome

# Clone this external component
git clone https://github.com/syssi/esphome-jk-bms.git
cd esphome-jk-bms

# Create a secrets.yaml containing some setup specific secrets
cat > secrets.yaml <<EOF
wifi_ssid: MY_WIFI_SSID
wifi_password: MY_WIFI_PASSWORD

mqtt_host: MY_MQTT_HOST
mqtt_username: MY_MQTT_USERNAME
mqtt_password: MY_MQTT_PASSWORD
EOF

# Validate the configuration, create a binary, upload it, and start logs
# If you use a esp8266 run the esp8266-examle.yaml
esphome run esp32-example.yaml

Example response all sensors enabled

[sensor:127]: 'jk-bms cell voltage 1': Sending state 4.12500 V with 3 decimals of accuracy
[sensor:127]: 'jk-bms cell voltage 2': Sending state 4.12500 V with 3 decimals of accuracy
[sensor:127]: 'jk-bms cell voltage 3': Sending state 4.12800 V with 3 decimals of accuracy
[sensor:127]: 'jk-bms cell voltage 4': Sending state 4.12400 V with 3 decimals of accuracy
[sensor:127]: 'jk-bms cell voltage 5': Sending state 4.12500 V with 3 decimals of accuracy
[sensor:127]: 'jk-bms cell voltage 6': Sending state 4.12800 V with 3 decimals of accuracy
[sensor:127]: 'jk-bms cell voltage 7': Sending state 4.12400 V with 3 decimals of accuracy
[sensor:127]: 'jk-bms cell voltage 8': Sending state 4.12300 V with 3 decimals of accuracy
[sensor:127]: 'jk-bms cell voltage 9': Sending state 4.12800 V with 3 decimals of accuracy
[sensor:127]: 'jk-bms cell voltage 10': Sending state 4.12800 V with 3 decimals of accuracy
[sensor:127]: 'jk-bms cell voltage 11': Sending state 4.12800 V with 3 decimals of accuracy
[sensor:127]: 'jk-bms cell voltage 12': Sending state 4.13100 V with 3 decimals of accuracy
[sensor:127]: 'jk-bms cell voltage 13': Sending state 4.12400 V with 3 decimals of accuracy
[sensor:127]: 'jk-bms power tube temperature': Sending state 24.00000 °C with 0 decimals of accuracy
[sensor:127]: 'jk-bms temperature sensor 1': Sending state 22.00000 °C with 0 decimals of accuracy
[sensor:127]: 'jk-bms temperature sensor 2': Sending state 22.00000 °C with 0 decimals of accuracy
[sensor:127]: 'jk-bms total voltage': Sending state 53.64000 V with 2 decimals of accuracy
[sensor:127]: 'jk-bms current': Sending state -0.00000 A with 2 decimals of accuracy
[sensor:127]: 'jk-bms capacity remaining': Sending state 99.00000 % with 0 decimals of accuracy
[sensor:127]: 'jk-bms temperature sensors': Sending state 2.00000  with 0 decimals of accuracy
[sensor:127]: 'jk-bms charging cycles': Sending state 0.00000  with 0 decimals of accuracy
[sensor:127]: 'jk-bms total charging cycle capacity': Sending state 0.00000  with 0 decimals of accuracy
[sensor:127]: 'jk-bms battery strings': Sending state 13.00000  with 0 decimals of accuracy
[sensor:127]: 'jk-bms errors bitmask': Sending state 0.00000  with 0 decimals of accuracy
[text_sensor:015]: 'jk-bms errors': Sending state ''
[sensor:127]: 'jk-bms operation mode bitmask': Sending state 0.00000  with 0 decimals of accuracy
[text_sensor:015]: 'jk-bms operation mode': Sending state ''
[sensor:127]: 'jk-bms total voltage overvoltage protection': Sending state 5.46000 V with 3 decimals of accuracy
[sensor:127]: 'jk-bms total voltage undervoltage protection': Sending state 3.77000 V with 3 decimals of accuracy
[sensor:127]: 'jk-bms cell voltage overvoltage protection': Sending state 4.20000 V with 3 decimals of accuracy
[sensor:127]: 'jk-bms cell voltage overvoltage recovery': Sending state 4.10000 V with 3 decimals of accuracy
[sensor:127]: 'jk-bms cell voltage overvoltage delay': Sending state 5.00000 s with 0 decimals of accuracy
[sensor:127]: 'jk-bms cell voltage undervoltage protection': Sending state 2.90000 V with 3 decimals of accuracy
[sensor:127]: 'jk-bms cell voltage undervoltage recovery': Sending state 3.20000 V with 3 decimals of accuracy
[sensor:127]: 'jk-bms cell voltage undervoltage delay': Sending state 5.00000 s with 0 decimals of accuracy
[sensor:127]: 'jk-bms cell pressure difference protection': Sending state 0.30000 V with 3 decimals of accuracy
[sensor:127]: 'jk-bms discharging overcurrent protection': Sending state 60.00000 A with 0 decimals of accuracy
[sensor:127]: 'jk-bms discharging overcurrent delay': Sending state 300.00000 s with 0 decimals of accuracy
[sensor:127]: 'jk-bms charging overcurrent protection': Sending state 25.00000 A with 0 decimals of accuracy
[sensor:127]: 'jk-bms charging overcurrent delay': Sending state 30.00000 s with 0 decimals of accuracy
[sensor:127]: 'jk-bms balance starting voltage': Sending state 3.30000 V with 3 decimals of accuracy
[sensor:127]: 'jk-bms balance opening pressure difference': Sending state 0.01000 V with 3 decimals of accuracy
[switch:045]: 'jk-bms balancing': Sending state ON
[sensor:127]: 'jk-bms power tube temperature protection': Sending state 90.00000 °C with 0 decimals of accuracy
[sensor:127]: 'jk-bms power tube temperature recovery': Sending state 70.00000 °C with 0 decimals of accuracy
[sensor:127]: 'jk-bms temperature sensor temperature protection': Sending state 100.00000 °C with 0 decimals of accuracy
[sensor:127]: 'jk-bms temperature sensor temperature recovery': Sending state 100.00000 °C with 0 decimals of accuracy
[sensor:127]: 'jk-bms temperature sensor temperature difference protection': Sending state 20.00000 °C with 0 decimals of accuracy
[sensor:127]: 'jk-bms charging high temperature protection': Sending state 70.00000 °C with 0 decimals of accuracy
[sensor:127]: 'jk-bms discharging high temperature protection': Sending state 70.00000 °C with 0 decimals of accuracy
[sensor:127]: 'jk-bms charging low temperature protection': Sending state -20.00000 °C with 0 decimals of accuracy
[sensor:127]: 'jk-bms charging low temperature recovery': Sending state -10.00000 °C with 0 decimals of accuracy
[sensor:127]: 'jk-bms discharging low temperature protection': Sending state -20.00000 °C with 0 decimals of accuracy
[sensor:127]: 'jk-bms discharging low temperature recovery': Sending state -10.00000 °C with 0 decimals of accuracy
[switch:045]: 'jk-bms charging': Sending state OFF
[switch:045]: 'jk-bms discharging': Sending state OFF
[sensor:127]: 'jk-bms current calibration': Sending state 0.72500 A with 3 decimals of accuracy
[sensor:127]: 'jk-bms device address': Sending state 1.00000  with 0 decimals of accuracy
[text_sensor:015]: 'jk-bms battery type': Sending state 'Ternary Lithium'
[sensor:127]: 'jk-bms sleep wait time': Sending state 10.00000 s with 0 decimals of accuracy
[sensor:127]: 'jk-bms alarm low volume': Sending state 20.00000  with 0 decimals of accuracy
[text_sensor:015]: 'jk-bms password': Sending state '123456'
[switch:045]: 'jk-bms dedicated charger': Sending state OFF
[text_sensor:015]: 'jk-bms device type': Sending state 'Input Us'
[sensor:127]: 'jk-bms total runtime': Sending state 0.00000 h with 0 decimals of accuracy
[text_sensor:015]: 'jk-bms software version': Sending state 'H7.X__S7.1.0H__'
[sensor:127]: 'jk-bms actual_battery_capacity': Sending state 186.00000 Ah with 0 decimals of accuracy
[text_sensor:015]: 'jk-bms manufacturer': Sending state 'BT3072020120000200521001'
[sensor:127]: 'jk-bms protocol version': Sending state 1.00000  with 0 decimals of accuracy

Known issues

  • The battery type sensor is pretty useless because the BMS reports always the same value (Ternary Lithium). Regardless of which battery type was set / parameter set was loaded via the android app. (#9)
  • ESP32: Adding all supported sensors can lead to a stack overflow / boot loop. This can be solved by increasing the stack size. (#63)

Goodies

A user of this project (@dr3amr) shared some Home Assistant Lovelace UI cards for a beautiful dashboard here.

Custom Lovelace UI cards

Debugging

If this component doesn't work out of the box for your device please update your configuration to enable the debug output of the UART component and increase the log level to the see outgoing and incoming serial traffic:

logger:
  level: DEBUG

uart:
  id: uart_0
  baud_rate: 115200
  rx_buffer_size: 384
  tx_pin: GPIO14
  rx_pin: GPIO4
  debug:
    direction: BOTH

References

More Repositories

1

xiaomi_airpurifier

Xiaomi Mi Air Purifier and Xiaomi Mi Air Humidifier integration for Home Assistant
Python
406
star
2

xiaomi_airconditioningcompanion

Xiaomi Mi and Aqara Air Conditioning Companion integration for Home Assistant
Python
374
star
3

xiaomi_fan

Xiaomi Mi Smart Fan integration for Home Assistant
Python
330
star
4

xiaomi_cooker

Xiaomi Mi Electric Rice Cooker integration for Home Assistant
Python
123
star
5

esphome-yeelight-ceiling-light

ESPHome custom firmware for some Yeelight Ceiling Lights
C++
101
star
6

xiaomi_raw

Custom component for Home Assistant to faciliate the reverse engeneering of Xiaomi MiIO devices
Python
93
star
7

esphome-pipsolar

ESPHome component to monitor and control a pipsolar inverter via RS232
85
star
8

philipslight

Xiaomi Philips Lights integration for Home Assistant
Python
62
star
9

esphome-soyosource-gtn-virtual-meter

ESPHome component to simulate the current clamp to control the Soyosource GTN1200 limiter
C++
45
star
10

esphome-jbd-bms

ESPHome component to monitor and control a Xiaoxiang Battery Management System (JBD-BMS) via UART-TTL or BLE
C++
40
star
11

homeassistant-goecharger-mqtt

go-eCharger integration for Home Assistant using the MQTT API
Python
35
star
12

es-f

|es|f| is a web based HTML frontend for esniper, a lightweight console application for sniping eBay auctions.
PHP
29
star
13

esphome-zb-gw03

ESPHome custom firmware for the ZB-GW03 zigbee gateway
29
star
14

esphome-ant-bms

ESPHome component to monitor and control a ANT-BMS via UART
C++
27
star
15

esphome-atorch-dl24

ESPHome component to monitor and control some Atorch meters via bluetooth
C++
23
star
16

esphome-seplos-bms

ESPHome component to monitor a Seplos Battery Management System (Seplos-BMS) via UART or RS485
C++
23
star
17

esphome-solax-x1-mini

ESPHome component to monitor a Solax X1 mini via RS485
C++
22
star
18

esphome-mi-desk-lamp

ESPHome custom firmware for the Xiaomi Mi Desk Lamp
21
star
19

nextbike

Nextbike integration for Home Assistant
Python
11
star
20

esphome-jnge-mppt-controller

ESPHome component to monitor and control a JN-MPPT or JN-W/S Controller via RS485
C++
8
star
21

esphome-votronic

ESPHome component to monitor votronic devices via BLE or Display Link
C++
6
star
22

esphome-smg-ii

ESPHome configuration to monitor and control a ISolar/EASUN SMG II inverter via RS232
Shell
6
star
23

esphome-evse-wallbox

ESPHome component to monitor and control a EVSE wallbox
C++
5
star
24

esphome-pace-bms

ESPHome component to monitor and control a PACE Battery Management System (PACE-BMS) via RS485 (Modbus)
Shell
5
star
25

esphome-dps

ESPHome component to monitor and control the RDTech DPS series
C++
5
star
26

esphome-virtual-can-bms

ESPHome component to emulate a SMA/Victron compatible BMS via CAN bus
C++
5
star
27

xiaomi_airqualitymonitor

Xiaomi Mi Air Quality Monitor (PM2.5) integration for Home Assistant
Python
3
star
28

xiaomi_airhumidifier

Xiaomi Mi Air Humidifier integration for Home Assistant
2
star
29

xiaomi_repeater

Xioami Mi WiFi Repeater 2 integration for Home Assistant
Python
2
star
30

esphome-basen-bms

ESPHome component to monitor a Basen Battery Management System via BLE
C++
2
star
31

htc-vision-extended-keymap

Extended keymap for the qwertz hardware keyboard of my HTC Vision
C++
1
star
32

yeelight

Yeelight integration for Home Assistant
Python
1
star
33

esphome-config-examples

A collection of various ESPHome configurations and snippets
1
star
34

esphome-total-count

Python
1
star