esp-matter icon indicating copy to clipboard operation
esp-matter copied to clipboard

How to set Thread Network Diagnostics cluster feature flags? (CON-1619)

Open olavt opened this issue 8 months ago • 3 comments

How can I set the Thread Network Diagnostics cluster feature flags?

There does not seem to be any feature flags defined in the SDK for the Thread Network Diagnostic cluster.

There is a lot of Thread diagnostics data missing in the Thread Network Diagnostics cluster by using the defaults.

olavt avatar Mar 28 '25 20:03 olavt

Thanks for your issue report, can you help to describe your request clearly? We haven't add the features support for the thread diagnostic cluster in current esp-matter SDK, we can add support for this part later.

Jerry-ESP avatar Mar 31 '25 06:03 Jerry-ESP

This is an example of data that would be relevant:

Image

olavt avatar Mar 31 '25 07:03 olavt

@Jerry-ESP How can I set these feature flags?

Image

olavt avatar Apr 01 '25 14:04 olavt

Current SDK have no api to set these features directly, we will add these apis soon.

Jerry-ESP avatar Apr 07 '25 01:04 Jerry-ESP

@olavt we have added related apis to the latest main branch, please have a try: https://github.com/espressif/esp-matter

Jerry-ESP avatar Apr 08 '25 03:04 Jerry-ESP

@Jerry-ESP I added this code to my project now:

cluster::thread_network_diagnostics::feature::error_counts::add(cluster);
cluster::thread_network_diagnostics::feature::mac_counts::add(cluster);
cluster::thread_network_diagnostics::feature::mle_counts::add(cluster);
cluster::thread_network_diagnostics::feature::packets_counts::add(cluster);

It builds fine, but I don't have access to my controller to check how it works yet.

olavt avatar Apr 08 '25 17:04 olavt

@olavt The code is correct, but all the attributes in the MLECNT and MLECNT are optional, so we didn't add them in the feature create api by default, you need add them manually. Just as below: attribute::thread_network_diagnostics::create_detached_role_count(cluster, 0);

After you add all the attributes you want, you can test use the chip-tool, read the feature map and attributes to check.

Jerry-ESP avatar Apr 09 '25 02:04 Jerry-ESP

@Jerry-ESP I'm getting a compilation error on this statement:

attribute::thread_network_diagnostics::create_detached_role_count(cluster, 0);

'esp_matter::attribute::thread_network_diagnostics' has not been declared

This line of code works:

attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::TxTotalCount::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(0));

I have these at the top of the source file:

using namespace esp_matter; using namespace esp_matter::attribute; using namespace esp_matter::endpoint; using namespace chip::app::Clusters;

What is missing to use the create utility functions to create the attribute?

olavt avatar Apr 14 '25 19:04 olavt

The code I posted is incorrect, it should be as below: esp_matter::attribute::thread_network_diagnostics::create_detached_role_count(cluster, 0);

Jerry-ESP avatar Apr 15 '25 02:04 Jerry-ESP

I still get the same error:

'esp_matter::attribute::thread_network_diagnostics' has not been declared

olavt avatar Apr 15 '25 10:04 olavt

I still get the same error:

'esp_matter::attribute::thread_network_diagnostics' has not been declared

Sorry, it should be esp_matter::cluster::thread_network_diagnostics::attribute::create_detached_role_count(cluster, 0);

Jerry-ESP avatar Apr 15 '25 11:04 Jerry-ESP