diff --git a/esphome/components/bluetooth_proxy/__init__.py b/esphome/components/bluetooth_proxy/__init__.py index 9c566c56a5..bec1579d8e 100644 --- a/esphome/components/bluetooth_proxy/__init__.py +++ b/esphome/components/bluetooth_proxy/__init__.py @@ -2,11 +2,13 @@ from esphome.components import esp32_ble_tracker, esp32_ble_client import esphome.config_validation as cv import esphome.codegen as cg from esphome.const import CONF_ACTIVE, CONF_ID +from esphome.components.esp32 import add_idf_sdkconfig_option AUTO_LOAD = ["esp32_ble_client", "esp32_ble_tracker"] DEPENDENCIES = ["api", "esp32"] CODEOWNERS = ["@jesserockz"] +CONF_CACHE_SERVICES = "cache_services" CONF_CONNECTIONS = "connections" MAX_CONNECTIONS = 3 @@ -47,6 +49,9 @@ CONFIG_SCHEMA = cv.All( { cv.GenerateID(): cv.declare_id(BluetoothProxy), cv.Optional(CONF_ACTIVE, default=False): cv.boolean, + cv.SplitDefault(CONF_CACHE_SERVICES, esp32_idf=True): cv.All( + cv.only_with_esp_idf, cv.boolean + ), cv.Optional(CONF_CONNECTIONS): cv.All( cv.ensure_list(CONNECTION_SCHEMA), cv.Length(min=1, max=MAX_CONNECTIONS), @@ -72,4 +77,7 @@ async def to_code(config): cg.add(var.register_connection(connection_var)) await esp32_ble_tracker.register_client(connection_var, connection_conf) + if config.get(CONF_CACHE_SERVICES): + add_idf_sdkconfig_option("CONFIG_BT_GATTC_CACHE_NVS_FLASH", True) + cg.add_define("USE_BLUETOOTH_PROXY") diff --git a/esphome/components/cd74hc4067/__init__.py b/esphome/components/cd74hc4067/__init__.py index 4fb15d1bf3..d57061b710 100644 --- a/esphome/components/cd74hc4067/__init__.py +++ b/esphome/components/cd74hc4067/__init__.py @@ -27,10 +27,10 @@ DEFAULT_DELAY = "2ms" CONFIG_SCHEMA = cv.Schema( { cv.GenerateID(): cv.declare_id(CD74HC4067Component), - cv.Required(CONF_PIN_S0): pins.internal_gpio_output_pin_schema, - cv.Required(CONF_PIN_S1): pins.internal_gpio_output_pin_schema, - cv.Required(CONF_PIN_S2): pins.internal_gpio_output_pin_schema, - cv.Required(CONF_PIN_S3): pins.internal_gpio_output_pin_schema, + cv.Required(CONF_PIN_S0): pins.gpio_output_pin_schema, + cv.Required(CONF_PIN_S1): pins.gpio_output_pin_schema, + cv.Required(CONF_PIN_S2): pins.gpio_output_pin_schema, + cv.Required(CONF_PIN_S3): pins.gpio_output_pin_schema, cv.Optional( CONF_DELAY, default=DEFAULT_DELAY ): cv.positive_time_period_milliseconds, diff --git a/esphome/components/cd74hc4067/cd74hc4067.h b/esphome/components/cd74hc4067/cd74hc4067.h index 4a5c2e4e35..6193513575 100644 --- a/esphome/components/cd74hc4067/cd74hc4067.h +++ b/esphome/components/cd74hc4067/cd74hc4067.h @@ -19,22 +19,22 @@ class CD74HC4067Component : public Component { void activate_pin(uint8_t pin); /// set the pin connected to multiplexer control pin 0 - void set_pin_s0(InternalGPIOPin *pin) { this->pin_s0_ = pin; } + void set_pin_s0(GPIOPin *pin) { this->pin_s0_ = pin; } /// set the pin connected to multiplexer control pin 1 - void set_pin_s1(InternalGPIOPin *pin) { this->pin_s1_ = pin; } + void set_pin_s1(GPIOPin *pin) { this->pin_s1_ = pin; } /// set the pin connected to multiplexer control pin 2 - void set_pin_s2(InternalGPIOPin *pin) { this->pin_s2_ = pin; } + void set_pin_s2(GPIOPin *pin) { this->pin_s2_ = pin; } /// set the pin connected to multiplexer control pin 3 - void set_pin_s3(InternalGPIOPin *pin) { this->pin_s3_ = pin; } + void set_pin_s3(GPIOPin *pin) { this->pin_s3_ = pin; } /// set the delay needed after an input switch void set_switch_delay(uint32_t switch_delay) { this->switch_delay_ = switch_delay; } private: - InternalGPIOPin *pin_s0_; - InternalGPIOPin *pin_s1_; - InternalGPIOPin *pin_s2_; - InternalGPIOPin *pin_s3_; + GPIOPin *pin_s0_; + GPIOPin *pin_s1_; + GPIOPin *pin_s2_; + GPIOPin *pin_s3_; /// the currently active pin uint8_t active_pin_; uint32_t switch_delay_; diff --git a/esphome/components/esp32/__init__.py b/esphome/components/esp32/__init__.py index 75dc68020f..3989b62842 100644 --- a/esphome/components/esp32/__init__.py +++ b/esphome/components/esp32/__init__.py @@ -398,11 +398,11 @@ spiffs, data, spiffs, 0x391000, 0x00F000 IDF_PARTITIONS_CSV = """\ # Name, Type, SubType, Offset, Size, Flags -nvs, data, nvs, , 0x4000, otadata, data, ota, , 0x2000, phy_init, data, phy, , 0x1000, app0, app, ota_0, , 0x1C0000, app1, app, ota_1, , 0x1C0000, +nvs, data, nvs, , 0x6d000, """ diff --git a/esphome/components/esp32_ble_client/ble_client_base.cpp b/esphome/components/esp32_ble_client/ble_client_base.cpp index 658f6c464e..dd6fc94127 100644 --- a/esphome/components/esp32_ble_client/ble_client_base.cpp +++ b/esphome/components/esp32_ble_client/ble_client_base.cpp @@ -95,7 +95,9 @@ void BLEClientBase::release_services() { for (auto &svc : this->services_) delete svc; // NOLINT(cppcoreguidelines-owning-memory) this->services_.clear(); +#ifndef CONFIG_BT_GATTC_CACHE_NVS_FLASH esp_ble_gattc_cache_clean(this->remote_bda_); +#endif } bool BLEClientBase::gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t esp_gattc_if, diff --git a/esphome/const.py b/esphome/const.py index 4783d868d7..4b14ce7e40 100644 --- a/esphome/const.py +++ b/esphome/const.py @@ -1,6 +1,6 @@ """Constants used by esphome.""" -__version__ = "2022.12.0b4" +__version__ = "2022.12.0b5" ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"