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

not able to connect to more then 3 BLE clients #112

Open
JanStry opened this issue Jan 1, 2025 · 2 comments
Open

not able to connect to more then 3 BLE clients #112

JanStry opened this issue Jan 1, 2025 · 2 comments

Comments

@JanStry
Copy link

JanStry commented Jan 1, 2025

Hi, i have a problem when i connect more then 3 clients at the same time.
when i manually disconnect one or more working clients the 4th client connects.

here are some logs:

[00:44:21][D][esp-idf:000][BTU_TASK]: W (71132) BT_HCI: btu_hcif_hdl_command_status,opcode:0x200d,status:0x09
[00:44:21][D][esp-idf:000][BTU_TASK]: W (71137) BT_APPL: gattc_conn_cb: if=3 st=0 id=771 rsn=0x100
[00:44:21][D][esp-idf:000][BTU_TASK]: W (71140) BT_APPL: gattc_conn_cb: if=4 st=0 id=772 rsn=0x100
[00:44:21][D][esp-idf:000][BTU_TASK]: W (71152) BT_APPL: gattc_conn_cb: if=5 st=0 id=773 rsn=0x100
[00:44:21][D][esp-idf:000][BTU_TASK]: W (71161) BT_APPL: gattc_conn_cb: if=6 st=0 id=774 rsn=0x100
[00:44:21][W][esp32_ble_client:142]: [2] [A5:C2:37:2A:06:37] Connection failed, status=133

btu_hcif_hdl_command_status,opcode:0x200d,status:0x09:
according to espidf 0x09 error means :" BLE Connection Limit Exceeded"

however i am sure esphome ESP32 can connect to at least 7 BLE devices at the same time...
maybe there is some limiter set in the BLE library?

kind regards

@syssi
Copy link
Owner

syssi commented Jan 1, 2025

Which ESP32 model do you use? Did you try to re-order the different devices / ble_client connections just for testing?

In the past there was a hard limit at 3 simultaneous connections: esphome/esphome@1a71cc3

Do you use ESP-IDF as platform? Could you share your YAML configuration?

@JanStry
Copy link
Author

JanStry commented Jan 2, 2025

Hi, im using the ESP32doit devkit v1.
I did not try to reorder the mac addresses..would that make a difference?
compiling with latest ESPHome version 2024.12.2 via CL

this is my YAML config:


substitutions:
name: xxx
bms0: "${name} bms0"
bms1: "${name} bms1"
bms2: "${name} bms2"
bms3: "${name} bms3"
device_description: "Monitor and control a Xiaoxiang Battery Management System (JBD-BMS) via BLE"
external_components_source: github://syssi/esphome-jbd-bms@main
bms0_mac_address: A5:C2:37:36:D9:xx
bms1_mac_address: A5:C2:37:36:CA:xx
bms2_mac_address: A5:C2:37:2A:06:xx
bms3_mac_address: A5:C2:37:2A:0A:xx

esphome:
name: ${name}
comment: ${device_description}
min_version: 2024.6.0
project:
name: "syssi.esphome-jbd-bms"
version: 2.0.0

esp32:
board: esp32doit-devkit-v1
framework:
type: esp-idf

external_components:

  • source: ${external_components_source}
    refresh: 0s

wifi:
ssid: "xxxxxxxxx"
password: "xxxxxxxx"

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

logger:
level: DEBUG
logs:
esp32_ble_tracker: INFO
esp32_ble_client: INFO

api:

esp32_ble_tracker:
scan_parameters:
active: false

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

jbd_bms_ble:

  • id: bms0
    ble_client_id: client0
    update_interval: 5s
  • id: bms1
    ble_client_id: client1
    update_interval: 5s
  • id: bms2
    ble_client_id: client2
    update_interval: 5s
  • id: bms3
    ble_client_id: client3
    update_interval: 5s

binary_sensor:

  • platform: jbd_bms_ble
    jbd_bms_ble_id: bms0
    balancing:
    name: "${bms0} balancing"
    charging:
    name: "${bms0} charging"
    discharging:
    name: "${bms0} discharging"
    online_status:
    name: "${bms0} online status"

  • platform: jbd_bms_ble
    jbd_bms_ble_id: bms1
    balancing:
    name: "${bms1} balancing"
    charging:
    name: "${bms1} charging"
    discharging:
    name: "${bms1} discharging"
    online_status:
    name: "${bms1} online status"

  • platform: jbd_bms_ble
    jbd_bms_ble_id: bms2
    balancing:
    name: "${bms2} balancing"
    charging:
    name: "${bms2} charging"
    discharging:
    name: "${bms2} discharging"
    online_status:
    name: "${bms2} online status"

  • platform: jbd_bms_ble
    jbd_bms_ble_id: bms3
    balancing:
    name: "${bms3} balancing"
    charging:
    name: "${bms3} charging"
    discharging:
    name: "${bms3} discharging"
    online_status:
    name: "${bms3} online status"

sensor:

  • platform: jbd_bms_ble
    jbd_bms_ble_id: bms0
    power:
    name: "${bms0} power"
    state_of_charge:
    name: "${bms0} state of charge"
    total_voltage:
    name: "${bms0} total voltage"
    average_cell_voltage:
    name: "${bms0} average cell voltage"
    delta_cell_voltage:
    name: "${bms0} delta cell voltage"

  • platform: jbd_bms_ble
    jbd_bms_ble_id: bms1
    power:
    name: "${bms1} power"
    state_of_charge:
    name: "${bms1} state of charge"
    total_voltage:
    name: "${bms1} total voltage"
    average_cell_voltage:
    name: "${bms1} average cell voltage"
    delta_cell_voltage:
    name: "${bms1} delta cell voltage"

  • platform: jbd_bms_ble
    jbd_bms_ble_id: bms2
    power:
    name: "${bms2} power"
    state_of_charge:
    name: "${bms2} state of charge"
    total_voltage:
    name: "${bms2} total voltage"
    average_cell_voltage:
    name: "${bms2} average cell voltage"
    delta_cell_voltage:
    name: "${bms2} delta cell voltage"

  • platform: jbd_bms_ble
    jbd_bms_ble_id: bms3
    power:
    name: "${bms3} power"
    state_of_charge:
    name: "${bms3} state of charge"
    total_voltage:
    name: "${bms3} total voltage"
    average_cell_voltage:
    name: "${bms3} average cell voltage"
    delta_cell_voltage:
    name: "${bms3} delta cell voltage"

text_sensor:

  • platform: jbd_bms_ble
    jbd_bms_ble_id: bms0
    errors:
    name: "${bms0} errors"
    operation_status:
    name: "${bms0} operation status"
    device_model:
    name: "${bms0} device model"

  • platform: jbd_bms_ble
    jbd_bms_ble_id: bms1
    errors:
    name: "${bms1} errors"
    operation_status:
    name: "${bms1} operation status"
    device_model:
    name: "${bms1} device model"

  • platform: jbd_bms_ble
    jbd_bms_ble_id: bms2
    errors:
    name: "${bms2} errors"
    operation_status:
    name: "${bms2} operation status"
    device_model:
    name: "${bms2} device model"

  • platform: jbd_bms_ble
    jbd_bms_ble_id: bms3
    errors:
    name: "${bms3} errors"
    operation_status:
    name: "${bms3} operation status"
    device_model:
    name: "${bms3} device model"

switch:

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

  • platform: ble_client
    ble_client_id: client1
    id: ble_client_switch1
    name: "${bms1} enable bluetooth connection"

  • platform: ble_client
    ble_client_id: client2
    id: ble_client_switch2
    name: "${bms2} enable bluetooth connection"

  • platform: ble_client
    ble_client_id: client3
    id: ble_client_switch3
    name: "${bms3} enable bluetooth connection"

  • platform: jbd_bms_ble
    jbd_bms_ble_id: bms0
    charging:
    name: "${bms0} charging"
    discharging:
    name: "${bms0} discharging"

  • platform: jbd_bms_ble
    jbd_bms_ble_id: bms1
    charging:
    name: "${bms1} charging"
    discharging:
    name: "${bms1} discharging"

  • platform: jbd_bms_ble
    jbd_bms_ble_id: bms2
    charging:
    name: "${bms2} charging"
    discharging:
    name: "${bms2} discharging"

  • platform: jbd_bms_ble
    jbd_bms_ble_id: bms3
    charging:
    name: "${bms3} charging"
    discharging:
    name: "${bms3} discharging"

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

No branches or pull requests

2 participants