mirror of https://github.com/esphome/esphome.git
Move into
This commit is contained in:
parent
76f2508abf
commit
48847d6035
|
@ -1,7 +1,7 @@
|
|||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome import automation
|
||||
from esphome.core import CORE
|
||||
from esphome.core import CORE, coroutine_with_priority
|
||||
|
||||
from esphome.const import CONF_ESPHOME, CONF_OTA, CONF_PLATFORM, CONF_TRIGGER_ID
|
||||
|
||||
|
@ -76,6 +76,17 @@ BASE_OTA_SCHEMA = cv.Schema(
|
|||
)
|
||||
|
||||
|
||||
@coroutine_with_priority(50.0)
|
||||
async def to_code(config):
|
||||
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)
|
||||
|
||||
|
||||
async def ota_to_code(var, config):
|
||||
use_state_callback = False
|
||||
for conf in config.get(CONF_ON_STATE_CHANGE, []):
|
||||
|
@ -104,11 +115,3 @@ async def ota_to_code(var, config):
|
|||
use_state_callback = True
|
||||
if use_state_callback:
|
||||
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)
|
||||
|
|
Loading…
Reference in New Issue