diff --git a/CODEOWNERS b/CODEOWNERS index 1eb13a534b..3be6c28241 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -291,6 +291,7 @@ esphome/components/number/* @esphome/core esphome/components/one_wire/* @ssieb esphome/components/online_image/* @guillempages esphome/components/opentherm/* @olegtarasov +esphome/components/openthread/* @mrene esphome/components/ota/* @esphome/core esphome/components/output/* @esphome/core esphome/components/pca6416a/* @Mat931 diff --git a/esphome/components/openthread/__init__.py b/esphome/components/openthread/__init__.py index a992eddee0..14176a1ebc 100644 --- a/esphome/components/openthread/__init__.py +++ b/esphome/components/openthread/__init__.py @@ -1,14 +1,13 @@ -# from esphome.components.zephyr import ZEPHYR_CORE_KEY -from esphome.const import (KEY_CORE, KEY_TARGET_PLATFORM, CONF_ID, CONF_MAC_ADDRESS) - -from esphome.core import CORE, EsphomeError, coroutine_with_priority -import esphome.config_validation as cv import esphome.codegen as cg - -from esphome.components.esp32 import add_idf_sdkconfig_option, const, get_esp32_variant, add_idf_component +from esphome.components.esp32 import add_idf_sdkconfig_option from esphome.components.mdns import MDNSComponent +import esphome.config_validation as cv +from esphome.const import CONF_CHANNEL, CONF_ID +from esphome.core import CORE -AUTO_LOAD = ["network"] #"openthread_srp" +CODEOWNERS = ["@mrene"] + +AUTO_LOAD = ["network"] # Wi-fi / Bluetooth / Thread coexistence isn't implemented at this time # TODO: Doesn't conflict with wifi if you're using another ESP as an RCP (radio coprocessor) @@ -16,7 +15,6 @@ CONFLICTS_WITH = ["wifi"] DEPENDENCIES = ["esp32"] CONF_NETWORK_NAME = "network_name" -CONF_CHANNEL = "channel" CONF_NETWORK_KEY = "network_key" CONF_PSKC = "pskc" CONF_PANID = "panid" @@ -25,7 +23,6 @@ CONF_MDNS_ID = "mdns_id" def set_sdkconfig_options(config): - if not (CORE.is_esp32 and CORE.using_esp_idf): raise cv.Invalid("OpenThread is only supported on ESP32 with ESP-IDF") @@ -40,19 +37,27 @@ def set_sdkconfig_options(config): add_idf_sdkconfig_option("CONFIG_OPENTHREAD_ENABLED", True) add_idf_sdkconfig_option("CONFIG_OPENTHREAD_NETWORK_PANID", config[CONF_PANID]) add_idf_sdkconfig_option("CONFIG_OPENTHREAD_NETWORK_CHANNEL", config[CONF_CHANNEL]) - add_idf_sdkconfig_option("CONFIG_OPENTHREAD_NETWORK_MASTERKEY", f'{config[CONF_NETWORK_KEY]}') + add_idf_sdkconfig_option( + "CONFIG_OPENTHREAD_NETWORK_MASTERKEY", f"{config[CONF_NETWORK_KEY]}" + ) if config[CONF_NETWORK_NAME]: - add_idf_sdkconfig_option("CONFIG_OPENTHREAD_NETWORK_NAME", f'{config[CONF_NETWORK_NAME]}') + add_idf_sdkconfig_option( + "CONFIG_OPENTHREAD_NETWORK_NAME", f"{config[CONF_NETWORK_NAME]}" + ) if config[CONF_EXTPANID]: - add_idf_sdkconfig_option("CONFIG_OPENTHREAD_NETWORK_EXTPANID", f'{config[CONF_EXTPANID]}') + add_idf_sdkconfig_option( + "CONFIG_OPENTHREAD_NETWORK_EXTPANID", f"{config[CONF_EXTPANID]}" + ) if config[CONF_PSKC]: - add_idf_sdkconfig_option("CONFIG_OPENTHREAD_NETWORK_PSKC", f'{config[CONF_PSKC]}') + add_idf_sdkconfig_option( + "CONFIG_OPENTHREAD_NETWORK_PSKC", f"{config[CONF_PSKC]}" + ) add_idf_sdkconfig_option("CONFIG_OPENTHREAD_DNS64_CLIENT", True) add_idf_sdkconfig_option("CONFIG_OPENTHREAD_SRP_CLIENT", True) add_idf_sdkconfig_option("CONFIG_OPENTHREAD_SRP_CLIENT_MAX_SERVICES", 5) - add_idf_sdkconfig_option("CONFIG_OPENTHREAD_FTD", True) # Full Thread Device + add_idf_sdkconfig_option("CONFIG_OPENTHREAD_FTD", True) # Full Thread Device openthread_ns = cg.esphome_ns.namespace("openthread") @@ -85,8 +90,6 @@ async def to_code(config): cg.add_global(cg.RawStatement('#include "esp_openthread.h"')) cg.add_global(cg.RawStatement('#include "esp_openthread_lock.h"')) cg.add_global(cg.RawStatement('#include "esp_task_wdt.h"')) - cg.add_global(cg.RawStatement('#include ')) + cg.add_global(cg.RawStatement("#include ")) set_sdkconfig_options(config) - -# file /home/mrene/dev/esp/thread/.esphome/build/ott-h2/.pioenvs/ott-h2/firmware.elf