From 153a6440dcb8e470964b11b4c85fe700423b7733 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 21 Jun 2025 13:20:59 +0200 Subject: [PATCH] cleanups to address review comments --- esphome/core/config.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/esphome/core/config.py b/esphome/core/config.py index fbbdf1217a..2c33ad1df0 100644 --- a/esphome/core/config.py +++ b/esphome/core/config.py @@ -462,9 +462,10 @@ async def to_code(config): cg.add(dev.set_device_id(fnv1a_32bit_hash(str(dev_conf[CONF_ID])))) cg.add(dev.set_name(dev_conf[CONF_NAME])) if CONF_AREA_ID in dev_conf: - # The area_id in dev_conf is already the ID reference from cv.use_id - # We need to get the hash of that area's ID - area_id = fnv1a_32bit_hash(str(dev_conf[CONF_AREA_ID])) + # The area_id in dev_conf is the ID reference from cv.use_id + # We need to get the same hash that was used when creating the area + area_id_str = str(dev_conf[CONF_AREA_ID].id) + area_id = fnv1a_32bit_hash(area_id_str) cg.add(dev.set_area_id(area_id)) cg.add(cg.App.register_sub_device(dev)) cg.add_define("USE_SUB_DEVICE")