This commit is contained in:
Tomasz Duda 2024-08-07 18:41:00 +02:00
parent c656a4b96b
commit 10d89c6079
4 changed files with 24 additions and 35 deletions

View file

@ -1,4 +1,10 @@
import esphome.codegen as cg
from esphome.components.zephyr import zephyr_set_core_data, zephyr_to_code
from esphome.components.zephyr.const import (
BOOTLOADER_MCUBOOT,
KEY_BOOTLOADER,
KEY_ZEPHYR,
)
import esphome.config_validation as cv
from esphome.const import (
CONF_BOARD,
@ -12,15 +18,6 @@ from esphome.const import (
)
from esphome.core import CORE, coroutine_with_priority
from esphome.components.zephyr import (
zephyr_set_core_data,
zephyr_to_code,
)
from esphome.components.zephyr.const import (
BOOTLOADER_MCUBOOT,
KEY_BOOTLOADER,
KEY_ZEPHYR,
)
from .boards_zephyr import BOARDS_ZEPHYR
from .const import BOOTLOADER_ADAFRUIT
@ -58,11 +55,10 @@ def _detect_bootloader(value):
if bootloader is None:
bootloader = BOOTLOADER_MCUBOOT
value[KEY_BOOTLOADER] = bootloader
else:
if bootloader is not None and bootloader != value[KEY_BOOTLOADER]:
raise cv.Invalid(
f"{value[CONF_FRAMEWORK][CONF_TYPE]} does not support '{bootloader}' bootloader for {value[CONF_BOARD]}"
)
elif bootloader is not None and bootloader != value[KEY_BOOTLOADER]:
raise cv.Invalid(
f"{value[CONF_FRAMEWORK][CONF_TYPE]} does not support '{bootloader}' bootloader for {value[CONF_BOARD]}"
)
return value

View file

@ -1,4 +1,5 @@
from esphome.components.zephyr.const import KEY_BOOTLOADER
from .const import BOOTLOADER_ADAFRUIT
BOARDS_ZEPHYR = {

View file

@ -1,16 +1,8 @@
from esphome import pins
import esphome.codegen as cg
from esphome.components.zephyr.const import zephyr_ns
import esphome.config_validation as cv
from esphome.const import (
CONF_ID,
CONF_INVERTED,
CONF_MODE,
CONF_NUMBER,
)
from esphome.components.zephyr.const import (
zephyr_ns,
)
from esphome.const import CONF_ID, CONF_INVERTED, CONF_MODE, CONF_NUMBER
ZephyrGPIOPin = zephyr_ns.class_("ZephyrGPIOPin", cg.InternalGPIOPin)

View file

@ -1,33 +1,33 @@
import logging
from importlib import resources
import logging
from typing import Optional
import tzlocal
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome import automation
from esphome.automation import Condition
import esphome.codegen as cg
from esphome.components.zephyr import zephyr_add_prj_conf
import esphome.config_validation as cv
from esphome.const import (
CONF_ID,
CONF_AT,
CONF_CRON,
CONF_DAYS_OF_MONTH,
CONF_DAYS_OF_WEEK,
CONF_HOUR,
CONF_HOURS,
CONF_ID,
CONF_MINUTE,
CONF_MINUTES,
CONF_MONTHS,
CONF_ON_TIME,
CONF_ON_TIME_SYNC,
CONF_SECOND,
CONF_SECONDS,
CONF_TIMEZONE,
CONF_TRIGGER_ID,
CONF_AT,
CONF_SECOND,
CONF_HOUR,
CONF_MINUTE,
)
from esphome.core import coroutine_with_priority, CORE
from esphome.automation import Condition
from esphome.components.zephyr import zephyr_add_prj_conf
from esphome.core import CORE, coroutine_with_priority
_LOGGER = logging.getLogger(__name__)