Merge branch 'factory-reset' into 'main'

components/esp_matter_console: add the "matter esp factoryreset"

See merge request app-frameworks/esp-matter!984
This commit is contained in:
Shu Chen
2024-12-27 14:25:46 +08:00
24 changed files with 77 additions and 5 deletions
+5
View File
@@ -1,3 +1,8 @@
# 27-December-2024
Added ``matter esp factoryreset`` command to factory reset a Matter device.
This command erases the esp-matter and connectedhomeip SDK's non-volatile storage.
# 15-Oct-2024
API Change
+1 -1
View File
@@ -3,7 +3,7 @@ if (CONFIG_ENABLE_CHIP_SHELL)
list(APPEND src_dirs ".")
endif()
set(priv_req chip mbedtls esp_timer bt openthread)
set(priv_req chip mbedtls esp_timer bt openthread esp_matter)
if ("${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}" VERSION_GREATER_EQUAL "5.0")
list(APPEND priv_req esp_rcp_update)
endif()
@@ -155,5 +155,14 @@ esp_err_t otcli_register_commands();
*/
esp_err_t udc_register_commands();
/** Add Factory Reset Commands
*
* Adds the default factory reset commands.
*
* @return ESP_OK on success.
* @return error in case of failure.
*/
esp_err_t factoryreset_register_commands();
} // namespace console
} // namespace esp_matter
@@ -0,0 +1,40 @@
// Copyright 2024 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <esp_check.h>
#include <esp_log.h>
#include <esp_matter_console.h>
#include <esp_matter_core.h>
namespace esp_matter {
namespace console {
static engine factoryreset;
static esp_err_t factoryreset_dispatch(int argc, char *argv[])
{
return factory_reset();
}
esp_err_t factoryreset_register_commands()
{
static const command_t command = {
.name = "factoryreset",
.description = "factoryreset the device. Usage: matter esp factoryreset.",
.handler = factoryreset_dispatch,
};
return add_commands(&command, 1);
}
} // namespace console
} // namespace esp_matter
+1 -1
View File
@@ -521,7 +521,7 @@ The console on the device can be used to run commands for testing. It is configu
::
matter device factoryreset
matter esp factoryreset
- On-boarding codes: Dump the on-boarding pairing code payloads:
+1 -1
View File
@@ -24,7 +24,7 @@ On boot-up esp-idf console starts. In order to create a device user have to use
- Use `create --device_type` to list all supported device types.
- Use `create --device_type=on_off_light` to create light device.
- To delete existing device perform `matter device factoryreset`.
- To delete existing device perform `matter esp factoryreset`.
- To add new device, say fan or any other device type use `create --device_type=fan`.
Setup OTBR for a device
@@ -216,6 +216,7 @@ extern "C" void app_main()
#if CONFIG_ENABLE_CHIP_SHELL
esp_matter::console::diagnostics_register_commands();
esp_matter::console::wifi_register_commands();
esp_matter::console::factoryreset_register_commands();
esp_matter::console::init();
#ifdef CONFIG_OPENTHREAD_CLI
esp_matter::console::otcli_register_commands();
@@ -145,6 +145,7 @@ extern "C" void app_main()
#if CONFIG_ENABLE_CHIP_SHELL
esp_matter::console::diagnostics_register_commands();
esp_matter::console::factoryreset_register_commands();
esp_matter::console::init();
#endif
}
@@ -97,6 +97,7 @@ extern "C" void app_main()
esp_matter::console::diagnostics_register_commands();
esp_matter::console::wifi_register_commands();
esp_matter::console::bridge_register_commands();
esp_matter::console::factoryreset_register_commands();
esp_matter::console::init();
#endif
}
@@ -193,6 +193,7 @@ extern "C" void app_main()
#if CONFIG_ENABLE_CHIP_SHELL
esp_matter::console::diagnostics_register_commands();
esp_matter::console::wifi_register_commands();
esp_matter::console::factoryreset_register_commands();
esp_matter::console::init();
#endif
}
@@ -145,6 +145,7 @@ extern "C" void app_main()
#if CONFIG_ENABLE_CHIP_SHELL
esp_matter::console::diagnostics_register_commands();
esp_matter::console::wifi_register_commands();
esp_matter::console::factoryreset_register_commands();
esp_matter::console::init();
#endif
launch_app_zboss();
+1
View File
@@ -71,6 +71,7 @@ extern "C" void app_main()
#if CONFIG_ENABLE_CHIP_SHELL
esp_matter::console::diagnostics_register_commands();
esp_matter::console::wifi_register_commands();
esp_matter::console::factoryreset_register_commands();
esp_matter::console::init();
#if CONFIG_ESP_MATTER_CONTROLLER_ENABLE
esp_matter::console::controller_register_commands();
+1
View File
@@ -361,6 +361,7 @@ extern "C" void app_main()
esp_matter::console::diagnostics_register_commands();
esp_matter::console::wifi_register_commands();
esp_matter::console::factoryreset_register_commands();
esp_matter::console::init();
#endif
}
+1
View File
@@ -212,6 +212,7 @@ extern "C" void app_main()
#if CONFIG_ENABLE_CHIP_SHELL
esp_matter::console::diagnostics_register_commands();
esp_matter::console::wifi_register_commands();
esp_matter::console::factoryreset_register_commands();
#if CONFIG_OPENTHREAD_CLI
esp_matter::console::otcli_register_commands();
#endif
@@ -245,6 +245,7 @@ extern "C" void app_main()
#if CONFIG_ENABLE_CHIP_SHELL
esp_matter::console::diagnostics_register_commands();
esp_matter::console::wifi_register_commands();
esp_matter::console::factoryreset_register_commands();
esp_matter::console::init();
#endif
+1
View File
@@ -225,6 +225,7 @@ extern "C" void app_main()
#if CONFIG_ENABLE_CHIP_SHELL
esp_matter::console::diagnostics_register_commands();
esp_matter::console::wifi_register_commands();
esp_matter::console::factoryreset_register_commands();
#if CONFIG_OPENTHREAD_CLI
esp_matter::console::otcli_register_commands();
#endif
+1
View File
@@ -159,6 +159,7 @@ extern "C" void app_main()
#if CONFIG_ENABLE_CHIP_SHELL
esp_matter::console::diagnostics_register_commands();
esp_matter::console::wifi_register_commands();
esp_matter::console::factoryreset_register_commands();
esp_matter::console::init();
#endif
}
@@ -317,6 +317,7 @@ extern "C" void app_main()
#if CONFIG_ENABLE_CHIP_SHELL
esp_matter::console::diagnostics_register_commands();
esp_matter::console::wifi_register_commands();
esp_matter::console::factoryreset_register_commands();
esp_matter::console::init();
#endif
}
@@ -237,6 +237,7 @@ extern "C" void app_main()
#if CONFIG_ENABLE_CHIP_SHELL
esp_matter::console::diagnostics_register_commands();
esp_matter::console::wifi_register_commands();
esp_matter::console::factoryreset_register_commands();
#if CONFIG_OPENTHREAD_CLI
esp_matter::console::otcli_register_commands();
#endif
+1
View File
@@ -68,6 +68,7 @@ extern "C" void app_main()
#if CONFIG_ENABLE_CHIP_SHELL
esp_matter::console::diagnostics_register_commands();
esp_matter::console::wifi_register_commands();
esp_matter::console::factoryreset_register_commands();
esp_matter::console::init();
#endif // CONFIG_ENABLE_CHIP_SHELL
}
+3 -2
View File
@@ -113,10 +113,10 @@ extern "C" void app_main()
temperature_controlled_cabinet::config_t temperature_controlled_cabinet_config;
endpoint_t *endpoint1 = temperature_controlled_cabinet::create(node, &temperature_controlled_cabinet_config, ENDPOINT_FLAG_NONE, NULL);
ABORT_APP_ON_FAILURE(endpoint1 != nullptr, ESP_LOGE(TAG, "Failed to create temperature controlled cabinet endpoint"));
esp_matter::cluster_t *cluster = esp_matter::cluster::get(endpoint1, chip::app::Clusters::TemperatureControl::Id);
// Atlest one of temperature_number and temperature_level feature is mandatory.
// Atlest one of temperature_number and temperature_level feature is mandatory.
cluster::temperature_control::feature::temperature_number::config_t temperature_number_config;
cluster::temperature_control::feature::temperature_number::add(cluster, &temperature_number_config);
@@ -148,6 +148,7 @@ extern "C" void app_main()
#if CONFIG_ENABLE_CHIP_SHELL
esp_matter::console::diagnostics_register_commands();
esp_matter::console::wifi_register_commands();
esp_matter::console::factoryreset_register_commands();
esp_matter::console::init();
#endif
}
@@ -175,6 +175,7 @@ extern "C" void app_main()
#if CONFIG_ENABLE_CHIP_SHELL
esp_matter::console::diagnostics_register_commands();
esp_matter::console::wifi_register_commands();
esp_matter::console::factoryreset_register_commands();
esp_matter::console::init();
#endif
}
@@ -114,6 +114,7 @@ extern "C" void app_main()
#if CONFIG_ENABLE_CHIP_SHELL
esp_matter::console::diagnostics_register_commands();
esp_matter::console::wifi_register_commands();
esp_matter::console::factoryreset_register_commands();
esp_matter::console::init();
#endif // CONFIG_ENABLE_CHIP_SHELL
}
+1
View File
@@ -116,6 +116,7 @@ extern "C" void app_main()
#if CONFIG_ENABLE_CHIP_SHELL
esp_matter::console::diagnostics_register_commands();
esp_matter::console::wifi_register_commands();
esp_matter::console::factoryreset_register_commands();
esp_matter::console::init();
#endif
}