1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-03 20:02:22 +01:00

Initial ESP32-H2 Support (#5498)

This commit is contained in:
Austin
2023-10-08 14:34:12 -04:00
committed by GitHub
parent 44e5b0c745
commit fa0dcac2c7
7 changed files with 80 additions and 16 deletions

View File

@@ -34,12 +34,14 @@ from esphome.const import (
CONF_EAP,
)
from esphome.core import CORE, HexInt, coroutine_with_priority
from esphome.components.esp32 import add_idf_sdkconfig_option
from esphome.components.esp32 import add_idf_sdkconfig_option, get_esp32_variant, const
from esphome.components.network import IPAddress
from . import wpa2_eap
AUTO_LOAD = ["network"]
NO_WIFI_VARIANTS = [const.VARIANT_ESP32H2]
wifi_ns = cg.esphome_ns.namespace("wifi")
EAPAuth = wifi_ns.struct("EAPAuth")
ManualIP = wifi_ns.struct("ManualIP")
@@ -148,6 +150,13 @@ WIFI_NETWORK_STA = WIFI_NETWORK_BASE.extend(
)
def validate_variant(_):
if CORE.is_esp32:
variant = get_esp32_variant()
if variant in NO_WIFI_VARIANTS:
raise cv.Invalid(f"{variant} does not support WiFi")
def final_validate(config):
has_sta = bool(config.get(CONF_NETWORKS, True))
has_ap = CONF_AP in config
@@ -199,6 +208,7 @@ FINAL_VALIDATE_SCHEMA = cv.All(
extra=cv.ALLOW_EXTRA,
),
final_validate,
validate_variant,
)