From ff101136e60ac33c7e054a2fd08ba1a8722f509a Mon Sep 17 00:00:00 2001 From: WanqQixiang Date: Thu, 8 Jan 2026 12:12:39 +0800 Subject: [PATCH] example: remove light_network_prov example --- examples/.build-rules.yml | 6 - examples/light_network_prov/CMakeLists.txt | 41 -- examples/light_network_prov/README.md | 147 +---- .../light_network_prov/main/CMakeLists.txt | 4 - .../light_network_prov/main/app_driver.cpp | 218 ------- examples/light_network_prov/main/app_main.cpp | 452 -------------- .../light_network_prov/main/app_network.cpp | 590 ------------------ .../light_network_prov/main/app_network.h | 119 ---- examples/light_network_prov/main/app_priv.h | 109 ---- .../light_network_prov/main/idf_component.yml | 9 - .../network_prov_scheme_matter_ble.cpp | 204 ------ .../network_prov_scheme_matter_ble.h | 29 - .../protocomm_matter_ble.cpp | 559 ----------------- .../protocomm_matter_ble.h | 57 -- .../paa_cert/RainMaker-Claim-PAA-Cert.der | Bin 458 -> 0 bytes examples/light_network_prov/partitions.csv | 10 - .../light_network_prov/sdkconfig.defaults | 186 ------ .../sdkconfig.defaults.esp32c3 | 27 - .../sdkconfig.defaults.esp32h2 | 48 -- .../sdkconfig.defaults.esp32s3 | 8 - 20 files changed, 2 insertions(+), 2821 deletions(-) delete mode 100644 examples/light_network_prov/CMakeLists.txt delete mode 100644 examples/light_network_prov/main/CMakeLists.txt delete mode 100644 examples/light_network_prov/main/app_driver.cpp delete mode 100644 examples/light_network_prov/main/app_main.cpp delete mode 100644 examples/light_network_prov/main/app_network.cpp delete mode 100644 examples/light_network_prov/main/app_network.h delete mode 100644 examples/light_network_prov/main/app_priv.h delete mode 100644 examples/light_network_prov/main/idf_component.yml delete mode 100644 examples/light_network_prov/main/network_prov_scheme/network_prov_scheme_matter_ble.cpp delete mode 100644 examples/light_network_prov/main/network_prov_scheme/network_prov_scheme_matter_ble.h delete mode 100644 examples/light_network_prov/main/network_prov_scheme/protocomm_matter_ble.cpp delete mode 100644 examples/light_network_prov/main/network_prov_scheme/protocomm_matter_ble.h delete mode 100644 examples/light_network_prov/paa_cert/RainMaker-Claim-PAA-Cert.der delete mode 100644 examples/light_network_prov/partitions.csv delete mode 100644 examples/light_network_prov/sdkconfig.defaults delete mode 100644 examples/light_network_prov/sdkconfig.defaults.esp32c3 delete mode 100644 examples/light_network_prov/sdkconfig.defaults.esp32h2 delete mode 100644 examples/light_network_prov/sdkconfig.defaults.esp32s3 diff --git a/examples/.build-rules.yml b/examples/.build-rules.yml index a197c8c8b..2f6047544 100644 --- a/examples/.build-rules.yml +++ b/examples/.build-rules.yml @@ -111,12 +111,6 @@ examples/ota_provider: temporary: true reason: the other targets are not tested yet -examples/light_network_prov: - enable: - - if: IDF_TARGET in ["esp32s3", "esp32c3", "esp32h2"] - temporary: true - reason: the other targets are not tested yet - examples/thread_border_router: enable: - if: IDF_TARGET in ["esp32s3"] diff --git a/examples/light_network_prov/CMakeLists.txt b/examples/light_network_prov/CMakeLists.txt deleted file mode 100644 index bf0fb733c..000000000 --- a/examples/light_network_prov/CMakeLists.txt +++ /dev/null @@ -1,41 +0,0 @@ -# The following lines of boilerplate have to be in your project's -# CMakeLists in this exact order for cmake to work correctly -cmake_minimum_required(VERSION 3.5) - -if(NOT DEFINED ENV{ESP_MATTER_PATH}) - message(FATAL_ERROR "Please set ESP_MATTER_PATH to the path of esp-matter repo") -endif(NOT DEFINED ENV{ESP_MATTER_PATH}) - -set(PROJECT_VER "1.0") -set(PROJECT_VER_NUMBER 1) - -set(ESP_MATTER_PATH $ENV{ESP_MATTER_PATH}) -set(MATTER_SDK_PATH ${ESP_MATTER_PATH}/connectedhomeip/connectedhomeip) - -# This should be done before using the IDF_TARGET variable. -include($ENV{IDF_PATH}/tools/cmake/project.cmake) -include(${ESP_MATTER_PATH}/examples/common/cmake_common/components_include.cmake) - -set(EXTRA_COMPONENT_DIRS - "${ESP_MATTER_PATH}/examples/common" - "${MATTER_SDK_PATH}/config/esp32/components" - "${ESP_MATTER_PATH}/components" - ${extra_components_dirs_append}) - -project(light-network-prov) - -# WARNING: This is just an example for using key for decrypting the encrypted OTA image -# Please do not use it as is. -if(CONFIG_ENABLE_ENCRYPTED_OTA) - target_add_binary_data(light.elf "esp_image_encryption_key.pem" TEXT) -endif() - -if(CONFIG_IDF_TARGET_ESP32C2) - include(relinker) -endif() - -idf_build_set_property(CXX_COMPILE_OPTIONS "-std=gnu++17;-Os;-DCHIP_HAVE_CONFIG_H;-Wno-overloaded-virtual" APPEND) -idf_build_set_property(C_COMPILE_OPTIONS "-Os" APPEND) -# For RISCV chips, project_include.cmake sets -Wno-format, but does not clear various -# flags that depend on -Wformat -idf_build_set_property(COMPILE_OPTIONS "-Wno-format-nonliteral;-Wno-format-security" APPEND) diff --git a/examples/light_network_prov/README.md b/examples/light_network_prov/README.md index e5bfeef29..868009f6e 100644 --- a/examples/light_network_prov/README.md +++ b/examples/light_network_prov/README.md @@ -1,146 +1,3 @@ -# Light with RainMaker-WiFi-Provisioning +# Light Network Provisioning Example -This example creates a Color Temperature Light device using the ESP Matter data model and is integrated with ESP-RainMaker and wifi_provisioning. - -See the [docs](https://docs.espressif.com/projects/esp-matter/en/latest/esp32/developing.html) for more information about building and flashing the firmware. - -## 1. Prerequisites - -- ESP32-S3-DevKitM / ESP32-C3-DevKitM -- chip-tool (For Matter commissioning) -- Android RainMaker APP of version 3.5.0+ or iOS RainMaker APP of version 3.2.1+ (For RainMaker Network Provisioning) -- [ESP-IDF](https://github.com/espressif/esp-idf) on tag v5.2.2 -- [RainMaker CLI](https://github.com/espressif/esp-rainmaker-cli) - -## 2. Additional Environment Setup - -### 2.1 Claiming device certificates - -This example will use [host driven claiming](https://rainmaker.espressif.com/docs/claiming/#host-driven-claiming) via the RainMaker CLI. - -Install esp-rainmaker-cli and login your RainMaker account: - -``` -python3 -m pip install esp-rainmaker-cli -esp-rainmaker-cli login -``` - -Make sure your device is connected to the host machine, login into the CLI and execute this: -``` -$ esp-rainmaker-cli claim --matter -``` -The CLI will fetch the device certificates and flash them into the secure cert partition of your device. The certificates will be used for both the Matter device attestation verification and RainMaker MQTT connection. - -### 2.2 Generating the factory nvs binary - -The factory nvs (fctry partition) needs to be generated using the mfg_tool of esp-matter. It is released on pypi as [esp-matter-mfg-tool](https://pypi.org/project/esp-matter-mfg-tool) and can be installed by running `pip install esp-matter-mfg-tool` - -``` -$ export ESP_SECURE_CERT_PATH=/path/to/esp_secure_cert_mgr -$ esp-matter-mfg-tool -v 0x131B -p 0x2 -cd $RMAKER_PATH/examples/matter/mfg/cd_131B_0002.der --csv $RMAKER_PATH/examples/matter/mfg/keys.csv --mcsv $RMAKER_PATH/examples/matter/mfg/master.csv -``` -This not only generates the factory nvs binary required for matter, but also embeds the RainMaker MQTT Host url into it via the master.csv file. Optionally, you can embed the MQTT host into the firmware itself by using idf.py menuconfig -> ESP RainMaker Config -> ESP_RMAKER_READ_MQTT_HOST_FROM_CONFIG and then skipping the --csv and --mcsv options to mfg_tool - -The factory binary generated above should be flashed onto the fctry partition (default : 0x3e0000 for ESP32-S3 and ESP32-C3. Do check your partition table for exact address). - -``` -$ esptool.py write_flash 0x3e0000 out/131b_2//-partition.bin -``` - -### 2.3 Build the example - -Once the environment and required files are set up, we can now proceed to build and flash the example - -``` -$ idf.py set-target -$ idf.py build -$ idf.py flash monitor -``` - -## 3. Post Commissioning Setup - -See the [docs](https://docs.espressif.com/projects/esp-matter/en/latest/esp32/developing.html#commissioning-and-control) for the information about Matter commissioning with chip-tool. Note that you need to specific the PAA path to the `paa_cert` under the directory of this example when you use the chip-tool to commisioning the device. - -``` -$ ./chip-tool pairing ble-wifi --paa-trust-store-path -``` - -**Note**: The `setup-picode` and `discriminator` is generated with the factory partition binary. You can find it in the `out/131b_2//-onb_codes.csv`. - -## 4. Additional BLE GATT Service and BLE Advertisements - -This example uses the BLEManagerImpl::ConfigureExtraServices() to configure the additional BLE GATT service for RainMaker Provisioning. The function should be called before start Matter stack. - -And you can also configure other BLE advertisements with the ble_gap_ext_adv_XX() APIs after the Matter BLE advertisement is started. - -## 5. RainMaker Provisioning - -After you flash the example to the DevKit board, the console will print the QR code for RainMaker Provisioning. After you scan the QR code with the RainMaker Phone App, the RainMaker provisioning will be done and the device will be added to your RainMaker home. - -## 6. Manufacturing Considerations - -This step is only suggested for Privately deployed Production and not required for test set up. - -### 6.1 RainMaker MQTT Host - -Find your private deployment's mqtt hostname (if applicable) by sending a GET request at `https:///mqtt_host`. You should replace the mqtt host in master.csv (As described in the section above) with this to generate the factory nvs binary. - -### 6.2 Matter VID/PID - -For production devices which may have a different matter vid and pid, please set the values of DEVICE_VENDOR_ID and DEVICE_PRODUCT_ID by using `idf.py menuconfig` -> `Component config` -> `CHIP Device Layer` -> `Device Identification Options`. These same should also be used in the `mfg_tool`. - -**Note**: The CD used by `mfg_tool` should also be changed when VID/PID is changed. Please refer to [this](https://docs.espressif.com/projects/esp-matter/en/latest/esp32/certification.html#certification-declaration) about how to generate a test CD file. - -### 6.3 Matter DAC - -For public RainMaker, some test DACs are provided via claiming. For private deployments, test DACs can be generated using `mfg_tool`. - -``` -export ESP_SECURE_CERT_PATH=/path/to/esp_secure_cert_mgr -esp-matter-mfg-tool -v -p --pai -k -c -cd --csv /path/to/keys.csv --mcsv /path/to/master.csv -``` - -Samples of keys.csv and master.csv can be found in $RMAKER_PATH/examples/matter/mfg/. - -For testing, you can use the test VID, PID, PAI and CD as shown below. -``` -$ esp-matter-mfg-tool --dac-in-secure-cert -v 0xFFF2 -p 0x8001 --pai -k $ESP_MATTER_PATH/connectedhomeip/connectedhomeip/credentials/test/attestation/Chip-Test-PAI-FFF2-8001-Key.pem -c $ESP_MATTER_PATH/connectedhomeip/connectedhomeip/credentials/test/attestation/Chip-Test-PAI-FFF2-8001-Cert.pem -cd $ESP_MATTER_PATH/connectedhomeip/connectedhomeip/credentials/test/certification-declaration/Chip-Test-CD-FFF2-8001.der --csv $RMAKER_PATH/examples/matter/mfg/keys.csv --mcsv $RMAKER_PATH/examples/matter/mfg/master.csv -``` - -Note the path where the files are generated after running the above command since it will be required later. - -### 6.4 Configure your app - -Open the project configuration menu using -``` -idf.py menuconfig -``` - -In the configuration menu, set the following additional configuration to use custom factory partition and different values for Data and Device Info Providers. - -1. Enable ESP32 Factory Data Provider [Component config → CHIP Device Layer → Commissioning options → Use ESP32 Factory Data Provider] - - Enable config option CONFIG_ENABLE_ESP32_FACTORY_DATA_PROVIDER to use ESP32 specific implementation of CommissionableDataProvider and DeviceAttestationCredentialsProvider. - -2. Enable ESP32 Device Instance Info Provider [Component config → CHIP Device Layer → Commissioning options → Use ESP32 Device Instance Info Provider] - - Enable config option ENABLE_ESP32_DEVICE_INSTANCE_INFO_PROVIDER to get device instance info from factory partition. - -3. Enable Attestation - Secure Cert [ Component config → ESP Matter → DAC Provider options → Attestation - Secure Cert] - - Enable config option CONFIG_FACTORY_PARTITION_DAC_PROVIDER to use DAC certificates from the secure_cert partition during Attestation. - -4. Set chip-factory namespace partition label [Component config → CHIP Device Layer → Matter Manufacturing Options → chip-factory namespace partition label] - - Set config option CHIP_FACTORY_NAMESPACE_PARTITION_LABEL to choose the label of the partition to store key-values in the "chip-factory" namespace. The default chosen partition label is nvs, change it to fctry. - - -Connect your esp32 device to your computer. Enter the below command to flash certificates and factory partition - -``` -$ esptool.py write_flash 0xd000 /out/_//_esp_secure_cert.bin 0x3e0000 ./out/_//-partition.bin -``` - -The csv file generate at `/out/_/cn_dacs--