diff --git a/components/esp_matter/esp_matter_attribute.cpp b/components/esp_matter/esp_matter_attribute.cpp index ac6b726a9..df355c77f 100644 --- a/components/esp_matter/esp_matter_attribute.cpp +++ b/components/esp_matter/esp_matter_attribute.cpp @@ -4217,6 +4217,15 @@ attribute_t *create_active_bat_charge_faults(cluster_t *cluster, uint8_t * value return esp_matter::attribute::create(cluster, PowerSource::Attributes::ActiveBatChargeFaults::Id, ATTRIBUTE_FLAG_NONE, esp_matter_array(value, length, count)); } +attribute_t *create_endpoint_list(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count) +{ + if (count > k_max_endpoint_count) { + ESP_LOGE(TAG, "Could not create attribute, list out of bound"); + return NULL; + } + return esp_matter::attribute::create(cluster, PowerSource::Attributes::EndpointList::Id, ATTRIBUTE_FLAG_NONE, esp_matter_array(value, length, count)); +} + } /* attribute */ } /* power_source */ diff --git a/components/esp_matter/esp_matter_attribute.h b/components/esp_matter/esp_matter_attribute.h index 90b40033f..123eb0d1d 100644 --- a/components/esp_matter/esp_matter_attribute.h +++ b/components/esp_matter/esp_matter_attribute.h @@ -911,6 +911,7 @@ constexpr uint8_t k_max_fault_count = 8; constexpr uint8_t k_max_designation_count = 20; constexpr uint8_t k_max_charge_faults_count = 16; constexpr uint8_t k_max_bat_replacement_description_length = 60; +constexpr uint8_t k_max_endpoint_count = 16; namespace attribute { attribute_t *create_status(cluster_t *cluster, uint8_t value); @@ -944,6 +945,7 @@ attribute_t *create_bat_time_to_full_charge(cluster_t *cluster, nullable value, nullable min, nullable max); attribute_t *create_active_bat_charge_faults(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_endpoint_list(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); } /* attribute */ } /* power_source */ diff --git a/components/esp_matter/esp_matter_cluster.cpp b/components/esp_matter/esp_matter_cluster.cpp index 4bb0ae244..66aa8f23e 100644 --- a/components/esp_matter/esp_matter_cluster.cpp +++ b/components/esp_matter/esp_matter_cluster.cpp @@ -1007,6 +1007,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags, uint32_ attribute::create_status(cluster, config->status); attribute::create_order(cluster, config->order, 0x00, 0xFF); attribute::create_description(cluster, config->description, strlen(config->description)); + attribute::create_endpoint_list(cluster, NULL, 0, 0); } else { ESP_LOGE(TAG, "Config is NULL. Cannot add some attributes."); } @@ -2889,7 +2890,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags, uint32_ } } - + /* Features */ if (features & feature::visual::get_id()) { feature::visual::add(cluster, &(config->visual)); @@ -3728,7 +3729,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags, uint32_ feature::dynamic_power_flow::add(cluster); } } - + return cluster; } } /* power_topology */ @@ -4085,7 +4086,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags, uint32_ (features & feature::forecast_adjustment::get_id()) || (features & feature::constraint_based_adjustment::get_id())) && !(features & feature::power_forecast_reporting::get_id())) { - + feature::state_forecast_reporting::add(cluster); } }