mirror of
https://github.com/esphome/esphome.git
synced 2025-09-12 08:12:22 +01:00
preen
This commit is contained in:
@@ -496,15 +496,15 @@ async def to_code(config: ConfigType) -> None:
|
|||||||
cg.add(cg.App.register_area(area_var))
|
cg.add(cg.App.register_area(area_var))
|
||||||
|
|
||||||
# Process devices and areas
|
# Process devices and areas
|
||||||
devices: dict[str, str] | None
|
devices: list[dict[str, str]]
|
||||||
if devices := config.get(CONF_DEVICES):
|
if devices := config[CONF_DEVICES]:
|
||||||
# Reserve space for devices
|
# Reserve space for devices
|
||||||
cg.add(cg.RawStatement(f"App.reserve_device({len(devices)});"))
|
cg.add(cg.RawStatement(f"App.reserve_device({len(devices)});"))
|
||||||
cg.add_define("USE_DEVICES")
|
cg.add_define("USE_DEVICES")
|
||||||
|
|
||||||
# Process additional areas
|
# Process additional areas
|
||||||
areas: dict[str, str] | None
|
areas: list[dict[str, str]]
|
||||||
if areas := config.get(CONF_AREAS):
|
if areas := config[CONF_AREAS]:
|
||||||
for area_conf in areas:
|
for area_conf in areas:
|
||||||
area = cg.new_Pvariable(area_conf[CONF_ID])
|
area = cg.new_Pvariable(area_conf[CONF_ID])
|
||||||
area_id = fnv1a_32bit_hash(str(area_conf[CONF_ID]))
|
area_id = fnv1a_32bit_hash(str(area_conf[CONF_ID]))
|
||||||
|
Reference in New Issue
Block a user