Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

only 2/4 JK BMS display runtime formatted #642

Open
trung729 opened this issue Dec 23, 2024 · 31 comments
Open

only 2/4 JK BMS display runtime formatted #642

trung729 opened this issue Dec 23, 2024 · 31 comments

Comments

@trung729
Copy link

I have add 2 more JK BMS into our system, and now I have total 4 JK BMS, but 2 new ones display wrong "runtime formatted" with this code:
esp32-ble-v14-multiple.yaml.
and I have added 2 more code with named "bms2" and "bms3" in your yaml file.
Please give me a help.

@syssi
Copy link
Owner

syssi commented Dec 23, 2024

Could you share your configuration instead of the initial one?

@trung729
Copy link
Author

here you are

@trung729
Copy link
Author

jk.zip
here you are

@trung729
Copy link
Author

Screenshot 2024-12-23 201247

@syssi
Copy link
Owner

syssi commented Dec 23, 2024

Could you provide a log which indicates the issue? IMO the YAML looks fine. May be the lovelace card wasn't extended properly?

@trung729
Copy link
Author

Could you provide a log which indicates the issue? IMO the YAML looks fine. May be the lovelace card wasn't extended properly?

398168322-aff6db13-b414-40ea-9e58-571ad0bc3d95

This information is wrong

@trung729
Copy link
Author

398168322-aff6db13-b414-40ea-9e58-571ad0bc3d95

@trung729
Copy link
Author

1
2
3
4
bms2 and BMS3 donnot have "total runtime formatted"

@trung729
Copy link
Author

Cảm biến
_ bms0 average cell voltage
3,294 V
_ bms0 balancing
Tắt
_ bms0 balancing
0
_ bms0 balancing current
0,00 A
_ bms0 capacity remaining
222,823 Ah
_ bms0 cell resistance 1
0,060 Ω
_ bms0 cell resistance 10
0,058 Ω
_ bms0 cell resistance 11
0,059 Ω
_ bms0 cell resistance 12
0,054 Ω
_ bms0 cell resistance 13
0,056 Ω
_ bms0 cell resistance 14
0,052 Ω
_ bms0 cell resistance 15
0,055 Ω
_ bms0 cell resistance 16
0,053 Ω
_ bms0 cell resistance 2
0,056 Ω
_ bms0 cell resistance 3
0,059 Ω
_ bms0 cell resistance 4
0,058 Ω
_ bms0 cell resistance 5
0,065 Ω
_ bms0 cell resistance 6
0,065 Ω
_ bms0 cell resistance 7
0,069 Ω
_ bms0 cell resistance 8
0,066 Ω
_ bms0 cell resistance 9
0,066 Ω
_ bms0 cell voltage 1
3,294 V
_ bms0 cell voltage 10
3,295 V
_ bms0 cell voltage 11
3,294 V
_ bms0 cell voltage 12
3,295 V
_ bms0 cell voltage 13
3,294 V
_ bms0 cell voltage 14
3,295 V
_ bms0 cell voltage 15
3,294 V
_ bms0 cell voltage 16
3,294 V
_ bms0 cell voltage 2
3,293 V
_ bms0 cell voltage 3
3,295 V
_ bms0 cell voltage 4
3,294 V
_ bms0 cell voltage 5
3,295 V
_ bms0 cell voltage 6
3,293 V
_ bms0 cell voltage 7
3,294 V
_ bms0 cell voltage 8
3,294 V
_ bms0 cell voltage 9
3,290 V
_ bms0 charging
Bật
_ bms0 charging cycles
7
_ bms0 charging power
0,00 W
_ bms0 current
-9,29 A
_ bms0 delta cell voltage
0,004 V
_ bms0 discharging
Bật
_ bms0 discharging power
470,08 W
_ bms0 emergency time countdown
0 s
_ bms0 errors
_ bms0 errors bitmask
0
_ bms0 heating
Tắt
_ bms0 heating current
0,00 A
_ bms0 max cell voltage
3,296 V
_ bms0 max voltage cell
5
_ bms0 min cell voltage
3,291 V
_ bms0 min voltage cell
9
_ bms0 power
-489,71 W
_ bms0 power tube temperature
24,0 °C
_ bms0 state of charge
79%
_ bms0 temperature sensor 1
24,5 °C
_ bms0 temperature sensor 2
24,0 °C
_ bms0 temperature sensor 3
23,7 °C
_ bms0 temperature sensor 4
24,9 °C
_ bms0 temperature sensor 5
24,0 °C
_ bms0 total battery capacity setting
280 Ah
_ bms0 total charging cycle capacity
1.975,477 Ah
_ bms0 total runtime
2.516.431 s
_ bms0 total runtime formatted
29d 2h
_ bms0 total voltage
52,71 V
_ bms1 average cell voltage
3,289 V
_ bms1 balancing
Tắt
_ bms1 balancing
0
_ bms1 balancing current
0,00 A
_ bms1 capacity remaining
223,336 Ah
_ bms1 cell resistance 1
0,060 Ω
_ bms1 cell resistance 10
0,061 Ω
_ bms1 cell resistance 11
0,064 Ω
_ bms1 cell resistance 12
0,058 Ω
_ bms1 cell resistance 13
0,060 Ω
_ bms1 cell resistance 14
0,055 Ω
_ bms1 cell resistance 15
0,057 Ω
_ bms1 cell resistance 16
0,052 Ω
_ bms1 cell resistance 2
0,057 Ω
_ bms1 cell resistance 3
0,061 Ω
_ bms1 cell resistance 4
0,058 Ω
_ bms1 cell resistance 5
0,064 Ω
_ bms1 cell resistance 6
0,064 Ω
_ bms1 cell resistance 7
0,068 Ω
_ bms1 cell resistance 8
0,066 Ω
_ bms1 cell resistance 9
0,068 Ω
_ bms1 cell voltage 1
3,289 V
_ bms1 cell voltage 10
3,290 V
_ bms1 cell voltage 11
3,287 V
_ bms1 cell voltage 12
3,290 V
_ bms1 cell voltage 13
3,290 V
_ bms1 cell voltage 14
3,291 V
_ bms1 cell voltage 15
3,289 V
_ bms1 cell voltage 16
3,289 V
_ bms1 cell voltage 2
3,286 V
_ bms1 cell voltage 3
3,289 V
_ bms1 cell voltage 4
3,287 V
_ bms1 cell voltage 5
3,287 V
_ bms1 cell voltage 6
3,286 V
_ bms1 cell voltage 7
3,287 V
_ bms1 cell voltage 8
3,286 V
_ bms1 cell voltage 9
3,287 V
_ bms1 charging
Bật
_ bms1 charging cycles
8
_ bms1 charging power
0,00 W
_ bms1 current
-8,26 A
_ bms1 delta cell voltage
0,004 V
_ bms1 discharging
Bật
_ bms1 discharging power
474,33 W
_ bms1 emergency time countdown
0 s
_ bms1 errors
_ bms1 errors bitmask
0
_ bms1 heating
Tắt
_ bms1 heating current
0,00 A
_ bms1 max cell voltage
3,291 V
_ bms1 max voltage cell
12
_ bms1 min cell voltage
3,287 V
_ bms1 min voltage cell
2
_ bms1 power
-494,07 W
_ bms1 power tube temperature
24,4 °C
_ bms1 state of charge
80%
_ bms1 temperature sensor 1
24,6 °C
_ bms1 temperature sensor 2
24,1 °C
_ bms1 temperature sensor 3
23,5 °C
_ bms1 temperature sensor 4
24,3 °C
_ bms1 temperature sensor 5
24,3 °C
_ bms1 total battery capacity setting
280 Ah
_ bms1 total charging cycle capacity
2.503,211 Ah
_ bms1 total runtime
2.524.017 s
_ bms1 total runtime formatted
5d 2h
_ bms1 total voltage
52,62 V
_ bms2 average cell voltage
3,295 V
_ bms2 balancing
0
_ bms2 balancing
Tắt
_ bms2 balancing current
0,00 A
_ bms2 capacity remaining
228,385 Ah
_ bms2 cell resistance 1
0,050 Ω
_ bms2 cell resistance 10
0,057 Ω
_ bms2 cell resistance 11
0,058 Ω
_ bms2 cell resistance 12
0,054 Ω
_ bms2 cell resistance 13
0,054 Ω
_ bms2 cell resistance 14
0,052 Ω
_ bms2 cell resistance 15
0,055 Ω
_ bms2 cell resistance 16
0,053 Ω
_ bms2 cell resistance 2
0,046 Ω
_ bms2 cell resistance 3
0,049 Ω
_ bms2 cell resistance 4
0,047 Ω
_ bms2 cell resistance 5
0,051 Ω
_ bms2 cell resistance 6
0,050 Ω
_ bms2 cell resistance 7
0,055 Ω
_ bms2 cell resistance 8
0,052 Ω
_ bms2 cell resistance 9
0,058 Ω
_ bms2 cell voltage 1
3,295 V
_ bms2 cell voltage 10
3,295 V
_ bms2 cell voltage 11
3,295 V
_ bms2 cell voltage 12
3,296 V
_ bms2 cell voltage 13
3,295 V
_ bms2 cell voltage 14
3,295 V
_ bms2 cell voltage 15
3,292 V
_ bms2 cell voltage 16
3,296 V
_ bms2 cell voltage 2
3,294 V
_ bms2 cell voltage 3
3,295 V
_ bms2 cell voltage 4
3,294 V
_ bms2 cell voltage 5
3,295 V
_ bms2 cell voltage 6
3,294 V
_ bms2 cell voltage 7
3,295 V
_ bms2 cell voltage 8
3,295 V
_ bms2 cell voltage 9
3,295 V
_ bms2 charging
Bật
_ bms2 charging cycles
1
_ bms2 charging power
0,00 W
_ bms2 current
-7,36 A
_ bms2 delta cell voltage
0,004 V
_ bms2 discharging
Bật
_ bms2 discharging power
387,86 W
_ bms2 emergency time countdown
0 s
_ bms2 errors bitmask
0
_ bms2 heating
Tắt
_ bms2 heating current
0,00 A
_ bms2 max cell voltage
3,297 V
_ bms2 max voltage cell
10
_ bms2 min cell voltage
3,294 V
_ bms2 min voltage cell
2
_ bms2 power
-387,87 W
_ bms2 power tube temperature
24,2 °C
_ bms2 state of charge
82%
_ bms2 temperature sensor 1
23,1 °C
_ bms2 temperature sensor 2
23,5 °C
_ bms2 temperature sensor 3
23,1 °C
_ bms2 temperature sensor 4
23,3 °C
_ bms2 temperature sensor 5
24,2 °C
_ bms2 total battery capacity setting
280 Ah
_ bms2 total charging cycle capacity
469,692 Ah
_ bms2 total runtime
440.695 s
_ bms2 total voltage
52,71 V
_ bms3 average cell voltage
3,304 V
_ bms3 balancing
0
_ bms3 balancing
Bật
_ bms3 balancing current
0,00 A
_ bms3 capacity remaining
227,464 Ah
_ bms3 cell resistance 1
0,048 Ω
_ bms3 cell resistance 10
0,062 Ω
_ bms3 cell resistance 11
0,062 Ω
_ bms3 cell resistance 12
0,060 Ω
_ bms3 cell resistance 13
0,061 Ω
_ bms3 cell resistance 14
0,056 Ω
_ bms3 cell resistance 15
0,058 Ω
_ bms3 cell resistance 16
0,054 Ω
_ bms3 cell resistance 2
0,048 Ω
_ bms3 cell resistance 3
0,053 Ω
_ bms3 cell resistance 4
0,052 Ω
_ bms3 cell resistance 5
0,058 Ω
_ bms3 cell resistance 6
0,057 Ω
_ bms3 cell resistance 7
0,062 Ω
_ bms3 cell resistance 8
0,059 Ω
_ bms3 cell resistance 9
0,063 Ω
_ bms3 cell voltage 1
3,304 V
_ bms3 cell voltage 10
3,304 V
_ bms3 cell voltage 11
3,304 V
_ bms3 cell voltage 12
3,306 V
_ bms3 cell voltage 13
3,304 V
_ bms3 cell voltage 14
3,304 V
_ bms3 cell voltage 15
3,304 V
_ bms3 cell voltage 16
3,302 V
_ bms3 cell voltage 2
3,301 V
_ bms3 cell voltage 3
3,301 V
_ bms3 cell voltage 4
3,302 V
_ bms3 cell voltage 5
3,304 V
_ bms3 cell voltage 6
3,301 V
_ bms3 cell voltage 7
3,305 V
_ bms3 cell voltage 8
3,301 V
_ bms3 cell voltage 9
3,300 V
_ bms3 charging
Bật
_ bms3 charging cycles
1
_ bms3 charging power
0,00 W
_ bms3 current
-7,17 A
_ bms3 delta cell voltage
0,005 V
_ bms3 discharging
Bật
_ bms3 discharging power
418,67 W
_ bms3 emergency time countdown
0 s
_ bms3 errors bitmask
0
_ bms3 heating
Tắt
_ bms3 heating current
0,00 A
_ bms3 max cell voltage
3,305 V
_ bms3 max voltage cell
1
_ bms3 min cell voltage
3,301 V
_ bms3 min voltage cell
9
_ bms3 power
-378,81 W
_ bms3 power tube temperature
24,4 °C
_ bms3 state of charge
81%
_ bms3 temperature sensor 1
23,9 °C
_ bms3 temperature sensor 2
23,3 °C
_ bms3 temperature sensor 3
23,6 °C
_ bms3 temperature sensor 4
24,0 °C
_ bms3 temperature sensor 5
24,4 °C
_ bms3 total battery capacity setting
280 Ah
_ bms3 total charging cycle capacity
515,494 Ah
_ bms3 total runtime
439.314 s
_ bms3 total voltage
52,86 V

@trung729
Copy link
Author

trung729 commented Dec 23, 2024 via email

@syssi
Copy link
Owner

syssi commented Dec 23, 2024

Do you use the api component?

@syssi
Copy link
Owner

syssi commented Dec 23, 2024

Does it work if you use this reduced YAML configuration:

substitutions:
  name: "_"
  friendly_name: jk2
  bms0: "${name} bms0"
  bms1: "${name} bms1"
  bms2: "${name} bms2"
  bms3: "${name} bms3"
  device_description: "Monitor and control a JK-BMS via bluetooth"
  external_components_source: github://syssi/esphome-jk-bms@main
  bms0_mac_address: C8:47:80:16:98:65 #51-280Ah-00-00
  bms1_mac_address: C8:47:80:16:90:DE #51-280Ah-01-01
  bms2_mac_address: 98:DA:20:09:E3:2E
  bms3_mac_address: 98:DA:20:06:27:C6
  # Please use "JK02_24S" if you own a old JK-BMS < hardware version 11.0 (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)
  bms0_protocol_version: JK02_32S
  bms1_protocol_version: JK02_32S
  bms2_protocol_version: JK02_32S
  bms3_protocol_version: JK02_32S
esphome:
  name: ${name}
  friendly_name: ${friendly_name}
  min_version: 2024.6.0
  name_add_mac_suffix: false
  platformio_options:
    board_build.flash_mode: dio
  project:
    name: esphome.web
    version: dev

esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: esp-idf

# Allow provisioning Wi-Fi via serial
improv_serial:

# In combination with the `ap` this allows the user
# to provision wifi credentials to the device via WiFi AP.
captive_portal:

dashboard_import:
  package_import_url: github://esphome/firmware/esphome-web/esp32s3.yaml@main
  import_full_config: true

# Sets up Bluetooth LE (Only on ESP32) to allow the user
# to provision wifi credentials to the device.
esp32_improv:
  authorizer: none

# To have a "next url" for improv serial
web_server:

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

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

ota:
  platform: esphome
  on_begin:
    then:
      - switch.turn_off: ble_client_switch0
      - switch.turn_off: ble_client_switch1
      - switch.turn_off: ble_client_switch2
      - switch.turn_off: ble_client_switch3
      - logger.log: "BLE connection suspended for OTA update"

logger:
  level: DEBUG
  logs:
    esp32_ble_tracker: INFO
    esp32_ble_client: 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
#   id: mqtt_client

esp32_ble_tracker:
  scan_parameters:
    active: true

ble_client:
  - mac_address: ${bms0_mac_address}
    id: client0
  - mac_address: ${bms1_mac_address}
    id: client1
  - mac_address: ${bms2_mac_address}
    id: client2
  - mac_address: ${bms3_mac_address}
    id: client3

jk_bms_ble:
  - ble_client_id: client0
    protocol_version: ${bms0_protocol_version}
    throttle: 5s
    id: bms0
  - ble_client_id: client1
    protocol_version: ${bms1_protocol_version}
    throttle: 5s
    id: bms1
  - ble_client_id: client2
    protocol_version: ${bms2_protocol_version}
    throttle: 5s
    id: bms2
  - ble_client_id: client3
    protocol_version: ${bms3_protocol_version}
    throttle: 5s
    id: bms3

sensor:
  - platform: jk_bms_ble
    jk_bms_ble_id: bms0
    total_voltage:
      name: "${bms0} total voltage"
    total_runtime:
      name: "${bms0} total runtime"

  - platform: jk_bms_ble
    jk_bms_ble_id: bms1
    total_voltage:
      name: "${bms1} total voltage"
    total_runtime:
      name: "${bms1} total runtime"

  - platform: jk_bms_ble
    jk_bms_ble_id: bms2
    total_voltage:
      name: "${bms2} total voltage"
    total_runtime:
      name: "${bms2} total runtime"

  - platform: jk_bms_ble
    jk_bms_ble_id: bms3
    total_voltage:
      name: "${bms3} total voltage"
    total_runtime:
      name: "${bms3} total runtime"

text_sensor:
  - platform: jk_bms_ble
    jk_bms_ble_id: bms0
    errors:
      name: "${bms0} errors"
    total_runtime_formatted:
      name: "${bms0} total runtime formatted"

  - platform: jk_bms_ble
    jk_bms_ble_id: bms1
    errors:
      name: "${bms1} errors"
    total_runtime_formatted:
      name: "${bms1} total runtime formatted"

  - platform: jk_bms_ble
    jk_bms_ble_id: bms2
    errors:
      name: "${bms2} errors"
    total_runtime_formatted:
      name: "${bms2} total runtime formatted"

  - platform: jk_bms_ble
    jk_bms_ble_id: bms3
    errors:
      name: "${bms3} errors"
    total_runtime_formatted:
      name: "${bms3} total runtime formatted"

@trung729
Copy link
Author

ok

Does it work if you use this reduced YAML configuration:

substitutions:
  name: "_"
  friendly_name: jk2
  bms0: "${name} bms0"
  bms1: "${name} bms1"
  bms2: "${name} bms2"
  bms3: "${name} bms3"
  device_description: "Monitor and control a JK-BMS via bluetooth"
  external_components_source: github://syssi/esphome-jk-bms@main
  bms0_mac_address: C8:47:80:16:98:65 #51-280Ah-00-00
  bms1_mac_address: C8:47:80:16:90:DE #51-280Ah-01-01
  bms2_mac_address: 98:DA:20:09:E3:2E
  bms3_mac_address: 98:DA:20:06:27:C6
  # Please use "JK02_24S" if you own a old JK-BMS < hardware version 11.0 (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)
  bms0_protocol_version: JK02_32S
  bms1_protocol_version: JK02_32S
  bms2_protocol_version: JK02_32S
  bms3_protocol_version: JK02_32S
esphome:
  name: ${name}
  friendly_name: ${friendly_name}
  min_version: 2024.6.0
  name_add_mac_suffix: false
  platformio_options:
    board_build.flash_mode: dio
  project:
    name: esphome.web
    version: dev

esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: esp-idf

# Allow provisioning Wi-Fi via serial
improv_serial:

# In combination with the `ap` this allows the user
# to provision wifi credentials to the device via WiFi AP.
captive_portal:

dashboard_import:
  package_import_url: github://esphome/firmware/esphome-web/esp32s3.yaml@main
  import_full_config: true

# Sets up Bluetooth LE (Only on ESP32) to allow the user
# to provision wifi credentials to the device.
esp32_improv:
  authorizer: none

# To have a "next url" for improv serial
web_server:

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

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

ota:
  platform: esphome
  on_begin:
    then:
      - switch.turn_off: ble_client_switch0
      - switch.turn_off: ble_client_switch1
      - switch.turn_off: ble_client_switch2
      - switch.turn_off: ble_client_switch3
      - logger.log: "BLE connection suspended for OTA update"

logger:
  level: DEBUG
  logs:
    esp32_ble_tracker: INFO
    esp32_ble_client: 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
#   id: mqtt_client

esp32_ble_tracker:
  scan_parameters:
    active: true

ble_client:
  - mac_address: ${bms0_mac_address}
    id: client0
  - mac_address: ${bms1_mac_address}
    id: client1
  - mac_address: ${bms2_mac_address}
    id: client2
  - mac_address: ${bms3_mac_address}
    id: client3

jk_bms_ble:
  - ble_client_id: client0
    protocol_version: ${bms0_protocol_version}
    throttle: 5s
    id: bms0
  - ble_client_id: client1
    protocol_version: ${bms1_protocol_version}
    throttle: 5s
    id: bms1
  - ble_client_id: client2
    protocol_version: ${bms2_protocol_version}
    throttle: 5s
    id: bms2
  - ble_client_id: client3
    protocol_version: ${bms3_protocol_version}
    throttle: 5s
    id: bms3

sensor:
  - platform: jk_bms_ble
    jk_bms_ble_id: bms0
    total_voltage:
      name: "${bms0} total voltage"
    total_runtime:
      name: "${bms0} total runtime"

  - platform: jk_bms_ble
    jk_bms_ble_id: bms1
    total_voltage:
      name: "${bms1} total voltage"
    total_runtime:
      name: "${bms1} total runtime"

  - platform: jk_bms_ble
    jk_bms_ble_id: bms2
    total_voltage:
      name: "${bms2} total voltage"
    total_runtime:
      name: "${bms2} total runtime"

  - platform: jk_bms_ble
    jk_bms_ble_id: bms3
    total_voltage:
      name: "${bms3} total voltage"
    total_runtime:
      name: "${bms3} total runtime"

text_sensor:
  - platform: jk_bms_ble
    jk_bms_ble_id: bms0
    errors:
      name: "${bms0} errors"
    total_runtime_formatted:
      name: "${bms0} total runtime formatted"

  - platform: jk_bms_ble
    jk_bms_ble_id: bms1
    errors:
      name: "${bms1} errors"
    total_runtime_formatted:
      name: "${bms1} total runtime formatted"

  - platform: jk_bms_ble
    jk_bms_ble_id: bms2
    errors:
      name: "${bms2} errors"
    total_runtime_formatted:
      name: "${bms2} total runtime formatted"

  - platform: jk_bms_ble
    jk_bms_ble_id: bms3
    errors:
      name: "${bms3} errors"
    total_runtime_formatted:
      name: "${bms3} total runtime formatted"

ok let me check this configuration

@trung729
Copy link
Author

logs_jk_run.txt
it display this error

@syssi
Copy link
Owner

syssi commented Dec 28, 2024

My fault. This is the fixed version:

substitutions:
  name: "_"
  friendly_name: jk2
  bms0: "${name} bms0"
  bms1: "${name} bms1"
  bms2: "${name} bms2"
  bms3: "${name} bms3"
  device_description: "Monitor and control a JK-BMS via bluetooth"
  external_components_source: github://syssi/esphome-jk-bms@main
  bms0_mac_address: C8:47:80:16:98:65 #51-280Ah-00-00
  bms1_mac_address: C8:47:80:16:90:DE #51-280Ah-01-01
  bms2_mac_address: 98:DA:20:09:E3:2E
  bms3_mac_address: 98:DA:20:06:27:C6
  # Please use "JK02_24S" if you own a old JK-BMS < hardware version 11.0 (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)
  bms0_protocol_version: JK02_32S
  bms1_protocol_version: JK02_32S
  bms2_protocol_version: JK02_32S
  bms3_protocol_version: JK02_32S
esphome:
  name: ${name}
  friendly_name: ${friendly_name}
  min_version: 2024.6.0
  name_add_mac_suffix: false
  platformio_options:
    board_build.flash_mode: dio
  project:
    name: esphome.web
    version: dev

esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: esp-idf

# Allow provisioning Wi-Fi via serial
improv_serial:

# In combination with the `ap` this allows the user
# to provision wifi credentials to the device via WiFi AP.
captive_portal:

dashboard_import:
  package_import_url: github://esphome/firmware/esphome-web/esp32s3.yaml@main
  import_full_config: true

# Sets up Bluetooth LE (Only on ESP32) to allow the user
# to provision wifi credentials to the device.
esp32_improv:
  authorizer: none

# To have a "next url" for improv serial
web_server:

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

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

ota:
  platform: esphome

logger:
  level: DEBUG
  logs:
    esp32_ble_tracker: INFO
    esp32_ble_client: 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
#   id: mqtt_client

esp32_ble_tracker:
  scan_parameters:
    active: true

ble_client:
  - mac_address: ${bms0_mac_address}
    id: client0
  - mac_address: ${bms1_mac_address}
    id: client1
  - mac_address: ${bms2_mac_address}
    id: client2
  - mac_address: ${bms3_mac_address}
    id: client3

jk_bms_ble:
  - ble_client_id: client0
    protocol_version: ${bms0_protocol_version}
    throttle: 5s
    id: bms0
  - ble_client_id: client1
    protocol_version: ${bms1_protocol_version}
    throttle: 5s
    id: bms1
  - ble_client_id: client2
    protocol_version: ${bms2_protocol_version}
    throttle: 5s
    id: bms2
  - ble_client_id: client3
    protocol_version: ${bms3_protocol_version}
    throttle: 5s
    id: bms3

sensor:
  - platform: jk_bms_ble
    jk_bms_ble_id: bms0
    total_voltage:
      name: "${bms0} total voltage"
    total_runtime:
      name: "${bms0} total runtime"

  - platform: jk_bms_ble
    jk_bms_ble_id: bms1
    total_voltage:
      name: "${bms1} total voltage"
    total_runtime:
      name: "${bms1} total runtime"

  - platform: jk_bms_ble
    jk_bms_ble_id: bms2
    total_voltage:
      name: "${bms2} total voltage"
    total_runtime:
      name: "${bms2} total runtime"

  - platform: jk_bms_ble
    jk_bms_ble_id: bms3
    total_voltage:
      name: "${bms3} total voltage"
    total_runtime:
      name: "${bms3} total runtime"

text_sensor:
  - platform: jk_bms_ble
    jk_bms_ble_id: bms0
    errors:
      name: "${bms0} errors"
    total_runtime_formatted:
      name: "${bms0} total runtime formatted"

  - platform: jk_bms_ble
    jk_bms_ble_id: bms1
    errors:
      name: "${bms1} errors"
    total_runtime_formatted:
      name: "${bms1} total runtime formatted"

  - platform: jk_bms_ble
    jk_bms_ble_id: bms2
    errors:
      name: "${bms2} errors"
    total_runtime_formatted:
      name: "${bms2} total runtime formatted"

  - platform: jk_bms_ble
    jk_bms_ble_id: bms3
    errors:
      name: "${bms3} errors"
    total_runtime_formatted:
      name: "${bms3} total runtime formatted"

@trung729
Copy link
Author

logs_jk_run.txt
another error

@syssi
Copy link
Owner

syssi commented Dec 28, 2024

Please try a CLEAN build. There is a button somewhere at the dashboard. If you use the CLI please try:

esphome clean yourconfig.yaml
esphome run yourconfig.yaml

@trung729
Copy link
Author

Please show me how to cleab build, I will try

@syssi
Copy link
Owner

syssi commented Dec 28, 2024

Do you use the ESPHome Add-on in Home Assistant?

@syssi
Copy link
Owner

syssi commented Dec 28, 2024

esphome_dashboard_clean_build_files

@trung729
Copy link
Author

trung729 commented Dec 28, 2024 via email

@syssi
Copy link
Owner

syssi commented Dec 28, 2024

Did you find the button?

@trung729
Copy link
Author

the 2 new ones are still unknown "total runtime"

@syssi
Copy link
Owner

syssi commented Dec 28, 2024

Could you provide a log please?

@trung729
Copy link
Author

It does not have entities: "bms2 total runtime formated" and "bms3 total runtime formated"

@trung729
Copy link
Author

logs_jk_logs (1).txt

@syssi
Copy link
Owner

syssi commented Dec 29, 2024

Please flash the reduced example above. Your log shows sensors which arent part of my YAML.

@trung729
Copy link
Author

I have flash the reduced code above, and the log fife I have just shared

@syssi
Copy link
Owner

syssi commented Dec 29, 2024

Did you upload the wrong log? These are a few lines from the mentioned log above:

[00:17:05][D][sensor:094]: '_ bms1 cell resistance 5': Sending state 0.06400 Ω with 3 decimals of accuracy
[00:17:05][D][sensor:094]: '_ bms1 cell voltage 6': Sending state 3.27500 V with 3 decimals of accuracy
[00:17:05][D][sensor:094]: '_ bms1 cell resistance 6': Sending state 0.06400 Ω with 3 decimals of accuracy
[00:17:05][D][sensor:094]: '_ bms1 cell voltage 7': Sending state 3.27900 V with 3 decimals of accuracy
[00:17:05][D][sensor:094]: '_ bms1 cell resistance 7': Sending state 0.06800 Ω with 3 decimals of accuracy

It includes cell voltages and resistance.

The reduced version includes the runtimes only (this is important!): #642 (comment)

@trung729
Copy link
Author

trung729 commented Jan 1, 2025

I am surprised, too. I have flash your new code, and it still has that log

@syssi
Copy link
Owner

syssi commented Jan 1, 2025

Could you give it another try?

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

No branches or pull requests

2 participants