mirror of
https://github.com/esphome/esphome.git
synced 2026-07-10 08:55:36 +00:00
[wifi] Accept boolean-like strings for fast_connect again (#17414)
This commit is contained in:
@@ -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}
|
||||
Reference in New Issue
Block a user