mirror of
https://github.com/esphome/esphome.git
synced 2025-09-06 05:12:21 +01:00
add bootloader validation
This commit is contained in:
@@ -15,6 +15,7 @@ from esphome.const import (
|
|||||||
CONF_VERSION,
|
CONF_VERSION,
|
||||||
)
|
)
|
||||||
from esphome.core import CORE, coroutine_with_priority
|
from esphome.core import CORE, coroutine_with_priority
|
||||||
|
import esphome.final_validate as fv
|
||||||
|
|
||||||
CODEOWNERS = ["@esphome/core"]
|
CODEOWNERS = ["@esphome/core"]
|
||||||
|
|
||||||
@@ -114,6 +115,20 @@ CONFIG_SCHEMA = cv.Schema(
|
|||||||
).extend(cv.COMPONENT_SCHEMA)
|
).extend(cv.COMPONENT_SCHEMA)
|
||||||
|
|
||||||
|
|
||||||
|
def _validate_mcumgr(config):
|
||||||
|
if CORE.using_zephyr:
|
||||||
|
fconf = fv.full_config.get()
|
||||||
|
try:
|
||||||
|
bootloader = fconf.get_config_for_path(["nrf52", "bootloader"])
|
||||||
|
if bootloader != "mcuboot":
|
||||||
|
raise cv.Invalid(f"'{bootloader}' bootloader does not support OTA")
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
FINAL_VALIDATE_SCHEMA = _validate_mcumgr
|
||||||
|
|
||||||
|
|
||||||
@coroutine_with_priority(50.0)
|
@coroutine_with_priority(50.0)
|
||||||
async def to_code(config):
|
async def to_code(config):
|
||||||
CORE.data[CONF_OTA] = {}
|
CORE.data[CONF_OTA] = {}
|
||||||
|
Reference in New Issue
Block a user