diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 000000000..59c403a21 --- /dev/null +++ b/.codespellrc @@ -0,0 +1,3 @@ +[codespell] +ignore-regex = _ +ignore-words-list = ot, bootup, requestor, pase, lits, kNo, currenty, rsource, CurrentY diff --git a/components/esp_matter/Kconfig b/components/esp_matter/Kconfig index dff39518a..a79966fb3 100644 --- a/components/esp_matter/Kconfig +++ b/components/esp_matter/Kconfig @@ -18,7 +18,7 @@ menu "ESP Matter" string "ESP Matter NVS partition name" default "nvs" help - The NVS Partition name for ESP Matter to store the NONVOLATILE attribues + The NVS Partition name for ESP Matter to store the NONVOLATILE attributes config ESP_MATTER_DEFERRED_ATTR_PERSISTENCE_TIME_MS int "ESP Matter deferred attribute persistence time (ms)" @@ -238,6 +238,16 @@ menu "ESP Matter" Disable this option to initialize Thread stack and start Thread task with more flexibility. + config CUSTOM_NETWORK_CONFIG + bool "Use custom network commissioning (skip Network Commissioning cluster)" + default n + help + Enable this if the device uses out-of-band-configured networking + (e.g. rich user interface, manufacturer-specific means, custom + commissioning flows). When enabled, the Network Commissioning + cluster will NOT be added to the root node endpoint, per the + Matter spec CustomNetworkConfig condition. + menu "Select Supported Matter Clusters" visible if ESP_MATTER_ENABLE_DATA_MODEL diff --git a/components/esp_matter/esp_matter_attribute.cpp b/components/esp_matter/esp_matter_attribute.cpp index 16cb518e5..de1bb353e 100644 --- a/components/esp_matter/esp_matter_attribute.cpp +++ b/components/esp_matter/esp_matter_attribute.cpp @@ -412,6 +412,7 @@ attribute_t *create_tc_update_deadline(cluster_t *cluster, nullable va } /* attribute */ } /* general_commissioning */ +#ifndef CONFIG_CUSTOM_NETWORK_CONFIG namespace network_commissioning { namespace attribute { @@ -483,6 +484,7 @@ attribute_t *create_thread_version(cluster_t *cluster, uint16_t value) } /* attribute */ } /* network_commissioning */ +#endif // CONFIG_CUSTOM_NETWORK_CONFIG namespace general_diagnostics { namespace attribute { diff --git a/components/esp_matter/esp_matter_attribute.h b/components/esp_matter/esp_matter_attribute.h index 299b4bd8f..80e3be56d 100644 --- a/components/esp_matter/esp_matter_attribute.h +++ b/components/esp_matter/esp_matter_attribute.h @@ -131,6 +131,7 @@ attribute_t *create_tc_update_deadline(cluster_t *cluster, nullable va } /* attribute */ } /* general_commissioning */ +#ifndef CONFIG_CUSTOM_NETWORK_CONFIG namespace network_commissioning { namespace attribute { attribute_t *create_max_networks(cluster_t *cluster, uint8_t value); @@ -146,6 +147,7 @@ attribute_t *create_supported_thread_features(cluster_t *cluster, uint16_t value attribute_t *create_thread_version(cluster_t *cluster, uint16_t value); } /* attribute */ } /* network_commissioning */ +#endif // CONFIG_CUSTOM_NETWORK_CONFIG namespace general_diagnostics { namespace attribute { diff --git a/components/esp_matter/esp_matter_cluster.cpp b/components/esp_matter/esp_matter_cluster.cpp index 1bcce92af..145a56a0a 100644 --- a/components/esp_matter/esp_matter_cluster.cpp +++ b/components/esp_matter/esp_matter_cluster.cpp @@ -396,6 +396,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) } } /* general_commissioning */ +#ifndef CONFIG_CUSTOM_NETWORK_CONFIG namespace network_commissioning { const function_generic_t *function_list = NULL; const int function_flags = CLUSTER_FLAG_NONE; @@ -447,6 +448,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) return cluster; } } /* network_commissioning */ +#endif // CONFIG_CUSTOM_NETWORK_CONFIG namespace general_diagnostics { const function_generic_t *function_list = NULL; diff --git a/components/esp_matter/esp_matter_cluster.h b/components/esp_matter/esp_matter_cluster.h index 2307ac1a9..febb29d44 100644 --- a/components/esp_matter/esp_matter_cluster.h +++ b/components/esp_matter/esp_matter_cluster.h @@ -121,6 +121,7 @@ typedef struct config { cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); } /* general_commissioning */ +#ifndef CONFIG_CUSTOM_NETWORK_CONFIG namespace network_commissioning { typedef struct config { uint32_t feature_map; @@ -135,6 +136,7 @@ typedef struct config { } config_t; cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); } /* network_commissioning */ +#endif // CONFIG_CUSTOM_NETWORK_CONFIG namespace diagnostic_logs { using config_t = common::config_t; diff --git a/components/esp_matter/esp_matter_command.cpp b/components/esp_matter/esp_matter_command.cpp index 0b2054aa0..5f16ed9b6 100644 --- a/components/esp_matter/esp_matter_command.cpp +++ b/components/esp_matter/esp_matter_command.cpp @@ -1892,6 +1892,7 @@ command_t *create_set_tc_acknowledgements_response(cluster_t *cluster) } /* command */ } /* general_commissioning */ +#ifndef CONFIG_CUSTOM_NETWORK_CONFIG namespace network_commissioning { namespace command { @@ -1964,6 +1965,7 @@ command_t *create_connect_network_response(cluster_t *cluster) } /* command */ } /* network_commissioning */ +#endif // CONFIG_CUSTOM_NETWORK_CONFIG namespace administrator_commissioning { namespace command { diff --git a/components/esp_matter/esp_matter_command.h b/components/esp_matter/esp_matter_command.h index efaf0277a..0b9d6f4ef 100644 --- a/components/esp_matter/esp_matter_command.h +++ b/components/esp_matter/esp_matter_command.h @@ -132,6 +132,7 @@ command_t *create_set_tc_acknowledgements_response(cluster_t *cluster); } /* command */ } /* general_commissioning */ +#ifndef CONFIG_CUSTOM_NETWORK_CONFIG namespace network_commissioning { namespace command { command_t *create_scan_networks(cluster_t *cluster); @@ -145,6 +146,7 @@ command_t *create_network_config_response(cluster_t *cluster); command_t *create_connect_network_response(cluster_t *cluster); } /* command */ } /* network_commissioning */ +#endif // CONFIG_CUSTOM_NETWORK_CONFIG namespace administrator_commissioning { namespace command { diff --git a/components/esp_matter/esp_matter_endpoint.cpp b/components/esp_matter/esp_matter_endpoint.cpp index 157c89e1f..7e4197b97 100644 --- a/components/esp_matter/esp_matter_endpoint.cpp +++ b/components/esp_matter/esp_matter_endpoint.cpp @@ -73,7 +73,9 @@ esp_err_t add(endpoint_t *endpoint, config_t *config) access_control::create(endpoint, &(config->access_control), CLUSTER_FLAG_SERVER); basic_information::create(endpoint, &(config->basic_information), CLUSTER_FLAG_SERVER); general_commissioning::create(endpoint, &(config->general_commissioning), CLUSTER_FLAG_SERVER); +#ifndef CONFIG_CUSTOM_NETWORK_CONFIG network_commissioning::create(endpoint, &(config->network_commissioning), CLUSTER_FLAG_SERVER); +#endif // CONFIG_CUSTOM_NETWORK_CONFIG general_diagnostics::create(endpoint, &(config->general_diagnostics), CLUSTER_FLAG_SERVER); administrator_commissioning::create(endpoint, &(config->administrator_commissioning), CLUSTER_FLAG_SERVER, ESP_MATTER_NONE_FEATURE_ID); @@ -1916,6 +1918,7 @@ esp_err_t add(endpoint_t *endpoint, config_t *config) } /* thread_border_router */ +#ifndef CONFIG_CUSTOM_NETWORK_CONFIG namespace secondary_network_interface { uint32_t get_device_type_id() { @@ -1946,6 +1949,7 @@ esp_err_t add(endpoint_t *endpoint, config_t *config) return ESP_OK; } } /* secondary_network_interface */ +#endif // CONFIG_CUSTOM_NETWORK_CONFIG namespace mounted_on_off_control { uint32_t get_device_type_id() diff --git a/components/esp_matter/esp_matter_endpoint.h b/components/esp_matter/esp_matter_endpoint.h index aff6b1d3b..230622845 100644 --- a/components/esp_matter/esp_matter_endpoint.h +++ b/components/esp_matter/esp_matter_endpoint.h @@ -197,7 +197,9 @@ typedef struct config { cluster::access_control::config_t access_control; cluster::basic_information::config_t basic_information; cluster::general_commissioning::config_t general_commissioning; +#ifndef CONFIG_CUSTOM_NETWORK_CONFIG cluster::network_commissioning::config_t network_commissioning; +#endif // CONFIG_CUSTOM_NETWORK_CONFIG cluster::general_diagnostics::config_t general_diagnostics; cluster::administrator_commissioning::config_t administrator_commissioning; cluster::operational_credentials::config_t operational_credentials; @@ -900,6 +902,7 @@ endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_dat esp_err_t add(endpoint_t *endpoint, config_t *config); } /* thread_border_router */ +#ifndef CONFIG_CUSTOM_NETWORK_CONFIG namespace secondary_network_interface { typedef struct config { cluster::descriptor::config_t descriptor; @@ -911,6 +914,7 @@ uint8_t get_device_type_version(); endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); esp_err_t add(endpoint_t *endpoint, config_t *config); } /* secondary_network_interface */ +#endif // CONFIG_CUSTOM_NETWORK_CONFIG namespace mounted_on_off_control { diff --git a/docs/en/faq.rst b/docs/en/faq.rst index ef0cc3802..851d6b13b 100644 --- a/docs/en/faq.rst +++ b/docs/en/faq.rst @@ -435,6 +435,31 @@ Please refer to the `advance setup`_ section in the programming guide. This has been demonstrated in the `blemesh_bridge`_ and `light_wifi_prov`_ examples. +A1.17 Using custom network commissioning (CustomNetworkConfig) +-------------------------------------------------------------- + +If your device uses out-of-band-configured networking (for example a rich user interface, +manufacturer-specific means, or a custom commissioning flow), the Matter specification's +``CustomNetworkConfig`` condition allows you to omit the Network Commissioning cluster from +the root node endpoint. + +To enable this in ESP-Matter, set the following Kconfig option: + + :: + + CONFIG_CUSTOM_NETWORK_CONFIG=y + +When this option is enabled: + +- The Network Commissioning cluster will **not** be created on the root node endpoint. +- The ``secondary_network_interface`` endpoint type is also excluded from compilation. +- All Network Commissioning cluster code (attributes, commands, cluster creation) is + compiled out, reducing firmware size. + +This is useful for devices that manage their own network configuration and do not need +the standard Matter Network Commissioning flow. + + .. _bleprph: https://github.com/espressif/esp-idf/tree/b5ac4fbdf9e9fb320bb0a98ee4fbaa18f8566f37/examples/bluetooth/nimble/bleprph .. _blecent: https://github.com/espressif/esp-idf/tree/b5ac4fbdf9e9fb320bb0a98ee4fbaa18f8566f37/examples/bluetooth/nimble/blecent .. _bleprph_advertise(): https://github.com/espressif/esp-idf/blob/b5ac4fbdf9e9fb320bb0a98ee4fbaa18f8566f37/examples/bluetooth/nimble/bleprph/main/main.c#L146