diff --git a/esphome/components/esp_adf/__init__.py b/esphome/components/esp_adf/__init__.py index 88d386689f..d51ff8afda 100644 --- a/esphome/components/esp_adf/__init__.py +++ b/esphome/components/esp_adf/__init__.py @@ -5,7 +5,7 @@ import esphome.codegen as cg from esphome.components import esp32 -from esphome.const import CONF_ID +from esphome.const import CONF_ID, CONF_BOARD CONFLICTS_WITH = ["i2s_audio"] CODEOWNERS = ["@jesserockz"] @@ -17,18 +17,26 @@ esp_adf_ns = cg.esphome_ns.namespace("esp_adf") ESPADF = esp_adf_ns.class_("ESPADF", cg.Component) ESPADFPipeline = esp_adf_ns.class_("ESPADFPipeline", cg.Parented.template(ESPADF)) -SUPPORTED_BOARDS = {"esp32s3box": "CONFIG_ESP32_S3_BOX_BOARD"} +SUPPORTED_BOARDS = { + "esp32s3box": "CONFIG_ESP32_S3_BOX_BOARD", + "esp32s3boxlite": "CONFIG_ESP32_S3_BOX_LITE_BOARD", +} def _validate_board(config): - board = esp32.get_board() + board = config.get(CONF_BOARD, esp32.get_board()) if board not in SUPPORTED_BOARDS: raise cv.Invalid(f"Board {board} is not supported by esp-adf") return config CONFIG_SCHEMA = cv.All( - cv.Schema({cv.GenerateID(): cv.declare_id(ESPADF)}), + cv.Schema( + { + cv.GenerateID(): cv.declare_id(ESPADF), + cv.Optional(CONF_BOARD): cv.string_strict, + } + ), _validate_board, cv.only_with_esp_idf, ) @@ -54,7 +62,8 @@ async def to_code(config): cg.add_platformio_option( "board_build.embed_txtfiles", "components/dueros_service/duer_profile" ) - esp32.add_idf_sdkconfig_option(SUPPORTED_BOARDS[esp32.get_board()], True) + board = config.get(CONF_BOARD, esp32.get_board()) + esp32.add_idf_sdkconfig_option(SUPPORTED_BOARDS[board], True) esp32.add_extra_script( "pre",