From a0dfcbf85f78e2445177b8bbadc4e3bd0a2c2549 Mon Sep 17 00:00:00 2001 From: Chris Leishman Date: Tue, 24 Feb 2026 23:22:39 -0800 Subject: [PATCH] fix(cluster_select): gate Thread clusters on OPENTHREAD_ENABLED The three Thread-related clusters (Thread Network Diagnostics, Thread Border Router Management, Thread Network Directory) default to enabled regardless of whether OpenThread is present. On WiFi-only devices this causes the clusters to be registered on the root node endpoint, but read requests fail with CHIP_ERROR_NOT_IMPLEMENTED because CHIP_DEVICE_CONFIG_ENABLE_THREAD is disabled, producing noisy DMG errors like: E chip[DMG]: Fail to retrieve data ... clusterId: 0x0000_0035 err = 2d Add `depends on OPENTHREAD_ENABLED` so these clusters are only available when the Thread stack is actually present. --- .../utils/cluster_select/Kconfig.in | 3 +++ .../generate_cluster_select_files.py | 20 ++++++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/components/esp_matter/utils/cluster_select/Kconfig.in b/components/esp_matter/utils/cluster_select/Kconfig.in index d6030b506..0164948e6 100644 --- a/components/esp_matter/utils/cluster_select/Kconfig.in +++ b/components/esp_matter/utils/cluster_select/Kconfig.in @@ -431,14 +431,17 @@ config SUPPORT_THERMOSTAT_USER_INTERFACE_CONFIGURATION_CLUSTER config SUPPORT_THREAD_BORDER_ROUTER_MANAGEMENT_CLUSTER bool "Support THREAD_BORDER_ROUTER_MANAGEMENT_CLUSTER" + depends on OPENTHREAD_ENABLED default y config SUPPORT_THREAD_NETWORK_DIAGNOSTICS_CLUSTER bool "Support THREAD_NETWORK_DIAGNOSTICS_CLUSTER" + depends on OPENTHREAD_ENABLED default y config SUPPORT_THREAD_NETWORK_DIRECTORY_CLUSTER bool "Support THREAD_NETWORK_DIRECTORY_CLUSTER" + depends on OPENTHREAD_ENABLED default y config SUPPORT_TIME_FORMAT_LOCALIZATION_CLUSTER diff --git a/components/esp_matter/utils/cluster_select/generate_cluster_select_files.py b/components/esp_matter/utils/cluster_select/generate_cluster_select_files.py index 237f1ece4..2457272b1 100755 --- a/components/esp_matter/utils/cluster_select/generate_cluster_select_files.py +++ b/components/esp_matter/utils/cluster_select/generate_cluster_select_files.py @@ -46,15 +46,25 @@ def load_json(json_file): return {key: value for key, value in server_dirs.items() if value} +# Clusters that require OpenThread support +OPENTHREAD_CLUSTERS = { + 'THREAD_BORDER_ROUTER_MANAGEMENT_CLUSTER', + 'THREAD_NETWORK_DIAGNOSTICS_CLUSTER', + 'THREAD_NETWORK_DIRECTORY_CLUSTER', +} + + def generate_cluster_select_kconfig(cluster_list, output_dir): with open(os.path.join(output_dir, 'Kconfig.in'), 'w') as kconfig_file: write_file_header(kconfig_file) for cluster in cluster_list.keys(): - kconfig_file.writelines( - [f'config SUPPORT_{cluster}\n', - f'\tbool "Support {cluster}"\n', - '\tdefault y\n' - '\n']) + lines = [f'config SUPPORT_{cluster}\n', + f'\tbool "Support {cluster}"\n'] + if cluster in OPENTHREAD_CLUSTERS: + lines.append('\tdepends on OPENTHREAD_ENABLED\n') + lines.append('\tdefault y\n') + lines.append('\n') + kconfig_file.writelines(lines) def generate_cluster_select_cmake(cluster_list, output_dir):