[ble_client] Fix RSSI sensor reporting same value for all clients

When multiple ble_client RSSI sensors were configured, they all reported
the same RSSI value because the GAP event handler did not filter by
remote device address. Add an address check so each sensor only processes
RSSI events matching its parent client's device.

Fixes https://github.com/esphome/esphome/issues/14898

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jonathan Swoboda
2026-03-18 19:09:03 -04:00
co-authored by Claude Opus 4.6
parent a2a048e3bf
commit eebf27e239
@@ -47,6 +47,8 @@ void BLEClientRSSISensor::gap_event_handler(esp_gap_ble_cb_event_t event, esp_bl
switch (event) {
// server response on RSSI request:
case ESP_GAP_BLE_READ_RSSI_COMPLETE_EVT:
if (!this->parent()->check_addr(param->read_rssi_cmpl.remote_addr))
return;
if (param->read_rssi_cmpl.status == ESP_BT_STATUS_SUCCESS) {
int8_t rssi = param->read_rssi_cmpl.rssi;
ESP_LOGI(TAG, "ESP_GAP_BLE_READ_RSSI_COMPLETE_EVT RSSI: %d", rssi);