substitutions: name: jk-bms-ble device_description: "Monitor and control a JK-BMS via bluetooth" external_components_source: github://syssi/esphome-jk-bms@main # mac_address: C8:47:8C:E9:33:C0 11.x mac_address: C8:47:8C:EA:61:49 # 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 esphome: name: ${name} comment: ${device_description} project: name: "syssi.esphome-jk-bms" version: 1.5.0 platformio_options: build_flags: - -DCONFIG_ARDUINO_LOOP_STACK_SIZE=32768 esp32: board: wemos_d1_mini32 framework: type: esp-idf external_components: - source: ${external_components_source} refresh: 0s - source: github://spali/esphome@pr3500 components: - web_server - web_server_idf - web_server_base - captive_portal refresh: 0s web_server: port: 80 captive_portal: wifi: ssid: !secret wifi_ssid password: !secret wifi_password domain: !secret domain ota: logger: level: Info # If you don't use Home Assistant please remove this `api` section and uncomment the `mqtt` component! # api: mqtt: broker: !secret mqtt_host username: !secret mqtt_username password: !secret mqtt_password port: 1883 id: mqtt_client discovery: false time: - platform: sntp id: sntp_time 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: "balancing" charging: name: "charging" discharging: name: "discharging" online_status: name: "online status" button: - platform: jk_bms_ble retrieve_settings: name: "retrieve settings" retrieve_device_info: name: "retrieve device info" number: - platform: jk_bms_ble jk_bms_ble_id: bms0 balance_trigger_voltage: name: "balance trigger voltage" cell_count: name: "cell count" total_battery_capacity: name: "total battery capacity" cell_voltage_overvoltage_protection: name: "cell voltage overvoltage protection" cell_voltage_overvoltage_recovery: name: "cell voltage overvoltage recovery" cell_voltage_undervoltage_protection: name: "cell voltage undervoltage protection" cell_voltage_undervoltage_recovery: name: "cell voltage undervoltage recovery" balance_starting_voltage: name: "balance starting voltage" voltage_calibration: name: "voltage calibration" current_calibration: name: "current calibration" power_off_voltage: name: "power off voltage" max_balance_current: name: "max balance current" max_charge_current: name: "max charge current" max_discharge_current: name: "max discharge current" sensor: - platform: jk_bms_ble jk_bms_ble_id: bms0 min_cell_voltage: name: "min cell voltage" max_cell_voltage: name: "max cell voltage" min_voltage_cell: name: "min voltage cell" max_voltage_cell: name: "max voltage cell" delta_cell_voltage: name: "delta cell voltage" average_cell_voltage: name: "average cell voltage" cell_voltage_1: name: "cell voltage 1" cell_voltage_2: name: "cell voltage 2" cell_voltage_3: name: "cell voltage 3" cell_voltage_4: name: "cell voltage 4" cell_voltage_5: name: "cell voltage 5" cell_voltage_6: name: "cell voltage 6" cell_voltage_7: name: "cell voltage 7" cell_voltage_8: name: "cell voltage 8" cell_voltage_9: name: "cell voltage 9" cell_voltage_10: name: "cell voltage 10" cell_voltage_11: name: "cell voltage 11" cell_voltage_12: name: "cell voltage 12" cell_voltage_13: name: "cell voltage 13" cell_voltage_14: name: "cell voltage 14" cell_voltage_15: name: "cell voltage 15" cell_voltage_16: name: "cell voltage 16" # cell_voltage_17: # name: "cell voltage 17" # cell_voltage_18: # name: "cell voltage 18" # cell_voltage_19: # name: "cell voltage 19" # cell_voltage_20: # name: "cell voltage 20" # cell_voltage_21: # name: "cell voltage 21" # cell_voltage_22: # name: "cell voltage 22" # cell_voltage_23: # name: "cell voltage 23" # cell_voltage_24: # name: "cell voltage 24" cell_resistance_1: name: "cell resistance 1" cell_resistance_2: name: "cell resistance 2" cell_resistance_3: name: "cell resistance 3" cell_resistance_4: name: "cell resistance 4" cell_resistance_5: name: "cell resistance 5" cell_resistance_6: name: "cell resistance 6" cell_resistance_7: name: "cell resistance 7" cell_resistance_8: name: "cell resistance 8" cell_resistance_9: name: "cell resistance 9" cell_resistance_10: name: "cell resistance 10" cell_resistance_11: name: "cell resistance 11" cell_resistance_12: name: "cell resistance 12" cell_resistance_13: name: "cell resistance 13" cell_resistance_14: name: "cell resistance 14" cell_resistance_15: name: "cell resistance 15" cell_resistance_16: name: "cell resistance 16" # cell_resistance_17: # name: "cell resistance 17" # cell_resistance_18: # name: "cell resistance 18" # cell_resistance_19: # name: "cell resistance 19" # cell_resistance_20: # name: "cell resistance 20" # cell_resistance_21: # name: "cell resistance 21" # cell_resistance_22: # name: "cell resistance 22" # cell_resistance_23: # name: "cell resistance 23" # cell_resistance_24: # name: "cell resistance 24" total_voltage: name: "total voltage" current: name: "current" power: name: "power" charging_power: name: "charging power" discharging_power: name: "discharging power" temperature_sensor_1: name: "temperature sensor 1" temperature_sensor_2: name: "temperature sensor 2" power_tube_temperature: name: "power tube temperature" state_of_charge: name: "state of charge" capacity_remaining: name: "capacity remaining" total_battery_capacity_setting: name: "total battery capacity setting" charging_cycles: name: "charging cycles" total_charging_cycle_capacity: name: "total charging cycle capacity" total_runtime: name: "total runtime" balancing_current: name: "balancing current" errors_bitmask: name: "errors bitmask" switch: - platform: jk_bms_ble charging: name: "charging" discharging: name: "discharging" balancer: name: "balancer" - platform: ble_client ble_client_id: client0 name: "enable bluetooth connection" text_sensor: - platform: jk_bms_ble errors: name: "errors" total_runtime_formatted: name: "total runtime formatted"