components/esp_matter_console: add the "matter esp factoryreset"

"matter device factoryreset" just erases the non volatile storage of
connectedhomeip SDK. This adds one more command which clears the non
volatile storage of esp-matter SDK as well.
This commit is contained in:
Shubham Patil
2024-12-12 17:07:40 +05:30
parent 5b84c67189
commit 11c2f668c5
5 changed files with 56 additions and 2 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: