[network] Always allow `enable_ipv6: false` (#7291)

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
David Woodhouse 2024-08-16 02:32:00 +01:00 committed by Jesse Hills
parent 2c47eb62a7
commit 343650e37d
No known key found for this signature in database
GPG key ID: BEAAE804EFD8E83A
3 changed files with 23 additions and 1 deletions

View file

@ -24,7 +24,11 @@ CONFIG_SCHEMA = cv.Schema(
esp32=False,
rp2040=False,
): cv.All(
cv.boolean, cv.only_on([PLATFORM_ESP32, PLATFORM_ESP8266, PLATFORM_RP2040])
cv.boolean,
cv.Any(
cv.only_on([PLATFORM_ESP32, PLATFORM_ESP8266, PLATFORM_RP2040]),
cv.boolean_false,
),
),
cv.Optional(CONF_MIN_IPV6_ADDR_COUNT, default=0): cv.positive_int,
}

View file

@ -370,6 +370,20 @@ def boolean(value):
)
def boolean_false(value):
"""Validate the given config option to be a boolean, set to False.
This option allows a bunch of different ways of expressing boolean values:
- instance of boolean
- 'true'/'false'
- 'yes'/'no'
- 'enable'/disable
"""
if boolean(value):
raise Invalid("Expected boolean value to be false")
return False
@schema_extractor_list
def ensure_list(*validators):
"""Validate this configuration option to be a list.

View file

@ -0,0 +1,4 @@
substitutions:
network_enable_ipv6: "false"
<<: !include common.yaml