[wifi] Accept boolean-like strings for fast_connect again (#17414)

This commit is contained in:
J. Nick Koston
2026-07-06 14:42:30 -05:00
committed by GitHub
parent 51fa25856d
commit 90403576c4
2 changed files with 14 additions and 3 deletions
+5 -3
View File
@@ -1,5 +1,6 @@
import logging
import math
from typing import Any
from esphome import automation, preferences
from esphome.automation import Condition
@@ -444,9 +445,10 @@ FAST_CONNECT_SCHEMA = cv.Schema(
)
def _fast_connect_schema(value):
"""Accept the historic plain boolean or a dict with enabled/storage keys."""
if isinstance(value, bool):
def _fast_connect_schema(value: Any) -> ConfigType:
"""Accept the historic plain boolean (including boolean-like strings from
substitutions) or a dict with enabled/storage keys."""
if not isinstance(value, dict):
value = {CONF_ENABLED: value}
return FAST_CONNECT_SCHEMA(value)
@@ -0,0 +1,9 @@
# fast_connect passed through a substitution arrives as a string ("false"),
# which must be accepted like the historic plain boolean form.
substitutions:
fast_connect_value: "false"
wifi:
ssid: MySSID
password: password1
fast_connect: ${fast_connect_value}