mirror of
https://github.com/esphome/esphome.git
synced 2025-10-31 23:21:54 +00:00
[ble_client] Fix premature disconnections by reading characteristics immediately after service discovery
This commit is contained in:
@@ -77,6 +77,9 @@ void BLESensor::gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t ga
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this->node_state = espbt::ClientState::ESTABLISHED;
|
this->node_state = espbt::ClientState::ESTABLISHED;
|
||||||
|
// For non-notify characteristics, trigger an immediate read after service discovery
|
||||||
|
// to avoid peripherals disconnecting due to inactivity
|
||||||
|
this->update();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,6 +79,9 @@ void BLETextSensor::gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this->node_state = espbt::ClientState::ESTABLISHED;
|
this->node_state = espbt::ClientState::ESTABLISHED;
|
||||||
|
// For non-notify characteristics, trigger an immediate read after service discovery
|
||||||
|
// to avoid peripherals disconnecting due to inactivity
|
||||||
|
this->update();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user