1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-04 04:12:23 +01:00

add bootloader validation

This commit is contained in:
Tomasz Duda
2024-02-12 21:42:19 +01:00
parent 02d0cd701b
commit 9d3bd1a2ab

View File

@@ -15,6 +15,7 @@ from esphome.const import (
CONF_VERSION,
)
from esphome.core import CORE, coroutine_with_priority
import esphome.final_validate as fv
CODEOWNERS = ["@esphome/core"]
@@ -114,6 +115,20 @@ CONFIG_SCHEMA = cv.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)
async def to_code(config):
CORE.data[CONF_OTA] = {}