[web_server] Deprecate version 1

This commit is contained in:
J. Nick Koston
2026-06-21 10:05:03 -05:00
parent dbdf125ec8
commit 87de984dcb

View File

@@ -1,6 +1,7 @@
from __future__ import annotations
import gzip
import logging
import esphome.codegen as cg
from esphome.components import web_server_base
@@ -38,6 +39,8 @@ from esphome.core import CORE, CoroPriority, coroutine_with_priority
import esphome.final_validate as fv
from esphome.types import ConfigType
_LOGGER = logging.getLogger(__name__)
AUTO_LOAD = ["json", "web_server_base"]
CONF_SORTING_GROUP_ID = "sorting_group_id"
@@ -71,6 +74,15 @@ def default_url(config: ConfigType) -> ConfigType:
return config
def validate_version_deprecated(config: ConfigType) -> ConfigType:
if config[CONF_VERSION] == 1:
_LOGGER.warning(
"Version 1 of 'web_server' is deprecated and will be removed in "
"2027.1.0. Please migrate to version 2 (the default) or version 3."
)
return config
def validate_local(config: ConfigType) -> ConfigType:
if CONF_LOCAL in config and config[CONF_VERSION] == 1:
raise cv.Invalid("'local' is not supported in version 1")
@@ -220,6 +232,7 @@ CONFIG_SCHEMA = cv.All(
]
),
default_url,
validate_version_deprecated,
validate_local,
validate_sorting_groups,
validate_ota,