1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-30 06:33:51 +00:00

legacy test

This commit is contained in:
J. Nick Koston
2025-06-22 13:37:01 +02:00
parent f4f14a7507
commit 41b1bfc504
3 changed files with 60 additions and 2 deletions

View File

@@ -495,7 +495,9 @@ async def to_code(config: ConfigType) -> None:
else:
# Old way: string-based area (deprecated)
area_slug = slugify(area_conf)
area_id: core.ID = cv.declare_id(Area)
area_id = core.ID(
cv.validate_id_name(area_slug), is_declaration=True, type=Area
)
area_id_str = area_slug
_LOGGER.warning(
"Using 'area' as a string is deprecated. Please use the new format:\n"
@@ -506,7 +508,7 @@ async def to_code(config: ConfigType) -> None:
area_conf,
)
# Create a synthetic area for backwards compatibility
area_var = cg.Pvariable(area_id)
area_var = cg.new_Pvariable(area_id)
area_id_hash = fnv1a_32bit_hash(area_conf)
area_name = area_conf