fix import

This commit is contained in:
J. Nick Koston
2025-07-01 15:50:34 -05:00
parent 11b5b00cd6
commit 1756017181
2 changed files with 13 additions and 8 deletions

View File

@@ -2,7 +2,7 @@ import esphome.codegen as cg
from esphome.components.ota import BASE_OTA_SCHEMA, OTAComponent, ota_to_code
import esphome.config_validation as cv
from esphome.const import CONF_ID
from esphome.core import CORE, coroutine_with_priority
from esphome.core import coroutine_with_priority
CODEOWNERS = ["@esphome/core"]
DEPENDENCIES = ["network", "web_server_base"]
@@ -27,9 +27,3 @@ async def to_code(config):
await ota_to_code(var, config)
await cg.register_component(var, config)
cg.add_define("USE_WEBSERVER_OTA")
# Add multipart parser dependency for ESP-IDF
if CORE.using_esp_idf:
from esphome.components.esp32 import add_idf_component
add_idf_component(name="zorxx/multipart-parser", ref="1.0.1")

View File

@@ -1,5 +1,7 @@
from esphome.components.esp32 import add_idf_sdkconfig_option
from esphome.components.esp32 import add_idf_component, add_idf_sdkconfig_option
import esphome.config_validation as cv
from esphome.const import CONF_OTA
from esphome.core import CORE
CODEOWNERS = ["@dentra"]
@@ -12,3 +14,12 @@ CONFIG_SCHEMA = cv.All(
async def to_code(config):
# Increase the maximum supported size of headers section in HTTP request packet to be processed by the server
add_idf_sdkconfig_option("CONFIG_HTTPD_MAX_REQ_HDR_LEN", 1024)
# Check if web_server OTA platform is configured
ota_config = CORE.config.get(CONF_OTA, [])
has_web_server_ota = any(
platform.get("platform") == "web_server" for platform in ota_config
)
if has_web_server_ota:
# Add multipart parser dependency for web server OTA
add_idf_component(name="zorxx/multipart-parser", ref="1.0.1")