ha-ef-ble icon indicating copy to clipboard operation
ha-ef-ble copied to clipboard

[Bug]: Frequent disconnects from Delta 3: Error writing char/descriptor at handle 0x10, status=133

Open backcountrymountains opened this issue 4 months ago • 7 comments

What happened?

I have an ESPhome BLE proxy and it keeps disconnecting from my Ecoflow Delta 3 (logs below). The device is about 3 meters from the proxy, so I don't think it's a signal issue. I changed the esp32_ble_tracker: settings to what was recommended but it didn't help.

I am using my BLE proxy to control some semi-smart BLE light switches using NicoIIT/esphome-ble_adv_proxy. I don't know if that is causing the issue. Also I have like 8 BLE temperature sensors that are constantly sending BLE data.

This is my ESPhome yaml:

esphome:
  name: "esp32-ble-proxy"
  friendly_name: Bluetooth Proxy
  min_version: 2024.6.0
  name_add_mac_suffix: true

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

# Enable logging
logger:

# Enable Home Assistant API
api:
  custom_services: true
  encryption:
    key: "pn8GX3zkfs9UDdybSil4qjscptW42JnoTdmaG0fma28="
    
ble_adv_proxy:
  use_max_tx_power: true # see below, remove in case of build issues

external_components:
  source: github://NicoIIT/esphome-ble_adv_proxy
  
ota:
#### Redacted#####

wifi:
####Redacted#######

  # Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
    ssid: "Ble-Proxy Fallback Hotspot"
    password: "jhZVI7D6gQz5"


esp32_ble_tracker:
  scan_parameters:
    window: 1100ms
    interval: 1100ms
    active: true

bluetooth_proxy:
  active: true

button:
  - platform: safe_mode
    id: button_safe_mode
    name: Safe Mode Boot

  - platform: factory_reset
    id: factory_reset_btn
    name: Factory reset

What version of our software are you running?

EcoFlow BLE (Unofficial) Version 0.4.15

What device are you seeing the problem on?

Delta 3 (not plus)

What bluetooth connection are you using?

ESPHome bluetooth proxy

Have you changed the integration settings?

No response

Integration settings (if you changed them)


Relevant log output

[08:51:48][D][esp32_ble_client:208]: [0] [F0:F5:BD:25:BA:A2] ESP_GATTC_WRITE_CHAR_EVT
[08:51:48][W][bluetooth_proxy.connection:084]: [0] [F0:F5:BD:25:BA:A2] Error writing char/descriptor at handle 0x10, status=133
[08:51:48][D][esp32_ble_client:297]: [0] [F0:F5:BD:25:BA:A2] ESP_GATTC_DISCONNECT_EVT, reason 8
[08:51:48][D][esp32_ble_client:208]: [0] [] ESP_GATTC_CLOSE_EVT
[08:51:48][I][bluetooth_proxy:402]: [0] [F0:F5:BD:25:BA:A2] Connecting v3 with cache
[08:51:48][D][esp32_ble_tracker:116]: connecting: 0, discovered: 1, searching: 0, disconnecting: 0
[08:51:48][D][esp32_ble_tracker:234]: Stopping scan to make connection
[08:51:48][D][esp32_ble_tracker:343]: End of scan, set scanner state to IDLE.
[08:51:48][D][esp32_ble_tracker:237]: Promoting client to connect
[08:51:48][D][esp32_ble_tracker:241]: Setting coexistence to Bluetooth to make connection.
[08:51:48][I][esp32_ble_client:127]: [0] [F0:F5:BD:25:BA:A2] 0x00 Attempting BLE connection
[08:51:48][D][esp32_ble_tracker:116]: connecting: 1, discovered: 0, searching: 0, disconnecting: 0
[08:51:52][D][esp32_ble_client:208]: [0] [F0:F5:BD:25:BA:A2] ESP_GATTC_CONNECT_EVT
[08:51:52][D][esp32_ble_client:208]: [0] [F0:F5:BD:25:BA:A2] ESP_GATTC_OPEN_EVT
[08:51:52][I][esp32_ble_client:280]: [0] [F0:F5:BD:25:BA:A2] Connected
[08:51:52][D][esp32_ble_tracker:116]: connecting: 0, discovered: 0, searching: 0, disconnecting: 0
[08:51:52][D][esp32_ble_tracker:217]: Setting coexistence preference to balanced.
[08:51:52][D][esp32_ble_tracker:307]: Starting scan, set scanner state to STARTING.
[08:51:52][D][esp32_ble_client:313]: [0] [F0:F5:BD:25:BA:A2] cfg_mtu status 0, mtu 500
[08:51:52][D][esp32_ble_client:208]: [0] [F0:F5:BD:25:BA:A2] ESP_GATTC_REG_FOR_NOTIFY_EVT
[08:51:52][D][esp32_ble_client:208]: [0] [F0:F5:BD:25:BA:A2] ESP_GATTC_WRITE_DESCR_EVT
[08:51:52][D][esp32_ble_client:208]: [0] [F0:F5:BD:25:BA:A2] ESP_GATTC_NOTIFY_EVT
[08:51:52][D][esp32_ble_client:208]: [0] [F0:F5:BD:25:BA:A2] ESP_GATTC_WRITE_CHAR_EVT
[08:51:52][D][esp32_ble_client:433]: [0] [F0:F5:BD:25:BA:A2] Event 39
[08:51:52][D][esp32_ble_client:208]: [0] [F0:F5:BD:25:BA:A2] ESP_GATTC_REG_FOR_NOTIFY_EVT
[08:51:52][D][esp32_ble_client:208]: [0] [F0:F5:BD:25:BA:A2] ESP_GATTC_WRITE_DESCR_EVT
[08:51:52][D][esp32_ble_client:208]: [0] [F0:F5:BD:25:BA:A2] ESP_GATTC_NOTIFY_EVT
[08:51:52][D][esp32_ble_client:208]: [0] [F0:F5:BD:25:BA:A2] ESP_GATTC_WRITE_CHAR_EVT
[08:51:52][D][esp32_ble_client:433]: [0] [F0:F5:BD:25:BA:A2] Event 39
[08:51:52][D][esp32_ble_client:208]: [0] [F0:F5:BD:25:BA:A2] ESP_GATTC_REG_FOR_NOTIFY_EVT
[08:51:53][D][esp32_ble_client:208]: [0] [F0:F5:BD:25:BA:A2] ESP_GATTC_WRITE_DESCR_EVT
[08:51:53][D][esp32_ble_client:208]: [0] [F0:F5:BD:25:BA:A2] ESP_GATTC_NOTIFY_EVT
[08:51:53][D][esp32_ble_client:208]: [0] [F0:F5:BD:25:BA:A2] ESP_GATTC_WRITE_CHAR_EVT
[08:51:53][D][ble_adv_proxy:127]: [A4:C1:38:BF:8A:5B] recv raw - 0d09475648353037355f38413542030388ec02010509ff88ec0003e9a93800
[08:51:53][D][esp32_ble_client:433]: [0] [F0:F5:BD:25:BA:A2] Event 39
[08:51:53][D][esp32_ble_client:208]: [0] [F0:F5:BD:25:BA:A2] ESP_GATTC_REG_FOR_NOTIFY_EVT
[08:51:53][D][esp32_ble_client:208]: [0] [F0:F5:BD:25:BA:A2] ESP_GATTC_WRITE_DESCR_EVT
[08:51:53][D][esp32_ble_client:208]: [0] [F0:F5:BD:25:BA:A2] ESP_GATTC_NOTIFY_EVT
[08:51:53][D][esp32_ble_client:208]: [0] [F0:F5:BD:25:BA:A2] ESP_GATTC_WRITE_CHAR_EVT
[08:51:53][D][esp32_ble_client:208]: [0] [F0:F5:BD:25:BA:A2] ESP_GATTC_NOTIFY_EVT
[08:51:54][D][esp32_ble_client:208]: [0] [F0:F5:BD:25:BA:A2] ESP_GATTC_WRITE_CHAR_EVT
[08:51:54][D][ble_adv_proxy:127]: [B8:3A:9D:87:EF:FF] recv raw - 020104020a00
[08:51:54][D][ble_adv_proxy:127]: [A4:C1:38:F9:DD:2B] recv raw - 0d09475648353037355f44443242030388ec02010509ff88ec0003423d3000
[08:51:56][D][ble_adv_proxy:127]: [A4:C1:38:8E:6D:3E] recv raw - 0d09475648353037355f36443345030388ec02010509ff88ec0003c6a84900
[08:51:56][D][ble_adv_proxy:127]: [A4:C1:38:DA:7A:AB] recv raw - 0d09475648353037355f37414142030388ec02010509ff88ec0003b31d3800
[08:51:57][D][ble_adv_proxy:127]: [4D:C8:EA:55:92:BC] recv raw - 1aff4c0002154b408fec140a4ddd951940e5b782ad8c00640001c5
[08:51:58][D][esp32_ble_client:208]: [0] [F0:F5:BD:25:BA:A2] ESP_GATTC_WRITE_CHAR_EVT
[08:51:58][W][bluetooth_proxy.connection:084]: [0] [F0:F5:BD:25:BA:A2] Error writing char/descriptor at handle 0x10, status=133
[08:51:58][D][esp32_ble_client:297]: [0] [F0:F5:BD:25:BA:A2] ESP_GATTC_DISCONNECT_EVT, reason 8
[08:51:58][D][esp32_ble_client:208]: [0] [] ESP_GATTC_CLOSE_EVT

backcountrymountains avatar Aug 20 '25 14:08 backcountrymountains

Hello, I see you're using default config for scanning - there's a section in wiki that will most likely help you.

GnoX avatar Aug 20 '25 15:08 GnoX

Hello, I see you're using default config for scanning - there's a section in wiki that will most likely help you.

Do you mean changing the window and interval? I changed each to 1100ms but that seemed to make it worse. The esphome-ble_adv_proxy settings recommend changing each to 20ms so maybe there is just a conflict between the requirements for this and the ble_adv_proxy.

backcountrymountains avatar Aug 20 '25 15:08 backcountrymountains

I thought I saw that exact interval somewhere in examples, but maybe not. Anyways, did you try to just remove both intervals from config? That's what the wiki suggests to do.

GnoX avatar Aug 20 '25 15:08 GnoX

Okay, so, I didn't realize that the red highlighting meant delete those lines. I added those lines! Oops! Can we change the faq to clearly say with words that those lines should be deleted? I see now in the linked ha community post that it says "and quickly found that I need to remove those lines to make the connection stable:"

I set them to the defaults and it seems to be working now.

Thanks! This is really cool and I'm glad I don't need to use the ecoflow app. I do wish this BLE communication could be ported/adapted to an open source android app so I wouldn't ever need the ecoflow app and I could use it camping when I don't have internet!

backcountrymountains avatar Aug 20 '25 15:08 backcountrymountains

Are you aware that you're still able to use the official Ecoflow app without the internet over bluetooth?

GnoX avatar Aug 21 '25 20:08 GnoX

I use android and it will occasionally delete all information from my apps because I haven't used them in a while, "for my safety." I found this out when I was camping away from the internet and I tried to load my Ecoflow app but I couldn't use the app because I had to re-login and I didn't have the internet, which is why I'd like an android app that can just connect via bluetooth without the need to ever use the internet.

Looking at my logbook, it seems like this integration reconnects every 20-30 minutes but I did figure out how to turn off the beeping from the battery when it reconnects so I don't really notice it.

backcountrymountains avatar Aug 22 '25 23:08 backcountrymountains

I use android and it will occasionally delete all information from my apps because I haven't used them in a while

I see, now it makes sense.

GnoX avatar Aug 23 '25 20:08 GnoX