diff --git a/esphome/components/ble_client/ble_client_gatt.cpp b/esphome/components/ble_client/ble_client_gatt.cpp index 7d4b8f2543..deb8801e3c 100644 --- a/esphome/components/ble_client/ble_client_gatt.cpp +++ b/esphome/components/ble_client/ble_client_gatt.cpp @@ -201,12 +201,13 @@ void BLEClient::on_notify_data(uint16_t handle, const uint8_t *data, uint16_t le } void BLEClient::on_notify_state(uint16_t handle, bool enabled, int error) { - // Breadcrumb only until the first notify node lands; a dropped failure - // here would otherwise be silent on a frozen surface. if (error != 0) { ESP_LOGW(TAG, "[%s] Notify %s on handle 0x%04x failed, status=%d", this->address_str_, enabled ? "enable" : "disable", handle, error); } + for (auto *node : this->nodes_) { + node->on_notify_state(handle, enabled, error); + } } void BLEClient::on_pairing_result(int status) { diff --git a/esphome/components/ble_client/ble_client_gatt.h b/esphome/components/ble_client/ble_client_gatt.h index c1fdae7eec..a72a0cd1e6 100644 --- a/esphome/components/ble_client/ble_client_gatt.h +++ b/esphome/components/ble_client/ble_client_gatt.h @@ -37,6 +37,7 @@ class BLEClientNode { virtual void on_connected(const ble_device_base::GattServiceTable &table) {} virtual void on_disconnected() {} virtual void on_notify(uint16_t handle, const uint8_t *data, uint16_t len) {} + virtual void on_notify_state(uint16_t handle, bool enabled, int error) {} virtual void on_read_result(uint16_t handle, const uint8_t *data, uint16_t len, int error) {} virtual void on_write_result(uint16_t handle, int error) {}