1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-02 03:12:20 +01:00

Merge branch 'open_error_fix' into integration

This commit is contained in:
J. Nick Koston
2025-08-20 14:54:31 -05:00
4 changed files with 40 additions and 2 deletions

View File

@@ -1 +1 @@
6af8b429b94191fe8e239fcb3b73f7982d0266cb5b05ffbc81edaeac1bc8c273
0440e35cf89a49e8a35fd3690ed453a72b7b6f61b9d346ced6140e1c0d39dff6

View File

@@ -284,11 +284,22 @@ bool BLEClientBase::gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_
this->log_gattc_event_("OPEN");
// conn_id was already set in ESP_GATTC_CONNECT_EVT
this->service_count_ = 0;
// ESP-IDF's BLE stack may send ESP_GATTC_OPEN_EVT after esp_ble_gattc_open() returns an
// error, if the error occurred at the BTA/GATT layer. This can result in the event
// arriving after we've already transitioned to IDLE state.
if (this->state_ == espbt::ClientState::IDLE) {
ESP_LOGD(TAG, "[%d] [%s] ESP_GATTC_OPEN_EVT in IDLE state (status=%d), ignoring", this->connection_index_,
this->address_str_.c_str(), param->open.status);
break;
}
if (this->state_ != espbt::ClientState::CONNECTING) {
// This should not happen but lets log it in case it does
// because it means we have a bad assumption about how the
// ESP BT stack works.
this->log_error_("ESP_GATTC_OPEN_EVT wrong state status", param->open.status);
ESP_LOGE(TAG, "[%d] [%s] Got ESP_GATTC_OPEN_EVT in %s state (status=%d)", this->connection_index_,
this->address_str_.c_str(), espbt::client_state_to_string(this->state_), param->open.status);
}
if (param->open.status != ESP_GATT_OK && param->open.status != ESP_GATT_ALREADY_OPEN) {
this->log_gattc_warning_("Connection open", param->open.status);

View File

@@ -357,6 +357,19 @@ build_flags =
${common:esp32-idf.build_flags}
${flags:runtime.build_flags}
-DUSE_ESP32_VARIANT_ESP32C6
build_unflags =
${common.build_unflags}
[env:esp32c6-idf-tidy]
extends = common:esp32-idf
board = esp32-c6-devkitc-1
board_build.esp-idf.sdkconfig_path = .temp/sdkconfig-esp32c6-idf-tidy
build_flags =
${common:esp32-idf.build_flags}
${flags:clangtidy.build_flags}
-DUSE_ESP32_VARIANT_ESP32C6
build_unflags =
${common.build_unflags}
;;;;;;;; ESP32-S2 ;;;;;;;;

View File

@@ -0,0 +1,14 @@
wifi:
ssid: MySSID
password: password1
api:
esphome:
on_boot:
then:
- homeassistant.tag_scanned: 'test_tag_123'
- homeassistant.tag_scanned:
tag: 'another_tag'
- homeassistant.tag_scanned:
tag: !lambda 'return "dynamic_tag";'