diff --git a/docs/_static/supported_services.png b/docs/_static/supported_services.png new file mode 100644 index 000000000..4c7b69213 Binary files /dev/null and b/docs/_static/supported_services.png differ diff --git a/docs/en/developing.rst b/docs/en/developing.rst index c71eff977..7f918ffd1 100644 --- a/docs/en/developing.rst +++ b/docs/en/developing.rst @@ -65,8 +65,8 @@ for it to work. Check the example's "Additional Environment Setup" section for m :maxdepth: 1 Light + Light Switch RainMaker Light - Switch Zap Light ZigBee Bridge @@ -178,8 +178,8 @@ for it to work. Check the example's "Post Commissioning Setup" section for more :maxdepth: 1 Light + Light Switch RainMaker Light - Switch Zap Light 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 diff --git a/docs/en/examples/switch.rst b/docs/en/examples/light_switch.rst similarity index 99% rename from docs/en/examples/switch.rst rename to docs/en/examples/light_switch.rst index 0aec255a9..b32ae78b6 100644 --- a/docs/en/examples/switch.rst +++ b/docs/en/examples/light_switch.rst @@ -1,5 +1,5 @@ -Switch -====== +Light Switch +============ 1. Additional Environment Setup ------------------------------- diff --git a/docs/en/faq.rst b/docs/en/faq.rst index 343f35e12..b3ccb655c 100644 --- a/docs/en/faq.rst +++ b/docs/en/faq.rst @@ -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 `__. Please make sure to +- If you are still facing issues, reproduce it on the default + example and then raise it `here `__. 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 `__. Make sure +- If you are still facing issues, reproduce it on the default + example for the device and then raise it `here `__. 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 `__ 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 `__. Make sure +- If you are still facing issues, reproduce it on the default + example for the device and then raise it `here `__. 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 `__. Make sure +- If you are still facing issues, reproduce it on the default + example for the device and then raise it `here `__. 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 `__. Make sure +- If you are still facing issues, reproduce it on the default + example for the device and then raise it `here `__. 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 `__. Make sure +- If you are still facing issues, reproduce it on the default + example for the device and then raise it `here `__. 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 + Light Switch RainMaker Light - Switch Zap Light ZigBee Bridge diff --git a/docs/en/introduction.rst b/docs/en/introduction.rst index ec5c1d10b..36106aecb 100644 --- a/docs/en/introduction.rst +++ b/docs/en/introduction.rst @@ -51,6 +51,11 @@ Espressif's AIoT cloud platform `ESP RainMaker matter device factoryreset diff --git a/examples/light/main/app_main.cpp b/examples/light/main/app_main.cpp index 48afe37b9..6ad35725d 100644 --- a/examples/light/main/app_main.cpp +++ b/examples/light/main/app_main.cpp @@ -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 */ diff --git a/examples/switch/CMakeLists.txt b/examples/light_switch/CMakeLists.txt similarity index 95% rename from examples/switch/CMakeLists.txt rename to examples/light_switch/CMakeLists.txt index da5743943..a8c929291 100644 --- a/examples/switch/CMakeLists.txt +++ b/examples/light_switch/CMakeLists.txt @@ -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) diff --git a/examples/switch/README.md b/examples/light_switch/README.md similarity index 98% rename from examples/switch/README.md rename to examples/light_switch/README.md index cafc07de7..72bb36ba0 100644 --- a/examples/switch/README.md +++ b/examples/light_switch/README.md @@ -1,4 +1,4 @@ -# Switch Example +# Light Switch Example ## Building and Flashing the Firmware diff --git a/examples/switch/main/CMakeLists.txt b/examples/light_switch/main/CMakeLists.txt similarity index 100% rename from examples/switch/main/CMakeLists.txt rename to examples/light_switch/main/CMakeLists.txt diff --git a/examples/switch/main/app_driver.cpp b/examples/light_switch/main/app_driver.cpp similarity index 100% rename from examples/switch/main/app_driver.cpp rename to examples/light_switch/main/app_driver.cpp diff --git a/examples/switch/main/app_main.cpp b/examples/light_switch/main/app_main.cpp similarity index 86% rename from examples/switch/main/app_main.cpp rename to examples/light_switch/main/app_main.cpp index 96e01aafa..e31c11f42 100644 --- a/examples/switch/main/app_main.cpp +++ b/examples/light_switch/main/app_main.cpp @@ -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 */ diff --git a/examples/switch/main/app_priv.h b/examples/light_switch/main/app_priv.h similarity index 100% rename from examples/switch/main/app_priv.h rename to examples/light_switch/main/app_priv.h diff --git a/examples/switch/main/zap-generated/PluginApplicationCallbacks.h b/examples/light_switch/main/zap-generated/PluginApplicationCallbacks.h similarity index 100% rename from examples/switch/main/zap-generated/PluginApplicationCallbacks.h rename to examples/light_switch/main/zap-generated/PluginApplicationCallbacks.h diff --git a/examples/switch/main/zap-generated/af-gen-event.h b/examples/light_switch/main/zap-generated/af-gen-event.h similarity index 100% rename from examples/switch/main/zap-generated/af-gen-event.h rename to examples/light_switch/main/zap-generated/af-gen-event.h diff --git a/examples/switch/main/zap-generated/empty_file.cpp b/examples/light_switch/main/zap-generated/empty_file.cpp similarity index 100% rename from examples/switch/main/zap-generated/empty_file.cpp rename to examples/light_switch/main/zap-generated/empty_file.cpp diff --git a/examples/switch/main/zap-generated/endpoint_config.h b/examples/light_switch/main/zap-generated/endpoint_config.h similarity index 100% rename from examples/switch/main/zap-generated/endpoint_config.h rename to examples/light_switch/main/zap-generated/endpoint_config.h diff --git a/examples/switch/partitions.csv b/examples/light_switch/partitions.csv similarity index 100% rename from examples/switch/partitions.csv rename to examples/light_switch/partitions.csv diff --git a/examples/switch/partitions_h2.csv b/examples/light_switch/partitions_h2.csv similarity index 100% rename from examples/switch/partitions_h2.csv rename to examples/light_switch/partitions_h2.csv diff --git a/examples/switch/sdkconfig.defaults b/examples/light_switch/sdkconfig.defaults similarity index 100% rename from examples/switch/sdkconfig.defaults rename to examples/light_switch/sdkconfig.defaults diff --git a/examples/switch/sdkconfig.defaults.esp32h2 b/examples/light_switch/sdkconfig.defaults.esp32h2 similarity index 100% rename from examples/switch/sdkconfig.defaults.esp32h2 rename to examples/light_switch/sdkconfig.defaults.esp32h2 diff --git a/examples/switch/sdkconfig.defaults.esp32s2 b/examples/light_switch/sdkconfig.defaults.esp32s2 similarity index 100% rename from examples/switch/sdkconfig.defaults.esp32s2 rename to examples/light_switch/sdkconfig.defaults.esp32s2 diff --git a/examples/rainmaker_light/main/app_main.cpp b/examples/rainmaker_light/main/app_main.cpp index 6d609eae0..76c964c60 100644 --- a/examples/rainmaker_light/main/app_main.cpp +++ b/examples/rainmaker_light/main/app_main.cpp @@ -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 */ diff --git a/examples/zap_light/README.md b/examples/zap_light/README.md index cd638aafa..f9071b204 100644 --- a/examples/zap_light/README.md +++ b/examples/zap_light/README.md @@ -47,7 +47,7 @@ Connect to Wi-Fi network. Dump the device static configuration -- Facotry reset +- Factory reset ``` > matter device factoryreset diff --git a/examples/zap_light/main/app_main.cpp b/examples/zap_light/main/app_main.cpp index b24a18c7f..961d6b07c 100644 --- a/examples/zap_light/main/app_main.cpp +++ b/examples/zap_light/main/app_main.cpp @@ -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, diff --git a/examples/zigbee_bridge/main/app_main.cpp b/examples/zigbee_bridge/main/app_main.cpp index 50e2f6d0f..31d5812b6 100644 --- a/examples/zigbee_bridge/main/app_main.cpp +++ b/examples/zigbee_bridge/main/app_main.cpp @@ -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 */