1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-21 12:42:21 +01:00

make areas and devices consistant

This commit is contained in:
J. Nick Koston
2025-06-21 17:18:23 +02:00
parent 3d0392d668
commit f44ecd0891
2 changed files with 4 additions and 5 deletions

View File

@@ -350,9 +350,9 @@ def icon(value):
def sub_device_id(value):
# Lazy import to avoid circular imports
from esphome.core.config import SubDevice
from esphome.core.config import Device
validator = use_id(SubDevice)
validator = use_id(Device)
return validator(value)

View File

@@ -472,9 +472,8 @@ async def to_code(config):
area_conf,
)
# Create a synthetic area for backwards compatibility
area_var = cg.new_Pvariable(
cg.ID(f"area_{area_slug}", is_declaration=True, type=Area)
)
area_id_obj = cv.ID(f"area_{area_slug}")
area_var = cg.new_Pvariable(area_id_obj, type_=Area)
area_id = fnv1a_32bit_hash(area_conf)
area_name = area_conf