diff --git a/esphome/components/lock/__init__.py b/esphome/components/lock/__init__.py index 8bf7af3de2..a96290dca6 100644 --- a/esphome/components/lock/__init__.py +++ b/esphome/components/lock/__init__.py @@ -88,6 +88,11 @@ def lock_schema( return _LOCK_SCHEMA.extend(schema) +# Remove before 2025.11.0 +LOCK_SCHEMA = lock_schema() +LOCK_SCHEMA.add_extra(cv.deprecated_schema_constant("lock")) + + async def _setup_lock_core(var, config): await setup_entity(var, config) diff --git a/esphome/components/text/__init__.py b/esphome/components/text/__init__.py index 39626c2c5c..1cc9283e45 100644 --- a/esphome/components/text/__init__.py +++ b/esphome/components/text/__init__.py @@ -83,6 +83,11 @@ def text_schema( return _TEXT_SCHEMA.extend(schema) +# Remove before 2025.11.0 +TEXT_SCHEMA = text_schema() +TEXT_SCHEMA.add_extra(cv.deprecated_schema_constant("text")) + + async def setup_text_core_( var, config, diff --git a/esphome/components/update/__init__.py b/esphome/components/update/__init__.py index a607aefea0..c2654520fd 100644 --- a/esphome/components/update/__init__.py +++ b/esphome/components/update/__init__.py @@ -81,6 +81,11 @@ def update_schema( return _UPDATE_SCHEMA.extend(schema) +# Remove before 2025.11.0 +UPDATE_SCHEMA = update_schema() +UPDATE_SCHEMA.add_extra(cv.deprecated_schema_constant("update")) + + async def setup_update_core_(var, config): await setup_entity(var, config) diff --git a/esphome/components/valve/__init__.py b/esphome/components/valve/__init__.py index 76ad76e8d0..f3c0353777 100644 --- a/esphome/components/valve/__init__.py +++ b/esphome/components/valve/__init__.py @@ -126,6 +126,11 @@ def valve_schema( return _VALVE_SCHEMA.extend(schema) +# Remove before 2025.11.0 +VALVE_SCHEMA = valve_schema() +VALVE_SCHEMA.add_extra(cv.deprecated_schema_constant("valve")) + + async def _setup_valve_core(var, config): await setup_entity(var, config) diff --git a/esphome/config_validation.py b/esphome/config_validation.py index 993fcfac5b..88a805591d 100644 --- a/esphome/config_validation.py +++ b/esphome/config_validation.py @@ -2072,3 +2072,20 @@ def rename_key(old_key, new_key): return config return validator + + +# Remove before 2025.11.0 +def deprecated_schema_constant(entity_type: str): + def validator(config): + _LOGGER.warning( + "Using `%s.%s_SCHEMA` is deprecated and will be removed in ESPHome 2025.11.0. " + "Please use `%s.%s_schema(...)` instead. " + "If you are seeing this, report an issue to the external_component author and ask them to update it.", + entity_type, + entity_type.upper(), + entity_type, + entity_type, + ) + return config + + return validator