esp-matter: Minor miscellaneous fixes

examples: Changes to events and comments.
switch: Rename to light_switch.
docs: Minor changes.
This commit is contained in:
Chirag Atal
2022-05-23 12:11:41 +05:30
committed by Shu Chen
parent 28b385d228
commit 58ede577ef
26 changed files with 100 additions and 51 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

+3 -3
View File
@@ -65,8 +65,8 @@ for it to work. Check the example's "Additional Environment Setup" section for m
:maxdepth: 1
Light <examples/light>
Light Switch <examples/light_switch>
RainMaker Light <examples/rainmaker_light>
Switch <examples/switch>
Zap Light <examples/zap_light>
ZigBee Bridge <examples/zigbee_bridge>
@@ -178,8 +178,8 @@ for it to work. Check the example's "Post Commissioning Setup" section for more
:maxdepth: 1
Light <examples/light>
Light Switch <examples/light_switch>
RainMaker Light <examples/rainmaker_light>
Switch <examples/switch>
Zap Light <examples/zap_light>
ZigBee Bridge <examples/zigbee_bridge>
@@ -636,7 +636,7 @@ As an example, you can build *light* example on ``ESP32_custom`` platform with f
~~~~~~~~~~~~~~~~~~~
- In the examples, the boot button on the devkit is mapped to
``toggle``. In case the device is a client (eg. switch), the toggle
``toggle``. In case the device is a client (eg. light_switch), the toggle
command is sent to the binded devices.
- Factory reset has also been mapped to the same boot button. When the
button is pressed for more than 5 seconds, factory reset is
@@ -1,5 +1,5 @@
Switch
======
Light Switch
============
1. Additional Environment Setup
-------------------------------
+17 -18
View File
@@ -6,18 +6,17 @@ A1.1 Compilation errors
I cannot build the application:
- Make sure you are on the correct esp-idf branch. Run ``git submodule
- Make sure you are on the correct esp-idf branch/release. Run ``git submodule
update —init —recursive`` to make sure the submodules are at the
correct heads
- Make sure you have the correct ESP_MATTER_PATH (and any other paths)
is (are) exported.
- Make sure you have the correct ESP_MATTER_PATH (and any other required paths).
- Delete the build/ directory and also sdkconfig and sdkconfig.old and
then build again.
- If you are still facing issues, reproduce the issue on the default
example and then raise an `issue <https://github.com/espressif/esp-matter/issues>`__. Please make sure to
- If you are still facing issues, reproduce it on the default
example and then raise it `here <https://github.com/espressif/esp-matter/issues>`__. Please make sure to
share these:
- The complete build logs.
- The complete device logs taken over UART.
- The esp-matter and esp-idf branch you are using.
A1.2 Device commissioning using chip-tool
@@ -28,8 +27,8 @@ I cannot commission a new device through the chip-tool:
- If the ``chip-tool pairing ble-wifi`` command is failing,
make sure the arguments are correct.
- Make sure Bluetooth is turned on, on your client (host).
- If you are still facing issues, reproduce the issue on the default
example for the device and then raise an `issue <https://github.com/espressif/esp-matter/issues>`__. Make sure
- If you are still facing issues, reproduce it on the default
example for the device and then raise it `here <https://github.com/espressif/esp-matter/issues>`__. Make sure
to share these:
- The complete device logs.
@@ -38,7 +37,7 @@ I cannot commission a new device through the chip-tool:
Bluetooth/BLE does not work on by device:
- There are some known issues where BLE does not work on MacOS.
- There are some `known issues <https://github.com/project-chip/connectedhomeip/issues/13303>`__ where BLE does not work on MacOS.
- In this case, the following can be done:
- Run the device console command:
@@ -46,8 +45,8 @@ Bluetooth/BLE does not work on by device:
- Run the chip-tool command for commissioning over ip:
``chip-tool pairing onnetwork 1 20202021``.
- If you are still facing issues, reproduce the issue on the default
example for the device and then raise an `issue <https://github.com/espressif/esp-matter/issues>`__. Make sure
- If you are still facing issues, reproduce it on the default
example for the device and then raise it `here <https://github.com/espressif/esp-matter/issues>`__. Make sure
to share these:
- The complete device logs taken over UART.
@@ -71,8 +70,8 @@ My device is crashing:
is (are) exported.
- Delete the build/ directory and also sdkconfig and sdkconfig.old and
then build and flash again.
- If you are still facing issues, reproduce the issue on the default
example for the device and then raise an `issue <https://github.com/espressif/esp-matter/issues>`__. Make sure
- If you are still facing issues, reproduce it on the default
example for the device and then raise it `here <https://github.com/espressif/esp-matter/issues>`__. Make sure
to share these:
- The steps you followed to reproduce the issue.
@@ -101,8 +100,8 @@ My device is not responding to commands:
to the Wi-Fi.
- Make sure the node_id and the endpoint_id are correct in the command
from chip-tool.
- If you are still facing issues, reproduce the issue on the default
example for the device and then raise an `issue <https://github.com/espressif/esp-matter/issues>`__. Make sure
- If you are still facing issues, reproduce it on the default
example for the device and then raise it `here <https://github.com/espressif/esp-matter/issues>`__. Make sure
to share these:
- The steps you followed to reproduce the issue.
@@ -133,8 +132,8 @@ The LED on my devkit is not working:
- Check the version of your board, and if it has the LED connected to a
different pin. If it is different, you can change the
led_driver_config_t accordingly in the device.c file.
- If you are still facing issues, reproduce the issue on the default
example for the device and then raise an `issue <https://github.com/espressif/esp-matter/issues>`__. Make sure
- If you are still facing issues, reproduce it on the default
example for the device and then raise it `here <https://github.com/espressif/esp-matter/issues>`__. Make sure
to share these:
- The complete device logs taken over UART.
@@ -147,7 +146,7 @@ The LED on my devkit is not working:
:maxdepth: 1
Light <examples/light>
Light Switch <examples/light_switch>
RainMaker Light <examples/rainmaker_light>
Switch <examples/switch>
Zap Light <examples/zap_light>
ZigBee Bridge <examples/zigbee_bridge>
+7 -2
View File
@@ -51,6 +51,11 @@ Espressif's AIoT cloud platform `ESP RainMaker <https://rainmaker.espressif.com/
todo. Add a supported services diagram similar to the one ad the end of this page https://rainmaker.espressif.com/?
.. figure:: ../_static/supported_services.png
:align: center
:alt: ESP Matter Supported Services
:figclass: align-center
By combining the above-mentioned Matter hardware and software solutions with ESP RainMaker, this one-stop Matter ecosystem solution provides:
- Interconnection with Amazon, Google and Apple
@@ -126,8 +131,8 @@ It also initializes ESP RainMaker which enables Device Management and
OTA using the RainMaker cloud. If user node association is done, it also
enables Remote Control through RainMaker.
1.3.3 Switch
~~~~~~~~~~~~
1.3.3 Light Switch
~~~~~~~~~~~~~~~~~~
This application creates an On/Off Light Switch device using the ESP Matter
data model.
+1 -1
View File
@@ -47,7 +47,7 @@ Connect to Wi-Fi network.
Dump the device static configuration
- Facotry reset
- Factory reset
```
> matter device factoryreset
+14 -5
View File
@@ -27,13 +27,21 @@ using namespace esp_matter::endpoint;
static void app_event_cb(const ChipDeviceEvent *event, intptr_t arg)
{
if (event->Type == chip::DeviceLayer::DeviceEventType::PublicEventTypes::kInterfaceIpAddressChanged) {
switch (event->Type) {
case chip::DeviceLayer::DeviceEventType::PublicEventTypes::kInterfaceIpAddressChanged:
#if !CHIP_DEVICE_CONFIG_ENABLE_THREAD
chip::app::DnssdServer::Instance().StartServer();
esp_route_hook_init(esp_netif_get_handle_from_ifkey("WIFI_STA_DEF"));
#endif
break;
case chip::DeviceLayer::DeviceEventType::PublicEventTypes::kCommissioningComplete:
ESP_LOGI(TAG, "Commissioning complete");
break;
default:
break;
}
ESP_LOGI(TAG, "Current free heap: %zu", heap_caps_get_free_size(MALLOC_CAP_8BIT));
}
static esp_err_t app_attribute_update_cb(callback_type_t type, uint16_t endpoint_id, uint32_t cluster_id,
@@ -58,7 +66,7 @@ extern "C" void app_main()
/* Initialize the ESP NVS layer */
nvs_flash_init();
/* Create matter device */
/* Create a Matter node */
node::config_t node_config;
node_t *node = node::create(&node_config, app_attribute_update_cb, NULL);
@@ -68,12 +76,13 @@ extern "C" void app_main()
light_config.color_control.hue_saturation.current_hue = DEFAULT_HUE;
light_config.color_control.hue_saturation.current_saturation = DEFAULT_SATURATION;
endpoint_t *endpoint = color_dimmable_light::create(node, &light_config, ENDPOINT_FLAG_NONE);
light_endpoint_id = endpoint::get_id(endpoint);
/* These node and endpoint handles can be used to create/add other endpoints and clusters. */
if (!node || !endpoint) {
ESP_LOGE(TAG, "Matter device creation failed");
ESP_LOGE(TAG, "Matter node creation failed");
}
light_endpoint_id = endpoint::get_id(endpoint);
ESP_LOGI(TAG, "Light created with endpoint_id %d", light_endpoint_id);
/* Initialize driver */
@@ -22,7 +22,7 @@ endif(NOT DEFINED ENV{ESP_MATTER_DEVICE_PATH})
set(ESP_MATTER_PATH $ENV{ESP_MATTER_PATH})
set(MATTER_SDK_PATH ${ESP_MATTER_PATH}/connectedhomeip/connectedhomeip)
set(ZAP_GENERATED_PATH ${ESP_MATTER_PATH}/examples/switch/main/zap-generated)
set(ZAP_GENERATED_PATH ${CMAKE_CURRENT_LIST_DIR}/main/zap-generated)
# This should be done before using the IDF_TARGET variable.
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
@@ -36,7 +36,7 @@ set(EXTRA_COMPONENT_DIRS
"${ESP_MATTER_PATH}/device_hal/device"
${extra_components_dirs_append})
project(switch)
project(light_switch)
idf_build_set_property(CXX_COMPILE_OPTIONS "-std=gnu++14;-Os;-DLWIP_IPV6_SCOPES=0;-DCHIP_HAVE_CONFIG_H" APPEND)
idf_build_set_property(C_COMPILE_OPTIONS "-Os;-DLWIP_IPV6_SCOPES=0" APPEND)
@@ -1,4 +1,4 @@
# Switch Example
# Light Switch Example
## Building and Flashing the Firmware
@@ -27,13 +27,21 @@ using namespace esp_matter::endpoint;
static void app_event_cb(const ChipDeviceEvent *event, intptr_t arg)
{
if (event->Type == chip::DeviceLayer::DeviceEventType::PublicEventTypes::kInterfaceIpAddressChanged) {
switch (event->Type) {
case chip::DeviceLayer::DeviceEventType::PublicEventTypes::kInterfaceIpAddressChanged:
#if !CHIP_DEVICE_CONFIG_ENABLE_THREAD
chip::app::DnssdServer::Instance().StartServer();
esp_route_hook_init(esp_netif_get_handle_from_ifkey("WIFI_STA_DEF"));
#endif
break;
case chip::DeviceLayer::DeviceEventType::PublicEventTypes::kCommissioningComplete:
ESP_LOGI(TAG, "Commissioning complete");
break;
default:
break;
}
ESP_LOGI(TAG, "Current free heap: %zu", heap_caps_get_free_size(MALLOC_CAP_8BIT));
}
static esp_err_t app_attribute_update_cb(callback_type_t type, uint16_t endpoint_id, uint32_t cluster_id,
@@ -58,18 +66,19 @@ extern "C" void app_main()
/* Initialize the ESP NVS layer */
nvs_flash_init();
/* Create matter device */
/* Create a Matter node */
node::config_t node_config;
node_t *node = node::create(&node_config, app_attribute_update_cb, NULL);
on_off_switch::config_t switch_config;
endpoint_t *endpoint = on_off_switch::create(node, &switch_config, ENDPOINT_FLAG_NONE);
switch_endpoint_id = endpoint::get_id(endpoint);
/* These node and endpoint handles can be used to create/add other endpoints and clusters. */
if (!node || !endpoint) {
ESP_LOGE(TAG, "Matter device creation failed");
ESP_LOGE(TAG, "Matter node creation failed");
}
switch_endpoint_id = endpoint::get_id(endpoint);
ESP_LOGI(TAG, "Switch created with endpoint_id %d", switch_endpoint_id);
/* Initialize driver */
+14 -5
View File
@@ -27,13 +27,21 @@ using namespace esp_matter::endpoint;
static void app_event_cb(const ChipDeviceEvent *event, intptr_t arg)
{
if (event->Type == chip::DeviceLayer::DeviceEventType::PublicEventTypes::kInterfaceIpAddressChanged) {
switch (event->Type) {
case chip::DeviceLayer::DeviceEventType::PublicEventTypes::kInterfaceIpAddressChanged:
#if !CHIP_DEVICE_CONFIG_ENABLE_THREAD
chip::app::DnssdServer::Instance().StartServer();
esp_route_hook_init(esp_netif_get_handle_from_ifkey("WIFI_STA_DEF"));
#endif
break;
case chip::DeviceLayer::DeviceEventType::PublicEventTypes::kCommissioningComplete:
ESP_LOGI(TAG, "Commissioning complete");
break;
default:
break;
}
ESP_LOGI(TAG, "Current free heap: %zu", heap_caps_get_free_size(MALLOC_CAP_8BIT));
}
static esp_err_t app_attribute_update_cb(callback_type_t type, uint16_t endpoint_id, uint32_t cluster_id,
@@ -59,7 +67,7 @@ extern "C" void app_main()
/* Initialize the ESP NVS layer */
nvs_flash_init();
/* Create matter device */
/* Create a Matter node */
node::config_t node_config;
node_t *node = node::create(&node_config, app_attribute_update_cb, NULL);
@@ -69,12 +77,13 @@ extern "C" void app_main()
light_config.color_control.hue_saturation.current_hue = DEFAULT_HUE;
light_config.color_control.hue_saturation.current_saturation = DEFAULT_SATURATION;
endpoint_t *endpoint = color_dimmable_light::create(node, &light_config, ENDPOINT_FLAG_NONE);
light_endpoint_id = endpoint::get_id(endpoint);
/* These node and endpoint handles can be used to create/add other endpoints and clusters. */
if (!node || !endpoint) {
ESP_LOGE(TAG, "Matter device creation failed");
ESP_LOGE(TAG, "Matter node creation failed");
}
light_endpoint_id = endpoint::get_id(endpoint);
ESP_LOGI(TAG, "Light created with endpoint_id %d", light_endpoint_id);
/* Initialize driver */
+1 -1
View File
@@ -47,7 +47,7 @@ Connect to Wi-Fi network.
Dump the device static configuration
- Facotry reset
- Factory reset
```
> matter device factoryreset
+10 -2
View File
@@ -25,13 +25,21 @@ uint16_t light_endpoint_id = 0;
static void app_event_cb(const ChipDeviceEvent *event, intptr_t arg)
{
if (event->Type == chip::DeviceLayer::DeviceEventType::PublicEventTypes::kInterfaceIpAddressChanged) {
switch (event->Type) {
case chip::DeviceLayer::DeviceEventType::PublicEventTypes::kInterfaceIpAddressChanged:
#if !CHIP_DEVICE_CONFIG_ENABLE_THREAD
chip::app::DnssdServer::Instance().StartServer();
esp_route_hook_init(esp_netif_get_handle_from_ifkey("WIFI_STA_DEF"));
#endif
break;
case chip::DeviceLayer::DeviceEventType::PublicEventTypes::kCommissioningComplete:
ESP_LOGI(TAG, "Commissioning complete");
break;
default:
break;
}
ESP_LOGI(TAG, "Current free heap: %zu", heap_caps_get_free_size(MALLOC_CAP_8BIT));
}
static esp_err_t app_attribute_update_cb(callback_type_t type, uint16_t endpoint_id, uint32_t cluster_id,
+14 -4
View File
@@ -27,11 +27,21 @@ using namespace esp_matter::attribute;
static void app_event_cb(const ChipDeviceEvent *event, intptr_t arg)
{
if (event->Type == chip::DeviceLayer::DeviceEventType::PublicEventTypes::kInterfaceIpAddressChanged) {
switch (event->Type) {
case chip::DeviceLayer::DeviceEventType::PublicEventTypes::kInterfaceIpAddressChanged:
#if !CHIP_DEVICE_CONFIG_ENABLE_THREAD
chip::app::DnssdServer::Instance().StartServer();
esp_route_hook_init(esp_netif_get_handle_from_ifkey("WIFI_STA_DEF"));
#endif
break;
case chip::DeviceLayer::DeviceEventType::PublicEventTypes::kCommissioningComplete:
ESP_LOGI(TAG, "Commissioning complete");
break;
default:
break;
}
ESP_LOGI(TAG, "Current free heap: %zu", heap_caps_get_free_size(MALLOC_CAP_8BIT));
}
static esp_err_t app_attribute_update_cb(callback_type_t type, uint16_t endpoint_id, uint32_t cluster_id,
@@ -52,13 +62,13 @@ extern "C" void app_main()
/* Initialize the ESP NVS layer */
nvs_flash_init();
/* Create matter device */
/* Create a Matter node */
node::config_t node_config;
node_t *node = node::create(&node_config, app_attribute_update_cb, NULL);
/* These node and endpoint handles can be used to create/add other endpoints and clusters. */
if (!node) {
ESP_LOGE(TAG, "Matter device creation failed");
ESP_LOGE(TAG, "Matter node creation failed");
}
/* Matter start */