esphome / esphome/issues

ESP_GATTC_REG_FOR_NOTIFY_EVT not being recieved after ESP_GATTC_WRITE_CHAR_EVT

Open
#5,567 1 comment 0 reactions 0 assignees View on GitHub
stale
Dominant language
No language data
Stars
313
Forks
40
PR merge metrics
No merged PRs in 30d

Description

### The problem

I am running an ESPHome BLE proxy communicating with a BLE device.

The client device expects a `ESP_GATTC_WRITE_CHAR_EVT` and then the client device triggers a `ESP_GATTC_REG_FOR_NOTIFY_EVT` to the server.

This works with the ESPHome for about 30 minutes, then I get a `BT_APPL: gattc_conn_cb: if=3 st=0 id=3 rsn=0x13`

### Which version of ESPHome has the issue?

2024.2.1

### What type of installation are you using?

Home Assistant Add-on

### Which version of Home Assistant has the issue?

2024.2.5

### What platform are you using?

ESP32-IDF

### Board

Olimex ESP32-POE-ISO

### Component causing the issue

bluetooth_proxy

### Example YAML snippet

```yaml
esp32:
board: esp32-poe-iso
framework:
type: esp-idf

mdns:
disabled: false

logger:
level: DEBUG

ethernet:
type: LAN8720
mdc_pin: GPIO23
mdio_pin: GPIO18
clk_mode: GPIO17_OUT
phy_addr: 0
power_pin: GPIO12
domain: !secret domain

esp32_ble_tracker:
scan_parameters:
interval: 1100ms
window: 1100ms
active: true
continuous: true
duration: 1min

bluetooth_proxy:
active: true
cache_services: true

ble_client:
- mac_address: D8:B6:73:40:07:37
id: automower_305
```

### Anything in the logs that might be useful for us?

```txt
[14:21:19][I][bluetooth_proxy:282]: [0] [D8:B6:73:40:07:37] Connecting v3 without cache
[14:21:19][I][esp32_ble_client:067]: [0] [D8:B6:73:40:07:37] 0x00 Attempting BLE connection
[14:21:19][D][esp-idf:000]: W (446582) BT_GATT: gatt_connect wrong state 4

[14:21:19][D][esp32_ble_client:110]: [0] [D8:B6:73:40:07:37] ESP_GATTC_OPEN_EVT
[14:21:19][D][esp32_ble_client:110]: [0] [D8:B6:73:40:07:37] ESP_GATTC_SEARCH_CMPL_EVT
[14:21:19][I][esp32_ble_client:227]: [0] [D8:B6:73:40:07:37] Connected
[14:21:19][D][esp32_ble_client:188]: [0] [D8:B6:73:40:07:37] cfg_mtu status 0, mtu 65
[14:21:20][I][esp32_ble_client:333]: [0] [D8:B6:73:40:07:37] auth complete. remote BD_ADDR: d8b673400737
[14:21:20][D][esp32_ble_client:341]: [0] [D8:B6:73:40:07:37] auth success. address type = 0 auth mode = 1
[14:21:20][I][esp32_ble_client:333]: [3] [D8:B6:73:40:07:37] auth complete. remote BD_ADDR: d8b673400737
[14:21:20][D][esp32_ble_client:341]: [3] [D8:B6:73:40:07:37] auth success. address type = 0 auth mode = 1
[14:21:20][D][esp32_ble_client:110]: [0] [D8:B6:73:40:07:37] ESP_GATTC_READ_CHAR_EVT
[14:21:20][D][esp32_ble_client:110]: [0] [D8:B6:73:40:07:37] ESP_GATTC_READ_CHAR_EVT
[14:21:20][D][esp32_ble_client:110]: [0] [D8:B6:73:40:07:37] ESP_GATTC_READ_CHAR_EVT
[14:21:20][D][esp32_ble_client:110]: [0] [D8:B6:73:40:07:37] ESP_GATTC_READ_CHAR_EVT
[14:21:20][D][esp32_ble_client:110]: [0] [D8:B6:73:40:07:37] ESP_GATTC_READ_CHAR_EVT
[14:21:20][D][esp32_ble_client:110]: [0] [D8:B6:73:40:07:37] ESP_GATTC_REG_FOR_NOTIFY_EVT
[14:21:20][D][esp32_ble_client:110]: [0] [D8:B6:73:40:07:37] ESP_GATTC_WRITE_DESCR_EVT
[14:21:25][D][esp32_ble_client:110]: [0] [D8:B6:73:40:07:37] ESP_GATTC_WRITE_CHAR_EVT
[14:21:25][D][esp32_ble_client:110]: [0] [D8:B6:73:40:07:37] ESP_GATTC_WRITE_CHAR_EVT
[14:21:34][D][esp-idf:000]: W (461008) BT_APPL: gattc_conn_cb: if=3 st=0 id=3 rsn=0x13

[14:21:34][D][esp-idf:000]: W (461010) BT_APPL: gattc_conn_cb: if=4 st=0 id=4 rsn=0x13

[14:21:34][D][esp-idf:000]: W (461012) BT_APPL: gattc_conn_cb: if=5 st=0 id=5 rsn=0x13

[14:21:34][D][esp-idf:000]: W (461014) BT_APPL: gattc_conn_cb: if=6 st=0 id=6 rsn=0x13

[14:21:34][D][esp-idf:000]: W (461018) BT_HCI: hcif disc complete: hdl 0x0, rsn 0x13

[14:21:34][D][esp32_ble_client:172]: [0] [D8:B6:73:40:07:37] ESP_GATTC_DISCONNECT_EVT, reason 19
[14:21:34][D][esp32_ble_client:110]: [0] [] ESP_GATTC_CLOSE_EVT
[14:21:34][D][esp32_ble_client:172]: [3] [D8:B6:73:40:07:37] ESP_GATTC_DISCONNECT_EVT, reason 19
[14:21:34][D][esp32_ble_client:110]: [3] [D8:B6:73:40:07:37] ESP_GATTC_CLOSE_EVT
```
```

### Additional information

_No response_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.