From 15852a3cfe846df06ce41eb994011370809d6264 Mon Sep 17 00:00:00 2001 From: Rapsssito Date: Sat, 29 Jun 2024 11:58:14 +0200 Subject: [PATCH] Fix improv service --- esphome/components/esp32_improv/__init__.py | 9 +-------- .../components/esp32_improv/esp32_improv_component.cpp | 2 +- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/esphome/components/esp32_improv/__init__.py b/esphome/components/esp32_improv/__init__.py index 550c6df570..0c36699255 100644 --- a/esphome/components/esp32_improv/__init__.py +++ b/esphome/components/esp32_improv/__init__.py @@ -17,16 +17,12 @@ CONF_STATUS_INDICATOR = "status_indicator" CONF_WIFI_TIMEOUT = "wifi_timeout" esp32_improv_ns = cg.esphome_ns.namespace("esp32_improv") -BLEServiceComponent = cg.esphome_ns.namespace("esp32_ble_server").class_("BLEServiceComponent") -ESP32ImprovComponent = esp32_improv_ns.class_( - "ESP32ImprovComponent", cg.Component, BLEServiceComponent -) +ESP32ImprovComponent = esp32_improv_ns.class_("ESP32ImprovComponent", cg.Component) CONFIG_SCHEMA = cv.Schema( { cv.GenerateID(): cv.declare_id(ESP32ImprovComponent), - cv.GenerateID(CONF_BLE_SERVER_ID): cv.use_id(esp32_ble_server.BLEServer), cv.Required(CONF_AUTHORIZER): cv.Any( cv.none, cv.use_id(binary_sensor.BinarySensor) ), @@ -48,9 +44,6 @@ async def to_code(config): var = cg.new_Pvariable(config[CONF_ID]) await cg.register_component(var, config) - ble_server = await cg.get_variable(config[CONF_BLE_SERVER_ID]) - cg.add(ble_server.register_service_component(var)) - cg.add_define("USE_IMPROV") cg.add_library("esphome/Improv", "1.2.3") diff --git a/esphome/components/esp32_improv/esp32_improv_component.cpp b/esphome/components/esp32_improv/esp32_improv_component.cpp index 011ba95da8..6626f3042f 100644 --- a/esphome/components/esp32_improv/esp32_improv_component.cpp +++ b/esphome/components/esp32_improv/esp32_improv_component.cpp @@ -76,7 +76,7 @@ void ESP32ImprovComponent::loop() { // Setup the service ESP_LOGD(TAG, "Creating Improv service"); this->service_ = global_ble_server->create_service(ESPBTUUID::from_raw(improv::SERVICE_UUID), true); - this->service_->on_client_disconnect([this]() { this->set_error_(improv::ERROR_NONE); }); + this->service_->on_client_disconnect([this](const uint16_t conn_id) { this->set_error_(improv::ERROR_NONE); }); this->setup_characteristics(); }