Files
esphome-dev/esphome/components/network/__init__.py
T
Jesse Hills d42f35de5d Wrap ipv6 code a bit more (#4574)
* Wrap ipv6 code a bit more for when ipv6 support should not be compiled in

* More checks

* More uses

* Fix
2023-03-21 20:24:14 +00:00

30 lines
749 B
Python

import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components.esp32 import add_idf_sdkconfig_option
from esphome.const import (
CONF_ENABLE_IPV6,
)
CODEOWNERS = ["@esphome/core"]
AUTO_LOAD = ["mdns"]
network_ns = cg.esphome_ns.namespace("network")
IPAddress = network_ns.class_("IPAddress")
CONFIG_SCHEMA = cv.Schema(
{
cv.SplitDefault(CONF_ENABLE_IPV6, esp32_idf=False): cv.All(
cv.only_with_esp_idf, cv.boolean
),
}
)
async def to_code(config):
if CONF_ENABLE_IPV6 in config:
add_idf_sdkconfig_option("CONFIG_LWIP_IPV6", config[CONF_ENABLE_IPV6])
add_idf_sdkconfig_option(
"CONFIG_LWIP_IPV6_AUTOCONFIG", config[CONF_ENABLE_IPV6]
)