From 87de984dcb55aa33c1ef2e1d7eb083c72b6be7a9 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 21 Jun 2026 10:05:03 -0500 Subject: [PATCH] [web_server] Deprecate version 1 --- esphome/components/web_server/__init__.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/esphome/components/web_server/__init__.py b/esphome/components/web_server/__init__.py index fd380a38dd..788bedec34 100644 --- a/esphome/components/web_server/__init__.py +++ b/esphome/components/web_server/__init__.py @@ -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,