From 548a250df61647beb0e4365155d8109d01421fcc Mon Sep 17 00:00:00 2001 From: Shubham Patil Date: Thu, 26 Mar 2026 18:43:32 +0530 Subject: [PATCH] components/esp_matter: set full-family composition for dynamic endpoints emberAfSetDynamicEndpoint does not auto-detect device types to set the isFlatComposition flag, unlike static endpoints in emberAfInit. This causes Aggregator and Bridged Node endpoints registered dynamically to use kTree composition instead of kFullFamily, resulting in PartsList only listing direct children instead of all descendants. After registering a dynamic endpoint, check if its device type is Root Node, Aggregator, or Bridged Node and call SetFlatCompositionForEndpoint to match the static endpoint behavior. Closes https://github.com/espressif/esp-matter/issues/1741 --- .../esp_matter/data_model/esp_matter_data_model.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/components/esp_matter/data_model/esp_matter_data_model.cpp b/components/esp_matter/data_model/esp_matter_data_model.cpp index 560cbdb59..f1429484c 100644 --- a/components/esp_matter/data_model/esp_matter_data_model.cpp +++ b/components/esp_matter/data_model/esp_matter_data_model.cpp @@ -534,6 +534,17 @@ esp_err_t enable(endpoint_t *endpoint) } ESP_LOGI(TAG, "Dynamic endpoint %" PRIu16 " added", current_endpoint->endpoint_id); + /* Set composition pattern for dynamic endpoints. emberAfSetDynamicEndpoint does not auto-detect + * device types to set the composition, unlike static endpoints. Root node, aggregator, and bridged + * node device types need kFullFamily composition for correct PartsList computation. */ + for (uint8_t i = 0; i < current_endpoint->device_type_count; i++) { + if (current_endpoint->device_type_ids[i] == ESP_MATTER_ROOT_NODE_DEVICE_TYPE_ID || + current_endpoint->device_type_ids[i] == ESP_MATTER_AGGREGATOR_DEVICE_TYPE_ID || + current_endpoint->device_type_ids[i] == ESP_MATTER_BRIDGED_NODE_DEVICE_TYPE_ID) { + chip::app::SetFlatCompositionForEndpoint(current_endpoint->endpoint_id); + break; + } + } #ifdef CONFIG_SUPPORT_UNIT_LOCALIZATION_CLUSTER // set the temperature unit from unit localization cluster