[wifi] Accept lowercase variant in variant_has_wifi (#16345)

This commit is contained in:
J. Nick Koston
2026-05-11 09:11:36 -04:00
committed by GitHub
parent e4d9786f00
commit b967adeb9d
2 changed files with 38 additions and 3 deletions
+7 -1
View File
@@ -76,11 +76,17 @@ def variant_has_wifi(variant: str) -> bool:
Variants without a native PHY (ESP32-H2, ESP32-P4) need the
``esp32_hosted`` co-processor to use ``wifi:``.
Case-insensitive on *variant* so external callers can pass either
the upstream uppercase form (e.g. ``"ESP32H2"`` from
``const.VARIANT_ESP32H2``) or a lowercase form their own enum
surfaces (e.g. ``"esp32h2"`` from device-builder's
``Esp32Variant``). Both classify identically.
Used by device-builder (esphome/device-builder) to decide whether
its basic-setup wizard emits a ``wifi:`` block — please keep the
signature stable.
"""
return variant not in NO_WIFI_VARIANTS
return variant.upper() not in NO_WIFI_VARIANTS
_WIFI_FIRST_PLATFORMS: frozenset[str] = frozenset(