From a38b994f2bd7b4b92a98356cf0b1765a851eaa3f Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 22 Aug 2025 08:45:35 -0500 Subject: [PATCH 1/2] [esp32_ble] Increase GATT connection retry count to use full timeout window --- esphome/components/esp32_ble/__init__.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/esphome/components/esp32_ble/__init__.py b/esphome/components/esp32_ble/__init__.py index 2edd69c6c0..bc6d8e74df 100644 --- a/esphome/components/esp32_ble/__init__.py +++ b/esphome/components/esp32_ble/__init__.py @@ -280,6 +280,14 @@ async def to_code(config): add_idf_sdkconfig_option( "CONFIG_BT_BLE_ESTAB_LINK_CONN_TOUT", timeout_seconds ) + else: + # Default to 20 seconds if not specified + add_idf_sdkconfig_option("CONFIG_BT_BLE_ESTAB_LINK_CONN_TOUT", 20) + + # Increase GATT client connection retry count for problematic devices + # Default in ESP-IDF is 3, we increase to 10 for better reliability with + # low-power/timing-sensitive devices + add_idf_sdkconfig_option("CONFIG_BT_GATTC_CONNECT_RETRY_COUNT", 10) # Set the maximum number of notification registrations # This controls how many BLE characteristics can have notifications enabled From 29b25194babcd04dd49f75d90c095f82abeeafc8 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 22 Aug 2025 08:48:27 -0500 Subject: [PATCH 2/2] [esp32_ble] Increase GATT connection retry count to use full timeout window --- esphome/components/esp32_ble/__init__.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/esphome/components/esp32_ble/__init__.py b/esphome/components/esp32_ble/__init__.py index bc6d8e74df..cc06058b65 100644 --- a/esphome/components/esp32_ble/__init__.py +++ b/esphome/components/esp32_ble/__init__.py @@ -280,14 +280,10 @@ async def to_code(config): add_idf_sdkconfig_option( "CONFIG_BT_BLE_ESTAB_LINK_CONN_TOUT", timeout_seconds ) - else: - # Default to 20 seconds if not specified - add_idf_sdkconfig_option("CONFIG_BT_BLE_ESTAB_LINK_CONN_TOUT", 20) - - # Increase GATT client connection retry count for problematic devices - # Default in ESP-IDF is 3, we increase to 10 for better reliability with - # low-power/timing-sensitive devices - add_idf_sdkconfig_option("CONFIG_BT_GATTC_CONNECT_RETRY_COUNT", 10) + # Increase GATT client connection retry count for problematic devices + # Default in ESP-IDF is 3, we increase to 10 for better reliability with + # low-power/timing-sensitive devices + add_idf_sdkconfig_option("CONFIG_BT_GATTC_CONNECT_RETRY_COUNT", 10) # Set the maximum number of notification registrations # This controls how many BLE characteristics can have notifications enabled