mirror of
https://github.com/esphome/esphome.git
synced 2026-06-24 11:25:35 +00:00
[web_server] Deprecate version 1 (#17109)
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import gzip
|
import gzip
|
||||||
|
import logging
|
||||||
|
|
||||||
import esphome.codegen as cg
|
import esphome.codegen as cg
|
||||||
from esphome.components import web_server_base
|
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
|
import esphome.final_validate as fv
|
||||||
from esphome.types import ConfigType
|
from esphome.types import ConfigType
|
||||||
|
|
||||||
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
AUTO_LOAD = ["json", "web_server_base"]
|
AUTO_LOAD = ["json", "web_server_base"]
|
||||||
|
|
||||||
CONF_SORTING_GROUP_ID = "sorting_group_id"
|
CONF_SORTING_GROUP_ID = "sorting_group_id"
|
||||||
@@ -71,6 +74,15 @@ def default_url(config: ConfigType) -> ConfigType:
|
|||||||
return config
|
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:
|
def validate_local(config: ConfigType) -> ConfigType:
|
||||||
if CONF_LOCAL in config and config[CONF_VERSION] == 1:
|
if CONF_LOCAL in config and config[CONF_VERSION] == 1:
|
||||||
raise cv.Invalid("'local' is not supported in version 1")
|
raise cv.Invalid("'local' is not supported in version 1")
|
||||||
@@ -220,6 +232,7 @@ CONFIG_SCHEMA = cv.All(
|
|||||||
]
|
]
|
||||||
),
|
),
|
||||||
default_url,
|
default_url,
|
||||||
|
validate_version_deprecated,
|
||||||
validate_local,
|
validate_local,
|
||||||
validate_sorting_groups,
|
validate_sorting_groups,
|
||||||
validate_ota,
|
validate_ota,
|
||||||
|
|||||||
Reference in New Issue
Block a user