diff --git a/docs/en/developing.rst b/docs/en/developing.rst index e7346ebbe..aefff1dc0 100644 --- a/docs/en/developing.rst +++ b/docs/en/developing.rst @@ -201,7 +201,7 @@ To add the esp_matter component to your project, run: :: - idf.py add-dependency "espressif/esp_matter^0.0.2" + idf.py add-dependency "espressif/esp_matter^1.4.0" An example with esp_matter component is offered: @@ -209,8 +209,9 @@ An example with esp_matter component is offered: .. note:: - To use this component, the version of IDF component management should be 1.4.*. - Use ``compote version`` to show the version. Use ``pip install 'idf-component-manager~=1.4.0'`` to install. + To use this component, the version of IDF component management should be ``1.4.*`` or ``>= 2.0``. + Use ``compote version`` to show the version. Use ``pip install 'idf-component-manager~=1.4.0'`` + or ``pip install 'idf-component-manager~=2.0.0'`` to install. 2.2.3 Building Applications ~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/examples/managed_component_light/README.md b/examples/managed_component_light/README.md index c7f0303fc..142068385 100644 --- a/examples/managed_component_light/README.md +++ b/examples/managed_component_light/README.md @@ -2,7 +2,4 @@ This example creates a Color Temperature Light device using the esp_matter component downloaded from [Espressif Component Registry](https://components.espressif.com/) instead of the extra component in local, so the example can work without setting the esp-matter environment. -// TODO: IDF-9801 -> Note: To prevent the hash problem during building, the version [IDF component management](https://docs.espressif.com/projects/idf-component-manager/en/latest/) should be 1.4.*. Use `compote version` to show the version. Use `pip install 'idf-component-manager~=1.4.0'` to install. - See the [docs](https://docs.espressif.com/projects/esp-matter/en/latest/esp32/developing.html) for more information about building and flashing the firmware. diff --git a/examples/managed_component_light/main/app_driver.cpp b/examples/managed_component_light/main/app_driver.cpp index 777850a78..180c1a2b6 100644 --- a/examples/managed_component_light/main/app_driver.cpp +++ b/examples/managed_component_light/main/app_driver.cpp @@ -14,7 +14,6 @@ #include "bsp/esp-bsp.h" #include -#include "sdkconfig.h" using namespace chip::app::Clusters; using namespace esp_matter; @@ -96,10 +95,7 @@ static void app_driver_button_toggle_cb(void *arg, void *data) uint32_t cluster_id = OnOff::Id; uint32_t attribute_id = OnOff::Attributes::OnOff::Id; - node_t *node = node::get(); - endpoint_t *endpoint = endpoint::get(node, endpoint_id); - cluster_t *cluster = cluster::get(endpoint, cluster_id); - attribute_t *attribute = attribute::get(cluster, attribute_id); + attribute_t *attribute = attribute::get(endpoint_id, cluster_id, attribute_id); esp_matter_attr_val_t val = esp_matter_invalid(NULL); attribute::get_val(attribute, &val); @@ -139,34 +135,28 @@ esp_err_t app_driver_light_set_defaults(uint16_t endpoint_id) esp_err_t err = ESP_OK; void *priv_data = endpoint::get_priv_data(endpoint_id); led_indicator_handle_t handle = (led_indicator_handle_t)priv_data; - node_t *node = node::get(); - endpoint_t *endpoint = endpoint::get(node, endpoint_id); - cluster_t *cluster = NULL; - attribute_t *attribute = NULL; esp_matter_attr_val_t val = esp_matter_invalid(NULL); /* Setting brightness */ - cluster = cluster::get(endpoint, LevelControl::Id); - attribute = attribute::get(cluster, LevelControl::Attributes::CurrentLevel::Id); + attribute_t *attribute = attribute::get(endpoint_id, LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id); attribute::get_val(attribute, &val); err |= app_driver_light_set_brightness(handle, &val); /* Setting color */ - cluster = cluster::get(endpoint, ColorControl::Id); - attribute = attribute::get(cluster, ColorControl::Attributes::ColorMode::Id); + attribute = attribute::get(endpoint_id, ColorControl::Id, ColorControl::Attributes::ColorMode::Id); attribute::get_val(attribute, &val); if (val.val.u8 == (uint8_t)ColorControl::ColorMode::kCurrentHueAndCurrentSaturation) { /* Setting hue */ - attribute = attribute::get(cluster, ColorControl::Attributes::CurrentHue::Id); + attribute = attribute::get(endpoint_id, ColorControl::Id, ColorControl::Attributes::CurrentHue::Id); attribute::get_val(attribute, &val); err |= app_driver_light_set_hue(handle, &val); /* Setting saturation */ - attribute = attribute::get(cluster, ColorControl::Attributes::CurrentSaturation::Id); + attribute = attribute::get(endpoint_id, ColorControl::Id, ColorControl::Attributes::CurrentSaturation::Id); attribute::get_val(attribute, &val); err |= app_driver_light_set_saturation(handle, &val); } else if (val.val.u8 == (uint8_t)ColorControl::ColorMode::kColorTemperature) { /* Setting temperature */ - attribute = attribute::get(cluster, ColorControl::Attributes::ColorTemperatureMireds::Id); + attribute = attribute::get(endpoint_id, ColorControl::Id, ColorControl::Attributes::ColorTemperatureMireds::Id); attribute::get_val(attribute, &val); err |= app_driver_light_set_temperature(handle, &val); } else { @@ -174,8 +164,7 @@ esp_err_t app_driver_light_set_defaults(uint16_t endpoint_id) } /* Setting power */ - cluster = cluster::get(endpoint, OnOff::Id); - attribute = attribute::get(cluster, OnOff::Attributes::OnOff::Id); + attribute = attribute::get(endpoint_id, OnOff::Id, OnOff::Attributes::OnOff::Id); attribute::get_val(attribute, &val); err |= app_driver_light_set_power(handle, &val); diff --git a/examples/managed_component_light/main/app_main.cpp b/examples/managed_component_light/main/app_main.cpp index 1d61acb2b..f119b14fa 100644 --- a/examples/managed_component_light/main/app_main.cpp +++ b/examples/managed_component_light/main/app_main.cpp @@ -166,6 +166,7 @@ extern "C" void app_main() light_config.on_off.on_off = DEFAULT_POWER; light_config.on_off.lighting.start_up_on_off = nullptr; light_config.level_control.current_level = DEFAULT_BRIGHTNESS; + light_config.level_control.on_level = DEFAULT_BRIGHTNESS; light_config.level_control.lighting.start_up_current_level = DEFAULT_BRIGHTNESS; light_config.color_control.color_mode = (uint8_t)ColorControl::ColorMode::kColorTemperature; light_config.color_control.enhanced_color_mode = (uint8_t)ColorControl::ColorMode::kColorTemperature; @@ -179,16 +180,14 @@ extern "C" void app_main() ESP_LOGI(TAG, "Light created with endpoint_id %d", light_endpoint_id); /* Mark deferred persistence for some attributes that might be changed rapidly */ - cluster_t *level_control_cluster = cluster::get(endpoint, LevelControl::Id); - attribute_t *current_level_attribute = attribute::get(level_control_cluster, LevelControl::Attributes::CurrentLevel::Id); + attribute_t *current_level_attribute = attribute::get(light_endpoint_id, LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id); attribute::set_deferred_persistence(current_level_attribute); - cluster_t *color_control_cluster = cluster::get(endpoint, ColorControl::Id); - attribute_t *current_x_attribute = attribute::get(color_control_cluster, ColorControl::Attributes::CurrentX::Id); + attribute_t *current_x_attribute = attribute::get(light_endpoint_id, ColorControl::Id, ColorControl::Attributes::CurrentX::Id); attribute::set_deferred_persistence(current_x_attribute); - attribute_t *current_y_attribute = attribute::get(color_control_cluster, ColorControl::Attributes::CurrentY::Id); + attribute_t *current_y_attribute = attribute::get(light_endpoint_id, ColorControl::Id, ColorControl::Attributes::CurrentY::Id); attribute::set_deferred_persistence(current_y_attribute); - attribute_t *color_temp_attribute = attribute::get(color_control_cluster, ColorControl::Attributes::ColorTemperatureMireds::Id); + attribute_t *color_temp_attribute = attribute::get(light_endpoint_id, ColorControl::Id, ColorControl::Attributes::ColorTemperatureMireds::Id); attribute::set_deferred_persistence(color_temp_attribute); #if CHIP_DEVICE_CONFIG_ENABLE_THREAD diff --git a/examples/managed_component_light/main/idf_component.yml b/examples/managed_component_light/main/idf_component.yml index 3faacf8ff..c1e6c1915 100644 --- a/examples/managed_component_light/main/idf_component.yml +++ b/examples/managed_component_light/main/idf_component.yml @@ -9,12 +9,4 @@ dependencies: espressif/led_strip: version: "^2.0.0" espressif/esp_matter: - version: "^0.0.2" - # This matches the dependency of esp_insights - espressif/esp_diag_data_store: - version: "1.0.1" - require: public - rules: - - if: "idf_version >=5.0" - - if: "target != esp32h2" - + version: "^1.4.0"