mirror of
https://github.com/esphome/esphome.git
synced 2025-10-02 10:02:23 +01:00
fixes
This commit is contained in:
@@ -301,9 +301,6 @@ class APIConnection : public APIServerConnection {
|
||||
response.icon = entity->get_icon();
|
||||
response.disabled_by_default = entity->is_disabled_by_default();
|
||||
response.entity_category = static_cast<enums::EntityCategory>(entity->get_entity_category());
|
||||
#ifdef USE_SUB_DEVICE
|
||||
response.device_id = entity->get_device_id();
|
||||
#endif
|
||||
}
|
||||
|
||||
// Helper function to fill common entity state fields
|
||||
|
@@ -462,10 +462,8 @@ 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 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))
|
||||
# Get the area variable and use its area_id
|
||||
area = await cg.get_variable(dev_conf[CONF_AREA_ID])
|
||||
cg.add(dev.set_area_id(area.get_area_id()))
|
||||
cg.add(cg.App.register_sub_device(dev))
|
||||
cg.add_define("USE_SUB_DEVICE")
|
||||
|
Reference in New Issue
Block a user