diff --git a/esphome/components/esphome/ota/__init__.py b/esphome/components/esphome/ota/__init__.py index c7a435fd59..abe9323b53 100644 --- a/esphome/components/esphome/ota/__init__.py +++ b/esphome/components/esphome/ota/__init__.py @@ -62,12 +62,6 @@ async def to_code(config): cg.add_define("USE_OTA_PASSWORD") cg.add_define("USE_OTA_VERSION", config[CONF_VERSION]) - if CORE.is_esp32 and CORE.using_arduino: - cg.add_library("Update", None) - - if CORE.is_rp2040 and CORE.using_arduino: - cg.add_library("Updater", None) - await cg.register_component(var, config) if config[CONF_SAFE_MODE]: diff --git a/esphome/components/ota/__init__.py b/esphome/components/ota/__init__.py index b1c7aa5fcb..fc0573ffd1 100644 --- a/esphome/components/ota/__init__.py +++ b/esphome/components/ota/__init__.py @@ -1,6 +1,7 @@ import esphome.codegen as cg import esphome.config_validation as cv from esphome import automation +from esphome.core import CORE from esphome.const import CONF_ESPHOME, CONF_OTA, CONF_PLATFORM, CONF_TRIGGER_ID @@ -105,3 +106,9 @@ async def ota_to_code(var, config): cg.add_define("USE_OTA_STATE_CALLBACK") cg.add_define("USE_OTA") + + if CORE.is_esp32 and CORE.using_arduino: + cg.add_library("Update", None) + + if CORE.is_rp2040 and CORE.using_arduino: + cg.add_library("Updater", None)