From c30ffd009876a1adaeee484b66784a8297dc9e08 Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Wed, 14 May 2025 13:25:21 +1200 Subject: [PATCH] [schema] Get component name if available for deprecation warning (#8785) --- esphome/config_validation.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/esphome/config_validation.py b/esphome/config_validation.py index 88a805591d..2eabcc8568 100644 --- a/esphome/config_validation.py +++ b/esphome/config_validation.py @@ -2077,14 +2077,20 @@ def rename_key(old_key, new_key): # Remove before 2025.11.0 def deprecated_schema_constant(entity_type: str): def validator(config): + type: str = "unknown" + if (id := config.get(CONF_ID)) is not None and isinstance(id, core.ID): + type = str(id.type).split("::", maxsplit=1)[0] _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.", + "If you are seeing this, report an issue to the external_component author and ask them to update it. " + "https://developers.esphome.io/blog/2025/05/14/_schema-deprecations/. " + "Component using this schema: %s", entity_type, entity_type.upper(), entity_type, entity_type, + type, ) return config