From 34387adbcdd91491812d2e2aaff04ff20dacf133 Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Wed, 7 Dec 2022 17:00:11 +1300 Subject: [PATCH 001/131] Bump version to 2023.1.0-dev --- esphome/const.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esphome/const.py b/esphome/const.py index f0005d7e08..19fc226dd9 100644 --- a/esphome/const.py +++ b/esphome/const.py @@ -1,6 +1,6 @@ """Constants used by esphome.""" -__version__ = "2022.12.0-dev" +__version__ = "2023.1.0-dev" ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_" From 92e44b8238d0190ec2b7c04303f766e43b3509f8 Mon Sep 17 00:00:00 2001 From: John Britton Date: Wed, 7 Dec 2022 01:27:14 -0500 Subject: [PATCH 002/131] Expose lambda action to reset a cycle in `slow_pwm` (#4158) --- esphome/components/slow_pwm/slow_pwm_output.cpp | 2 +- esphome/components/slow_pwm/slow_pwm_output.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/esphome/components/slow_pwm/slow_pwm_output.cpp b/esphome/components/slow_pwm/slow_pwm_output.cpp index 81c721a866..d6b2cdfe12 100644 --- a/esphome/components/slow_pwm/slow_pwm_output.cpp +++ b/esphome/components/slow_pwm/slow_pwm_output.cpp @@ -70,7 +70,7 @@ void SlowPWMOutput::dump_config() { void SlowPWMOutput::write_state(float state) { this->state_ = state; if (this->restart_cycle_on_state_change_) - this->period_start_time_ = millis(); + this->restart_cycle(); } } // namespace slow_pwm diff --git a/esphome/components/slow_pwm/slow_pwm_output.h b/esphome/components/slow_pwm/slow_pwm_output.h index be45736864..3e5a3e2a40 100644 --- a/esphome/components/slow_pwm/slow_pwm_output.h +++ b/esphome/components/slow_pwm/slow_pwm_output.h @@ -14,6 +14,7 @@ class SlowPWMOutput : public output::FloatOutput, public Component { void set_restart_cycle_on_state_change(bool restart_cycle_on_state_change) { restart_cycle_on_state_change_ = restart_cycle_on_state_change; } + void restart_cycle() { this->period_start_time_ = millis(); } /// Initialize pin void setup() override; From 0c24d951ff07bccd982443733ecce0675e93833d Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Thu, 8 Dec 2022 13:39:33 +1300 Subject: [PATCH 003/131] Fix ble parsing with zero padded advertisements (#4162) --- esphome/components/esp32_ble_tracker/esp32_ble_tracker.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/esphome/components/esp32_ble_tracker/esp32_ble_tracker.cpp b/esphome/components/esp32_ble_tracker/esp32_ble_tracker.cpp index 853e998c80..fb377e2be2 100644 --- a/esphome/components/esp32_ble_tracker/esp32_ble_tracker.cpp +++ b/esphome/components/esp32_ble_tracker/esp32_ble_tracker.cpp @@ -705,8 +705,13 @@ void ESPBTDevice::parse_adv_(const esp_ble_gap_cb_param_t::ble_scan_result_evt_p while (offset + 2 < len) { const uint8_t field_length = payload[offset++]; // First byte is length of adv record - if (field_length == 0) + if (field_length == 0) { + if (offset < param.adv_data_len && param.scan_rsp_len > 0) { // Zero padded advertisement data + offset = param.adv_data_len; + continue; + } break; + } // first byte of adv record is adv record type const uint8_t record_type = payload[offset++]; From cc45945fcf784efa6c2068c203d5ac15ed6d8029 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Stenberg?= Date: Thu, 8 Dec 2022 21:13:10 +0100 Subject: [PATCH 004/131] climate: Add features to generic Toshiba model (#3912) Add fan speed modes, dry and fan-only operation modes. This reduce differences between generic and PT14111 models. --- esphome/components/toshiba/toshiba.cpp | 32 ++++++++++++++++++++++---- esphome/components/toshiba/toshiba.h | 17 ++++---------- 2 files changed, 32 insertions(+), 17 deletions(-) diff --git a/esphome/components/toshiba/toshiba.cpp b/esphome/components/toshiba/toshiba.cpp index 104e885aab..a070ccceb2 100644 --- a/esphome/components/toshiba/toshiba.cpp +++ b/esphome/components/toshiba/toshiba.cpp @@ -124,9 +124,6 @@ void ToshibaClimate::setup() { // Set supported modes & temperatures based on model this->minimum_temperature_ = this->temperature_min_(); this->maximum_temperature_ = this->temperature_max_(); - this->supports_dry_ = this->toshiba_supports_dry_(); - this->supports_fan_only_ = this->toshiba_supports_fan_only_(); - this->fan_modes_ = this->toshiba_fan_modes_(); this->swing_modes_ = this->toshiba_swing_modes_(); // Never send nan to HA if (std::isnan(this->target_temperature)) @@ -178,12 +175,39 @@ void ToshibaClimate::transmit_generic_() { mode = TOSHIBA_MODE_COOL; break; + case climate::CLIMATE_MODE_DRY: + mode = TOSHIBA_MODE_DRY; + break; + + case climate::CLIMATE_MODE_FAN_ONLY: + mode = TOSHIBA_MODE_FAN_ONLY; + break; + case climate::CLIMATE_MODE_HEAT_COOL: default: mode = TOSHIBA_MODE_AUTO; } - message[6] |= mode | TOSHIBA_FAN_SPEED_AUTO; + uint8_t fan; + switch (this->fan_mode.value()) { + case climate::CLIMATE_FAN_LOW: + fan = TOSHIBA_FAN_SPEED_1; + break; + + case climate::CLIMATE_FAN_MEDIUM: + fan = TOSHIBA_FAN_SPEED_3; + break; + + case climate::CLIMATE_FAN_HIGH: + fan = TOSHIBA_FAN_SPEED_5; + break; + + case climate::CLIMATE_FAN_AUTO: + default: + fan = TOSHIBA_FAN_SPEED_AUTO; + break; + } + message[6] = fan | mode; // Zero message[7] = 0x00; diff --git a/esphome/components/toshiba/toshiba.h b/esphome/components/toshiba/toshiba.h index 36e8760169..729548e747 100644 --- a/esphome/components/toshiba/toshiba.h +++ b/esphome/components/toshiba/toshiba.h @@ -22,7 +22,10 @@ const float TOSHIBA_RAC_PT1411HWRU_TEMP_F_MAX = 86.0; class ToshibaClimate : public climate_ir::ClimateIR { public: - ToshibaClimate() : climate_ir::ClimateIR(TOSHIBA_GENERIC_TEMP_C_MIN, TOSHIBA_GENERIC_TEMP_C_MAX, 1.0f) {} + ToshibaClimate() + : climate_ir::ClimateIR(TOSHIBA_GENERIC_TEMP_C_MIN, TOSHIBA_GENERIC_TEMP_C_MAX, 1.0f, true, true, + {climate::CLIMATE_FAN_AUTO, climate::CLIMATE_FAN_LOW, climate::CLIMATE_FAN_MEDIUM, + climate::CLIMATE_FAN_HIGH}) {} void setup() override; void set_model(Model model) { this->model_ = model; } @@ -46,18 +49,6 @@ class ToshibaClimate : public climate_ir::ClimateIR { float temperature_max_() { return (this->model_ == MODEL_GENERIC) ? TOSHIBA_GENERIC_TEMP_C_MAX : TOSHIBA_RAC_PT1411HWRU_TEMP_C_MAX; } - bool toshiba_supports_dry_() { - return ((this->model_ == MODEL_RAC_PT1411HWRU_C) || (this->model_ == MODEL_RAC_PT1411HWRU_F)); - } - bool toshiba_supports_fan_only_() { - return ((this->model_ == MODEL_RAC_PT1411HWRU_C) || (this->model_ == MODEL_RAC_PT1411HWRU_F)); - } - std::set toshiba_fan_modes_() { - return (this->model_ == MODEL_GENERIC) - ? std::set{} - : std::set{climate::CLIMATE_FAN_AUTO, climate::CLIMATE_FAN_LOW, - climate::CLIMATE_FAN_MEDIUM, climate::CLIMATE_FAN_HIGH}; - } std::set toshiba_swing_modes_() { return (this->model_ == MODEL_GENERIC) ? std::set{} From d4e232f267c2ec3c6d4ea726412bf366e8f90ea4 Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Mon, 12 Dec 2022 16:16:24 +1300 Subject: [PATCH 005/131] Increase watchdog timeout when starting OTA (#4172) --- esphome/components/ota/ota_backend_esp_idf.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/esphome/components/ota/ota_backend_esp_idf.cpp b/esphome/components/ota/ota_backend_esp_idf.cpp index 167f8c059b..2fdc00c54d 100644 --- a/esphome/components/ota/ota_backend_esp_idf.cpp +++ b/esphome/components/ota/ota_backend_esp_idf.cpp @@ -1,6 +1,8 @@ #include "esphome/core/defines.h" #ifdef USE_ESP_IDF +#include + #include "ota_backend_esp_idf.h" #include "ota_component.h" #include @@ -14,7 +16,9 @@ OTAResponseTypes IDFOTABackend::begin(size_t image_size) { if (this->partition_ == nullptr) { return OTA_RESPONSE_ERROR_NO_UPDATE_PARTITION; } + esp_task_wdt_init(15, false); // The following function takes longer than the 5 seconds timeout of WDT esp_err_t err = esp_ota_begin(this->partition_, image_size, &this->update_handle_); + esp_task_wdt_init(CONFIG_ESP_TASK_WDT_TIMEOUT_S, false); // Set the WDT back to the configured timeout if (err != ESP_OK) { esp_ota_abort(this->update_handle_); this->update_handle_ = 0; From eef578f4b85547ada9f6e5950af198b5210ee293 Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Tue, 13 Dec 2022 08:14:18 +1300 Subject: [PATCH 006/131] Bump esphome-dashboard to 20221213.0 (#4176) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 6366a252fa..9c12253160 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,7 +9,7 @@ pyserial==3.5 platformio==6.1.5 # When updating platformio, also update Dockerfile esptool==4.4 click==8.1.3 -esphome-dashboard==20221207.0 +esphome-dashboard==20221213.0 aioesphomeapi==13.0.1 zeroconf==0.39.4 From db3096c6e19ce414a82b5d086c3dba2cc1f56726 Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Tue, 13 Dec 2022 13:44:52 +1300 Subject: [PATCH 007/131] Remove internal pin restriction from cd74hc4067 (#4179) --- esphome/components/cd74hc4067/__init__.py | 8 ++++---- esphome/components/cd74hc4067/cd74hc4067.h | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) 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_; From c47dc09d34c89b25af6153f7e85d1092fe53b883 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 12 Dec 2022 14:57:12 -1000 Subject: [PATCH 008/131] Speed up bluetooth proxy connections when using esp-idf (#4171) --- esphome/components/bluetooth_proxy/__init__.py | 8 ++++++++ esphome/components/esp32/__init__.py | 2 +- esphome/components/esp32_ble_client/ble_client_base.cpp | 2 ++ 3 files changed, 11 insertions(+), 1 deletion(-) 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/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, From 24bf3674f30afacb710f8ec1ce28bcd60c023ea7 Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Wed, 14 Dec 2022 11:45:43 +1300 Subject: [PATCH 009/131] Remove warnings when falling through switch cases on purpose (#4181) --- esphome/components/esp32_ble_client/ble_client_base.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/esphome/components/esp32_ble_client/ble_client_base.cpp b/esphome/components/esp32_ble_client/ble_client_base.cpp index dd6fc94127..017d65573d 100644 --- a/esphome/components/esp32_ble_client/ble_client_base.cpp +++ b/esphome/components/esp32_ble_client/ble_client_base.cpp @@ -290,14 +290,17 @@ float BLEClientBase::parse_char_value(uint8_t *value, uint16_t length) { if (length > 2) { return (float) encode_uint16(value[1], value[2]); } + // fall through case 0x7: // uint24. if (length > 3) { return (float) encode_uint24(value[1], value[2], value[3]); } + // fall through case 0x8: // uint32. if (length > 4) { return (float) encode_uint32(value[1], value[2], value[3], value[4]); } + // fall through case 0xC: // int8. return (float) ((int8_t) value[1]); case 0xD: // int12. @@ -305,10 +308,12 @@ float BLEClientBase::parse_char_value(uint8_t *value, uint16_t length) { if (length > 2) { return (float) ((int16_t)(value[1] << 8) + (int16_t) value[2]); } + // fall through case 0xF: // int24. if (length > 3) { return (float) ((int32_t)(value[1] << 16) + (int32_t)(value[2] << 8) + (int32_t)(value[3])); } + // fall through case 0x10: // int32. if (length > 4) { return (float) ((int32_t)(value[1] << 24) + (int32_t)(value[2] << 16) + (int32_t)(value[3] << 8) + From 9bf7c977751d3b4e5cef123372a07f43f35f597b Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Wed, 14 Dec 2022 11:45:51 +1300 Subject: [PATCH 010/131] Revert camera config change for esp-idf (#4182) --- esphome/components/esp32_camera/esp32_camera.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/esphome/components/esp32_camera/esp32_camera.cpp b/esphome/components/esp32_camera/esp32_camera.cpp index 9598541143..b1bf1d8532 100644 --- a/esphome/components/esp32_camera/esp32_camera.cpp +++ b/esphome/components/esp32_camera/esp32_camera.cpp @@ -54,7 +54,11 @@ void ESP32Camera::dump_config() { ESP_LOGCONFIG(TAG, " HREF Pin: %d", conf.pin_href); ESP_LOGCONFIG(TAG, " Pixel Clock Pin: %d", conf.pin_pclk); ESP_LOGCONFIG(TAG, " External Clock: Pin:%d Frequency:%u", conf.pin_xclk, conf.xclk_freq_hz); +#ifdef USE_ESP_IDF // Temporary until the espressif/esp32-camera library is updated + ESP_LOGCONFIG(TAG, " I2C Pins: SDA:%d SCL:%d", conf.pin_sscb_sda, conf.pin_sscb_scl); +#else ESP_LOGCONFIG(TAG, " I2C Pins: SDA:%d SCL:%d", conf.pin_sccb_sda, conf.pin_sccb_scl); +#endif ESP_LOGCONFIG(TAG, " Reset Pin: %d", conf.pin_reset); switch (this->config_.frame_size) { case FRAMESIZE_QQVGA: @@ -209,8 +213,13 @@ void ESP32Camera::set_external_clock(uint8_t pin, uint32_t frequency) { this->config_.xclk_freq_hz = frequency; } void ESP32Camera::set_i2c_pins(uint8_t sda, uint8_t scl) { +#ifdef USE_ESP_IDF // Temporary until the espressif/esp32-camera library is updated + this->config_.pin_sscb_sda = sda; + this->config_.pin_sscb_scl = scl; +#else this->config_.pin_sccb_sda = sda; this->config_.pin_sccb_scl = scl; +#endif } void ESP32Camera::set_reset_pin(uint8_t pin) { this->config_.pin_reset = pin; } void ESP32Camera::set_power_down_pin(uint8_t pin) { this->config_.pin_pwdn = pin; } From 1eacbd50fadec3ea4b881d5f2dfa181e5e1f69b1 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Thu, 15 Dec 2022 21:27:59 +0100 Subject: [PATCH 011/131] Support non-multiarch toolchains on 32-bit ARM (#4191) fixes https://github.com/esphome/issues/issues/3904 --- docker/Dockerfile | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docker/Dockerfile b/docker/Dockerfile index a49ad5a9ef..0dd505a9b8 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -12,6 +12,9 @@ FROM debian:bullseye-20221024-slim AS base-docker FROM base-${BASEIMGTYPE} AS base +ARG TARGETARCH +ARG TARGETVARIANT + RUN \ apt-get update \ # Use pinned versions so that we get updates with build caching @@ -36,6 +39,14 @@ ENV \ # Store globally installed pio libs in /piolibs PLATFORMIO_GLOBALLIB_DIR=/piolibs +# Support legacy binaries on Debian multiarch system. There is no "correct" way +# to do this, other than using properly built toolchains... +# See: https://unix.stackexchange.com/questions/553743/correct-way-to-add-lib-ld-linux-so-3-in-debian +RUN \ + if [ "$TARGETARCH$TARGETVARIANT" = "armv7" ]; then \ + ln -s /lib/arm-linux-gnueabihf/ld-linux.so.3 /lib/ld-linux.so.3; \ + fi + RUN \ # Ubuntu python3-pip is missing wheel pip3 install --no-cache-dir \ From 83b5e01a28195df5f9e6088395fbb6059f3d24db Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Fri, 16 Dec 2022 10:09:07 +1300 Subject: [PATCH 012/131] Mark ESP32-S2 as not having Bluetooth (#4194) --- esphome/components/esp32_ble/__init__.py | 13 ++++++++++++- esphome/components/esp32_ble_beacon/__init__.py | 3 +++ esphome/components/esp32_ble_tracker/__init__.py | 3 +++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/esphome/components/esp32_ble/__init__.py b/esphome/components/esp32_ble/__init__.py index 4b5c741ad9..c6bb296cdc 100644 --- a/esphome/components/esp32_ble/__init__.py +++ b/esphome/components/esp32_ble/__init__.py @@ -2,12 +2,14 @@ import esphome.codegen as cg import esphome.config_validation as cv from esphome.const import CONF_ID from esphome.core import CORE -from esphome.components.esp32 import add_idf_sdkconfig_option +from esphome.components.esp32 import add_idf_sdkconfig_option, get_esp32_variant, const DEPENDENCIES = ["esp32"] CODEOWNERS = ["@jesserockz"] CONFLICTS_WITH = ["esp32_ble_tracker", "esp32_ble_beacon"] +NO_BLUTOOTH_VARIANTS = [const.VARIANT_ESP32S2] + esp32_ble_ns = cg.esphome_ns.namespace("esp32_ble") ESP32BLE = esp32_ble_ns.class_("ESP32BLE", cg.Component) @@ -19,6 +21,15 @@ CONFIG_SCHEMA = cv.Schema( ).extend(cv.COMPONENT_SCHEMA) +def validate_variant(_): + variant = get_esp32_variant() + if variant in NO_BLUTOOTH_VARIANTS: + raise cv.Invalid(f"{variant} does not support Bluetooth") + + +FINAL_VALIDATE_SCHEMA = validate_variant + + async def to_code(config): var = cg.new_Pvariable(config[CONF_ID]) await cg.register_component(var, config) diff --git a/esphome/components/esp32_ble_beacon/__init__.py b/esphome/components/esp32_ble_beacon/__init__.py index c3bd4ee418..311919dcd4 100644 --- a/esphome/components/esp32_ble_beacon/__init__.py +++ b/esphome/components/esp32_ble_beacon/__init__.py @@ -3,6 +3,7 @@ import esphome.config_validation as cv from esphome.const import CONF_ID, CONF_TYPE, CONF_UUID, CONF_TX_POWER from esphome.core import CORE, TimePeriod from esphome.components.esp32 import add_idf_sdkconfig_option +from esphome.components import esp32_ble DEPENDENCIES = ["esp32"] CONFLICTS_WITH = ["esp32_ble_tracker"] @@ -54,6 +55,8 @@ CONFIG_SCHEMA = cv.All( validate_config, ) +FINAL_VALIDATE_SCHEMA = esp32_ble.validate_variant + async def to_code(config): uuid = config[CONF_UUID].hex diff --git a/esphome/components/esp32_ble_tracker/__init__.py b/esphome/components/esp32_ble_tracker/__init__.py index a3938faff2..c20491e701 100644 --- a/esphome/components/esp32_ble_tracker/__init__.py +++ b/esphome/components/esp32_ble_tracker/__init__.py @@ -17,6 +17,7 @@ from esphome.const import ( ) from esphome.core import CORE from esphome.components.esp32 import add_idf_sdkconfig_option +from esphome.components import esp32_ble DEPENDENCIES = ["esp32"] @@ -187,6 +188,8 @@ CONFIG_SCHEMA = cv.Schema( } ).extend(cv.COMPONENT_SCHEMA) +FINAL_VALIDATE_SCHEMA = esp32_ble.validate_variant + ESP_BLE_DEVICE_SCHEMA = cv.Schema( { cv.GenerateID(CONF_ESP32_BLE_ID): cv.use_id(ESP32BLETracker), From 39af967433ae35c1bd45c4cc84a139701835c9aa Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Fri, 16 Dec 2022 10:38:52 +1300 Subject: [PATCH 013/131] Fix i2s_audio media_player compiling for esp32-s2 (#4195) --- .../i2s_audio/i2s_audio_media_player.cpp | 6 ++++++ .../components/i2s_audio/i2s_audio_media_player.h | 4 ++++ esphome/components/i2s_audio/media_player.py | 15 ++++++++++++++- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/esphome/components/i2s_audio/i2s_audio_media_player.cpp b/esphome/components/i2s_audio/i2s_audio_media_player.cpp index f1f1dc0d51..2b00a5ec26 100644 --- a/esphome/components/i2s_audio/i2s_audio_media_player.cpp +++ b/esphome/components/i2s_audio/i2s_audio_media_player.cpp @@ -103,9 +103,11 @@ void I2SAudioMediaPlayer::stop_() { void I2SAudioMediaPlayer::setup() { ESP_LOGCONFIG(TAG, "Setting up Audio..."); +#if SOC_I2S_SUPPORTS_DAC if (this->internal_dac_mode_ != I2S_DAC_CHANNEL_DISABLE) { this->audio_ = make_unique