mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-05-19 04:33:27 +02:00
37 lines
1.0 KiB
Python
37 lines
1.0 KiB
Python
from esphome.core import CORE
|
|
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=False): cv.All(
|
|
cv.only_on_esp32, cv.boolean
|
|
),
|
|
}
|
|
)
|
|
|
|
|
|
async def to_code(config):
|
|
if CONF_ENABLE_IPV6 in config:
|
|
cg.add_define("ENABLE_IPV6", config[CONF_ENABLE_IPV6])
|
|
if CORE.using_esp_idf:
|
|
add_idf_sdkconfig_option("CONFIG_LWIP_IPV6", config[CONF_ENABLE_IPV6])
|
|
add_idf_sdkconfig_option(
|
|
"CONFIG_LWIP_IPV6_AUTOCONFIG", config[CONF_ENABLE_IPV6]
|
|
)
|
|
else:
|
|
if config[CONF_ENABLE_IPV6]:
|
|
cg.add_build_flag("-DCONFIG_LWIP_IPV6")
|
|
cg.add_build_flag("-DCONFIG_LWIP_IPV6_AUTOCONFIG")
|