1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-30 14:43:51 +00:00
This commit is contained in:
J. Nick Koston
2025-06-21 17:57:10 +02:00
parent aa4c399657
commit 4d231953f4

View File

@@ -454,14 +454,12 @@ async def to_code(config):
CORE.add_job(_add_platformio_options, config[CONF_PLATFORMIO_OPTIONS])
# Count total areas for reservation
total_areas = 0
total_areas = len(config[CONF_AREAS])
if config.get(CONF_AREA):
total_areas += 1
if areas_list := config.get(CONF_AREAS):
total_areas += len(areas_list)
# Reserve space for areas if any are defined
if total_areas > 0:
if total_areas:
cg.add(cg.RawStatement(f"App.reserve_area({total_areas});"))
cg.add_define("USE_AREAS")