Merge branch 'task/default-claim' into 'master'

esp_rainmaker: Make Assisted Claiming and Challenge-Response as defaults

See merge request app-frameworks/esp-rainmaker!603
This commit is contained in:
Piyush Shah
2025-12-22 16:58:20 +05:30
12 changed files with 115 additions and 45 deletions

View File

@@ -62,22 +62,11 @@ before_script:
- for EXAMPLE in $EXAMPLES; do
- cd $CI_PROJECT_DIR/examples/$EXAMPLE
- echo Building $EXAMPLE
- if [[ "$EXAMPLE" == "homekit_switch" ]]; then
- cd components
- echo Cloning esp-homekit-sdk
- git clone --recursive --branch master --depth 1 https://github.com/espressif/esp-homekit-sdk.git
- cd ..
- export HOMEKIT_PATH=$PWD/components/esp-homekit-sdk
- fi
- if [[ "$EXAMPLE" == "thread_br" ]]; then
- sed -i "/CONFIG_LWIP_IPV6_NUM_ADDRESSES=8/c\\CONFIG_LWIP_IPV6_NUM_ADDRESSES=12" sdkconfig.defaults
- sed -i "/CONFIG_LWIP_IPV6_NUM_ADDRESSES=8/c\\CONFIG_LWIP_IPV6_NUM_ADDRESSES=12" sdkconfig.defaults
- fi
- for TARGET in $EXAMPLE_TARGETS; do
- echo Building for $TARGET
- if [[ "$EXAMPLE" == "homekit_switch" && "$TARGET" == "esp32h2" ]]; then
- echo "Skipping homekit_switch build for esp32h2"
- continue
- fi
- rm -rf managed_components dependencies.lock build sdkconfig sdkconfig.old
- idf.py set-target $TARGET
- idf.py build
@@ -85,10 +74,10 @@ before_script:
- cp $CI_PROJECT_DIR/examples/$EXAMPLE/build/*.bin $CI_PROJECT_DIR/esp-rainmaker-bins-${CI_JOB_ID}/$EXAMPLE/$TARGET/
- done
- echo Build Complete for $EXAMPLE
- done
- if [[ "$EXAMPLE" == "thread_br" ]]; then
- sed -i "/CONFIG_LWIP_IPV6_NUM_ADDRESSES=12/c\\CONFIG_LWIP_IPV6_NUM_ADDRESSES=8" sdkconfig.defaults
- sed -i "/CONFIG_LWIP_IPV6_NUM_ADDRESSES=12/c\\CONFIG_LWIP_IPV6_NUM_ADDRESSES=8" sdkconfig.defaults
- fi
- done
# Generating zip file for binaries generated
- cd $CI_PROJECT_DIR
- echo Generating zip file for binaries generated
@@ -119,6 +108,33 @@ before_script:
- echo Generating zip file for binaries generated
- tar -zcvf esp-rainmaker-bins-${CI_JOB_ID}.zip esp-rainmaker-bins-${CI_JOB_ID}/
.build_homekit_examples: &build_homekit_examples
- pip install --upgrade idf-component-manager
# Clone esp-homekit-sdk
- cd $CI_PROJECT_DIR/examples/homekit_switch
- cd components
- echo Cloning esp-homekit-sdk
- git clone --recursive --branch master --depth 1 https://github.com/espressif/esp-homekit-sdk.git
- cd ..
- export HOMEKIT_PATH=$PWD/components/esp-homekit-sdk
# start building homekit_switch example
- cd $CI_PROJECT_DIR/examples/homekit_switch
- echo Building homekit_switch
# build for the targets
- for TARGET in $EXAMPLE_TARGETS; do
- echo Building for $TARGET
- rm -rf managed_components dependencies.lock build sdkconfig sdkconfig.old
- idf.py set-target $TARGET
- idf.py build
- mkdir -p $CI_PROJECT_DIR/esp-rainmaker-bins-${CI_JOB_ID}/homekit_switch/$TARGET/
- cp $CI_PROJECT_DIR/examples/homekit_switch/build/*.bin $CI_PROJECT_DIR/esp-rainmaker-bins-${CI_JOB_ID}/homekit_switch/$TARGET/
- done
- echo Build Complete for homekit_switch
# Generating zip file for binaries generated
- cd $CI_PROJECT_DIR
- echo Generating zip file for binaries generated
- tar -zcvf esp-rainmaker-bins-${CI_JOB_ID}.zip esp-rainmaker-bins-${CI_JOB_ID}/
.build_template:
stage: build
image: espressif/idf:latest
@@ -129,7 +145,7 @@ before_script:
EXTRA_CFLAGS: "${PEDANTIC_FLAGS}"
EXTRA_CXXFLAGS: "${PEDANTIC_FLAGS}"
EXAMPLE_TARGETS: "esp32"
EXAMPLES: "switch led_light fan temperature_sensor multi_device gpio homekit_switch"
EXAMPLES: "switch led_light fan temperature_sensor multi_device gpio"
script:
- *build_all_examples
@@ -161,7 +177,7 @@ build_idf_v5.5:
extends: .build_template
image: espressif/idf:release-v5.5
variables:
EXAMPLE_TARGETS: "esp32 esp32s2 esp32c3 esp32s3 esp32c6 esp32c2 esp32h2"
EXAMPLE_TARGETS: "esp32 esp32s2 esp32c3 esp32s3 esp32c6 esp32c2 esp32h2 esp32c5"
build_standalone_camera:
extends: .build_template
@@ -183,6 +199,14 @@ build_split_camera:
script:
- *build_camera_examples
build_homekit:
extends: .build_template
image: espressif/idf:release-v5.5
variables:
EXAMPLE_TARGETS: "esp32 esp32s2 esp32c3 esp32s3 esp32c6 esp32c2"
script:
- *build_homekit_examples
build_thread_br:
extends: .build_template
image: espressif/idf:release-v5.3
@@ -294,28 +318,3 @@ push_master_to_github:
- git remote remove github &>/dev/null || true
- git remote add github git@github.com:espressif/esp-rainmaker.git
- git push github "${CI_COMMIT_SHA}:refs/heads/${CI_COMMIT_REF_NAME}"
build_esp32c5_preview:
extends: .build_template
image: espressif/idf:release-v5.5
variables:
EXAMPLE_TARGETS: "esp32c5"
EXAMPLES: "switch led_light fan temperature_sensor multi_device gpio"
script:
- pip install --upgrade idf-component-manager
- for EXAMPLE in $EXAMPLES; do
- cd $CI_PROJECT_DIR/examples/$EXAMPLE
- echo Building $EXAMPLE
- for TARGET in $EXAMPLE_TARGETS; do
- echo Building for $TARGET
- idf.py --preview set-target $TARGET
- idf.py build
- mkdir -p $CI_PROJECT_DIR/esp-rainmaker-bins-${CI_JOB_ID}/$EXAMPLE/$TARGET/
- cp $CI_PROJECT_DIR/examples/$EXAMPLE/build/*.bin $CI_PROJECT_DIR/esp-rainmaker-bins-${CI_JOB_ID}/$EXAMPLE/$TARGET/
- done
- echo Build Complete for $EXAMPLE
- done
# Generating zip file for binaries generated
- cd $CI_PROJECT_DIR
- echo Generating zip file for binaries generated
- tar -zcvf esp-rainmaker-bins-${CI_JOB_ID}.zip esp-rainmaker-bins-${CI_JOB_ID}/

View File

@@ -1,5 +1,19 @@
# Changes
## Default Claiming Type and User-Node Mapping Changes (Behavioral Changes)
**IMPORTANT BEHAVIORAL CHANGES**: Two significant default behavior changes have been made in ESP RainMaker:
1. **Assisted Claiming is now the default for all supported platforms**: Assisted claiming (via phone apps) is now enabled by default for all platforms that support it (requires Bluetooth enabled and not ESP32S2). Previously, it was only the default for ESP32, with self claiming being the default for other platforms. This change provides a more consistent user experience across platforms and enables admin role support.
**To revert to self claiming**: Set `CONFIG_ESP_RMAKER_SELF_CLAIM=y` in menuconfig (`idf.py menuconfig -> ESP RainMaker Config -> Claiming Type -> Use Self Claiming`).
2. **Challenge Response based user-node mapping is now enabled by default**: Challenge response mechanism during provisioning is now enabled by default for improved security and reliability. This replaces the traditional user-node mapping flow and ensures that node mapping happens before Wi-Fi credentials are sent. Traditional user-node mapping provisioning is automatically disabled when this is enabled.
**To disable challenge response**: Set `CONFIG_ESP_RMAKER_ENABLE_CHALLENGE_RESPONSE=n` in menuconfig (`idf.py menuconfig -> ESP RainMaker Config -> Enable Challenge Response during provisioning`). Note that challenge response requires the node to be claimed before it can be used.
For more details, check the esp_rainmaker component's [CHANGELOG](components/esp_rainmaker/CHANGELOG.md).
## 24-Jun-2024: OTA Reliability Improvements
- Check details in esp_rainmaker component's [CHANGELOG](components/esp_rainmaker/CHANGELOG.md).

View File

@@ -1,5 +1,15 @@
# Changelog
## 1.8.5
### Changes
- Assisted claiming is now the default for all supported platforms (requires Bluetooth enabled and not ESP32S2).
Previously, it was only the default for ESP32. To revert to self claiming, set `CONFIG_ESP_RMAKER_SELF_CLAIM=y` in menuconfig.
- Challenge response based user-node mapping is now enabled by default. This replaces the traditional user-node mapping flow.
To disable it, set `CONFIG_ESP_RMAKER_ENABLE_CHALLENGE_RESPONSE=n` in menuconfig.
Note that challenge response requires the node to be claimed before it can be used.
## 1.8.4
### New Feature

View File

@@ -2,8 +2,8 @@ menu "ESP RainMaker Config"
choice ESP_RMAKER_CLAIM_TYPE
bool "Claiming Type"
default ESP_RMAKER_ASSISTED_CLAIM if BT_ENABLED && !IDF_TARGET_ESP32S2
default ESP_RMAKER_SELF_CLAIM
default ESP_RMAKER_ASSISTED_CLAIM if IDF_TARGET_ESP32
help
Claiming type to be used.
@@ -200,7 +200,7 @@ menu "ESP RainMaker Config"
config ESP_RMAKER_ENABLE_CHALLENGE_RESPONSE
bool "Enable Challenge Response during provisioning"
select ESP_RMAKER_FACTORY_RESET_REPORTING
default n
default y
help
Enable challenge response mechanism during provisioning to verify node authenticity.
The node will receive a challenge from the client during provisioning, which it will

View File

@@ -1,5 +1,4 @@
## IDF Component Manager Manifest File
version: "1.8.4"
version: "1.8.5"
description: ESP RainMaker firmware agent
url: https://github.com/espressif/esp-rainmaker/tree/master/components/esp_rainmaker
repository: https://github.com/espressif/esp-rainmaker.git

View File

@@ -11,12 +11,14 @@
#include <esp_log.h>
#include <esp_wifi.h>
#include <esp_console.h>
#include <esp_partition.h>
#include <esp_rmaker_core.h>
#include <esp_rmaker_user_mapping.h>
#include <esp_rmaker_utils.h>
#include <esp_rmaker_cmd_resp.h>
#include <esp_rmaker_internal.h>
#include <network_provisioning/manager.h>
#include <sdkconfig.h>
/* Include internal header to access device structure */
#include "esp_rmaker_internal.h"
@@ -538,6 +540,45 @@ static void register_param_commands()
#endif /* CONFIG_ESP_RMAKER_CONSOLE_PARAM_CMDS_ENABLE */
static int clear_claim_data_handler(int argc, char** argv)
{
const char *partition_name = "fctry";
#ifdef CONFIG_ESP_RMAKER_FACTORY_PARTITION_NAME
partition_name = CONFIG_ESP_RMAKER_FACTORY_PARTITION_NAME;
#endif
printf("%s: Erasing fctry partition (%s)...\n", TAG, partition_name);
const esp_partition_t *partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA,
ESP_PARTITION_SUBTYPE_DATA_NVS,
partition_name);
if (!partition) {
printf("%s: Failed to find partition '%s'\n", TAG, partition_name);
return ESP_FAIL;
}
esp_err_t err = esp_partition_erase_range(partition, 0, partition->size);
if (err != ESP_OK) {
printf("%s: Failed to erase partition '%s'. Error: %d\n", TAG, partition_name, err);
return err;
}
printf("%s: Successfully erased fctry partition (%s). Rebooting...\n", TAG, partition_name);
esp_rmaker_reboot(2);
return ESP_OK;
}
static void register_clear_claim_data()
{
const esp_console_cmd_t cmd = {
.command = "clear-claim-data",
.help = "Erase the fctry NVS partition (clears claim data)",
.func = &clear_claim_data_handler,
};
ESP_LOGI(TAG, "Registering command: %s", cmd.command);
esp_console_cmd_register(&cmd);
}
void esp_rmaker_register_commands()
{
register_user_node_mapping();
@@ -547,6 +588,7 @@ void esp_rmaker_register_commands()
register_cmd_resp_command();
#endif
register_sign_data_command();
register_clear_claim_data();
#ifdef CONFIG_ESP_RMAKER_CONSOLE_PARAM_CMDS_ENABLE
register_param_commands();
#endif

View File

@@ -0,0 +1 @@
CONFIG_COMPILER_OPTIMIZATION_SIZE=y

View File

@@ -0,0 +1 @@
CONFIG_COMPILER_OPTIMIZATION_SIZE=y

View File

@@ -0,0 +1 @@
CONFIG_COMPILER_OPTIMIZATION_SIZE=y

View File

@@ -0,0 +1 @@
CONFIG_COMPILER_OPTIMIZATION_SIZE=y

View File

@@ -0,0 +1 @@
CONFIG_COMPILER_OPTIMIZATION_SIZE=y

View File

@@ -0,0 +1 @@
CONFIG_COMPILER_OPTIMIZATION_SIZE=y