mirror of
https://github.com/esphome/esphome.git
synced 2025-07-29 06:36:45 +00:00
[schema] Get component name if available for deprecation warning (#8785)
This commit is contained in:
parent
f28a373898
commit
a835ab48bc
@ -2077,14 +2077,20 @@ def rename_key(old_key, new_key):
|
|||||||
# Remove before 2025.11.0
|
# Remove before 2025.11.0
|
||||||
def deprecated_schema_constant(entity_type: str):
|
def deprecated_schema_constant(entity_type: str):
|
||||||
def validator(config):
|
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(
|
_LOGGER.warning(
|
||||||
"Using `%s.%s_SCHEMA` is deprecated and will be removed in ESPHome 2025.11.0. "
|
"Using `%s.%s_SCHEMA` is deprecated and will be removed in ESPHome 2025.11.0. "
|
||||||
"Please use `%s.%s_schema(...)` instead. "
|
"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,
|
||||||
entity_type.upper(),
|
entity_type.upper(),
|
||||||
entity_type,
|
entity_type,
|
||||||
entity_type,
|
entity_type,
|
||||||
|
type,
|
||||||
)
|
)
|
||||||
return config
|
return config
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user