From d9ccd7177dd8191c1831b176fb0d0d927198f7a8 Mon Sep 17 00:00:00 2001 From: mahesh Date: Fri, 28 Nov 2025 17:22:44 +0530 Subject: [PATCH 1/3] components/esp_matter: add commodity_tariff cluster in esp_matter --- .../data_model/esp_matter_attribute.cpp | 119 ++++++++++++++++++ .../data_model/esp_matter_attribute.h | 24 ++++ .../esp_matter_attribute_bounds.cpp | 27 ++++ .../data_model/esp_matter_attribute_bounds.h | 4 + .../data_model/esp_matter_cluster.cpp | 80 ++++++++++++ .../data_model/esp_matter_cluster.h | 10 ++ .../data_model/esp_matter_command.cpp | 29 +++++ .../data_model/esp_matter_command.h | 9 ++ .../esp_matter_delegate_callbacks.cpp | 11 ++ .../esp_matter_delegate_callbacks.h | 1 + .../data_model/esp_matter_feature.cpp | 104 +++++++++++++++ .../data_model/esp_matter_feature.h | 42 +++++++ .../private/esp_matter_cluster_revisions.h | 3 + 13 files changed, 463 insertions(+) diff --git a/components/esp_matter/data_model/esp_matter_attribute.cpp b/components/esp_matter/data_model/esp_matter_attribute.cpp index 29f67a199..240db7dce 100644 --- a/components/esp_matter/data_model/esp_matter_attribute.cpp +++ b/components/esp_matter/data_model/esp_matter_attribute.cpp @@ -5088,5 +5088,124 @@ attribute_t *create_current_connections(cluster_t *cluster, uint8_t *value, uint } /* push_av_stream_transport */ +namespace commodity_tariff { +namespace attribute { +attribute_t *create_tariff_info(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, CommodityTariff::Attributes::TariffInfo::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_tariff_unit(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, CommodityTariff::Attributes::TariffUnit::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_enum8(value)); +} + +attribute_t *create_start_date(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, CommodityTariff::Attributes::StartDate::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value)); +} + +attribute_t *create_day_entries(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, CommodityTariff::Attributes::DayEntries::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_day_patterns(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, CommodityTariff::Attributes::DayPatterns::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_calendar_periods(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, CommodityTariff::Attributes::CalendarPeriods::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_individual_days(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, CommodityTariff::Attributes::IndividualDays::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_current_day(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, CommodityTariff::Attributes::CurrentDay::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_next_day(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, CommodityTariff::Attributes::NextDay::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_current_day_entry(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, CommodityTariff::Attributes::CurrentDayEntry::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_current_day_entry_date(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, CommodityTariff::Attributes::CurrentDayEntryDate::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value)); +} + +attribute_t *create_next_day_entry(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, CommodityTariff::Attributes::NextDayEntry::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_next_day_entry_date(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, CommodityTariff::Attributes::NextDayEntryDate::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value)); +} + +attribute_t *create_tariff_components(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, CommodityTariff::Attributes::TariffComponents::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_tariff_periods(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, CommodityTariff::Attributes::TariffPeriods::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_current_tariff_components(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, CommodityTariff::Attributes::CurrentTariffComponents::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_next_tariff_components(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, CommodityTariff::Attributes::NextTariffComponents::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_default_randomization_offset(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, CommodityTariff::Attributes::DefaultRandomizationOffset::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int16(value)); +} + +attribute_t *create_default_randomization_type(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, CommodityTariff::Attributes::DefaultRandomizationType::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_enum8(value)); +} + +} /* attribute */ +} /* commodity_tariff */ + } /* cluster */ } /* esp_matter */ diff --git a/components/esp_matter/data_model/esp_matter_attribute.h b/components/esp_matter/data_model/esp_matter_attribute.h index d7b31d8f7..18f4467fe 100644 --- a/components/esp_matter/data_model/esp_matter_attribute.h +++ b/components/esp_matter/data_model/esp_matter_attribute.h @@ -1324,5 +1324,29 @@ attribute_t *create_current_connections(cluster_t *cluster, uint8_t * value, uin } /* attribute */ } /* push_av_stream_transport */ +namespace commodity_tariff { +namespace attribute { +attribute_t *create_tariff_info(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_tariff_unit(cluster_t *cluster, nullable value); +attribute_t *create_start_date(cluster_t *cluster, nullable value); +attribute_t *create_day_entries(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_day_patterns(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_calendar_periods(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_individual_days(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_current_day(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_next_day(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_current_day_entry(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_current_day_entry_date(cluster_t *cluster, nullable value); +attribute_t *create_next_day_entry(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_next_day_entry_date(cluster_t *cluster, nullable value); +attribute_t *create_tariff_components(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_tariff_periods(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_current_tariff_components(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_next_tariff_components(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_default_randomization_offset(cluster_t *cluster, nullable value); +attribute_t *create_default_randomization_type(cluster_t *cluster, nullable value); +} /* attribute */ +} /* commodity_tariff */ + } /* cluster */ } /* esp_matter */ diff --git a/components/esp_matter/data_model/esp_matter_attribute_bounds.cpp b/components/esp_matter/data_model/esp_matter_attribute_bounds.cpp index f3ca131d2..ef179691e 100644 --- a/components/esp_matter/data_model/esp_matter_attribute_bounds.cpp +++ b/components/esp_matter/data_model/esp_matter_attribute_bounds.cpp @@ -675,5 +675,32 @@ void add_bounds_cb(cluster_t *cluster) } } } /* camera_av_settings_user_level_management */ + +namespace commodity_tariff { + +void add_bounds_cb(cluster_t *cluster) +{ + VerifyOrReturn(cluster != nullptr, ESP_LOGE(TAG, "Cluster is NULL. Add bounds Failed!!")); + attribute_t *current_attribute = esp_matter::attribute::get_first(cluster); + VerifyOrReturn(current_attribute != nullptr, ESP_LOGE(TAG, "Attribute is NULL.")); + while(current_attribute) { + switch(esp_matter::attribute::get_id(current_attribute)) { + case CommodityTariff::Attributes::TariffUnit::Id: { + uint8_t min = 0, max = 1; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_enum8(min), esp_matter_enum8(max)); + break; + } + case CommodityTariff::Attributes::DefaultRandomizationType::Id: { + uint8_t min = 0, max = 4; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_enum8(min), esp_matter_enum8(max)); + break; + } + default: + break; + } + current_attribute = esp_matter::attribute::get_next(current_attribute); + } +} +} /* commodity_tariff */ } /* cluster */ } /* esp_matter */ diff --git a/components/esp_matter/data_model/esp_matter_attribute_bounds.h b/components/esp_matter/data_model/esp_matter_attribute_bounds.h index 215b2b994..318f6453b 100644 --- a/components/esp_matter/data_model/esp_matter_attribute_bounds.h +++ b/components/esp_matter/data_model/esp_matter_attribute_bounds.h @@ -49,5 +49,9 @@ void add_bounds_cb(cluster_t *cluster); namespace camera_av_settings_user_level_management { void add_bounds_cb(cluster_t *cluster); } /* camera_av_settings_user_level_management */ + +namespace commodity_tariff { +void add_bounds_cb(cluster_t *cluster); +} /* commodity_tariff */ } /* cluster */ } /* esp_matter */ diff --git a/components/esp_matter/data_model/esp_matter_cluster.cpp b/components/esp_matter/data_model/esp_matter_cluster.cpp index 782babffa..f504ec7bd 100644 --- a/components/esp_matter/data_model/esp_matter_cluster.cpp +++ b/components/esp_matter/data_model/esp_matter_cluster.cpp @@ -4336,5 +4336,85 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) } /* push_av_stream_transport */ +namespace commodity_tariff { +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, CommodityTariff::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, CommodityTariff::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + if (config && config->delegate != nullptr) { + static const auto delegate_init_cb = CommodityTariffDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterCommodityTariffPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + set_add_bounds_callback(cluster, commodity_tariff::add_bounds_cb); + add_function_list(cluster, function_list, function_flags); + + VerifyOrReturnValue(config != NULL, ABORT_CLUSTER_CREATE(cluster)); + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, config->feature_flags); + attribute::create_tariff_info(cluster, NULL, 0, 0); + attribute::create_tariff_unit(cluster, 0); + attribute::create_start_date(cluster, 0); + attribute::create_day_entries(cluster, NULL, 0, 0); + attribute::create_day_patterns(cluster, NULL, 0, 0); + attribute::create_calendar_periods(cluster, NULL, 0, 0); + attribute::create_individual_days(cluster, NULL, 0, 0); + attribute::create_current_day(cluster, NULL, 0, 0); + attribute::create_next_day(cluster, NULL, 0, 0); + attribute::create_current_day_entry(cluster, NULL, 0, 0); + attribute::create_current_day_entry_date(cluster, 0); + attribute::create_next_day_entry(cluster, NULL, 0, 0); + attribute::create_next_day_entry_date(cluster, 0); + attribute::create_tariff_components(cluster, NULL, 0, 0); + attribute::create_tariff_periods(cluster, NULL, 0, 0); + attribute::create_current_tariff_components(cluster, NULL, 0, 0); + attribute::create_next_tariff_components(cluster, NULL, 0, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + + // check against O.a+ feature conformance + VALIDATE_FEATURES_AT_LEAST_ONE("Pricing,FriendlyCredit,AuxiliaryLoad", + feature::pricing::get_id(), feature::friendly_credit::get_id(), feature::auxiliary_load::get_id()); + if (has(feature::pricing::get_id())) { + VerifyOrReturnValue(feature::pricing::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (has(feature::friendly_credit::get_id())) { + VerifyOrReturnValue(feature::friendly_credit::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (has(feature::auxiliary_load::get_id())) { + VerifyOrReturnValue(feature::auxiliary_load::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (has(feature::power_threshold::get_id())) { + VerifyOrReturnValue(feature::power_threshold::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (has(feature::randomization::get_id())) { + VerifyOrReturnValue(feature::randomization::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + if (has(feature::peak_period::get_id())) { + VerifyOrReturnValue(feature::peak_period::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); + } + + command::create_get_tariff_component(cluster); + command::create_get_tariff_component_response(cluster); + command::create_get_day_entry(cluster); + command::create_get_day_entry_response(cluster); + + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* commodity_tariff */ + } /* cluster */ } /* esp_matter */ diff --git a/components/esp_matter/data_model/esp_matter_cluster.h b/components/esp_matter/data_model/esp_matter_cluster.h index 601599758..04437e6ba 100644 --- a/components/esp_matter/data_model/esp_matter_cluster.h +++ b/components/esp_matter/data_model/esp_matter_cluster.h @@ -1038,5 +1038,15 @@ typedef struct config { cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); } /* push_av_stream_transport */ +namespace commodity_tariff { +typedef struct config { + void *delegate; + uint32_t feature_flags; + config() : delegate(nullptr), feature_flags(0) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* commodity_tariff */ + } /* cluster */ } /* esp_matter */ diff --git a/components/esp_matter/data_model/esp_matter_command.cpp b/components/esp_matter/data_model/esp_matter_command.cpp index 780661b8d..e602ccc3e 100644 --- a/components/esp_matter/data_model/esp_matter_command.cpp +++ b/components/esp_matter/data_model/esp_matter_command.cpp @@ -3146,5 +3146,34 @@ command_t *create_find_transport_response(cluster_t *cluster) } /* command */ } /* push_av_stream_transport */ +namespace commodity_tariff { +namespace command { +command_t *create_get_tariff_component(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, CommodityTariff::Commands::GetTariffComponent::Id, + COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_get_tariff_component_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, CommodityTariff::Commands::GetTariffComponentResponse::Id, + COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_get_day_entry(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, CommodityTariff::Commands::GetDayEntry::Id, + COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_get_day_entry_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, CommodityTariff::Commands::GetDayEntryResponse::Id, + COMMAND_FLAG_GENERATED, NULL); +} + +} /* command */ +} /* commodity_tariff */ + } /* cluster */ } /* esp_matter */ diff --git a/components/esp_matter/data_model/esp_matter_command.h b/components/esp_matter/data_model/esp_matter_command.h index 0141474c6..342b9c196 100644 --- a/components/esp_matter/data_model/esp_matter_command.h +++ b/components/esp_matter/data_model/esp_matter_command.h @@ -591,5 +591,14 @@ command_t *create_find_transport_response(cluster_t *cluster); } /* command */ } /* push_av_stream_transport */ +namespace commodity_tariff { +namespace command { +command_t *create_get_tariff_component(cluster_t *cluster); +command_t *create_get_tariff_component_response(cluster_t *cluster); +command_t *create_get_day_entry(cluster_t *cluster); +command_t *create_get_day_entry_response(cluster_t *cluster); +} /* command */ +} /* commodity_tariff */ + } /* cluster */ } /* esp_matter */ diff --git a/components/esp_matter/data_model/esp_matter_delegate_callbacks.cpp b/components/esp_matter/data_model/esp_matter_delegate_callbacks.cpp index b6e39e108..7fb320a64 100644 --- a/components/esp_matter/data_model/esp_matter_delegate_callbacks.cpp +++ b/components/esp_matter/data_model/esp_matter_delegate_callbacks.cpp @@ -51,6 +51,7 @@ #include #include #include +#include #include using namespace chip::app::Clusters; @@ -584,6 +585,16 @@ void PushAvStreamTransportDelegateInitCB(void *delegate, uint16_t endpoint_id) pushavstreamtransportserverinstance->Init(); } + +void CommodityTariffDelegateInitCB(void *delegate, uint16_t endpoint_id) +{ + VerifyOrReturn(delegate != nullptr); + CommodityTariff::Delegate *commodity_tariff_delegate = static_cast(delegate); + uint32_t feature_map = get_feature_map_value(endpoint_id, CommodityTariff::Id); + CommodityTariff::Instance *commodity_tariff_instance = new CommodityTariff::Instance(endpoint_id, *commodity_tariff_delegate, chip::BitMask(feature_map)); + commodity_tariff_instance->Init(); +} + } // namespace delegate_cb } // namespace cluster } // namespace esp_matter diff --git a/components/esp_matter/data_model/esp_matter_delegate_callbacks.h b/components/esp_matter/data_model/esp_matter_delegate_callbacks.h index b175ed800..1fa2effc2 100644 --- a/components/esp_matter/data_model/esp_matter_delegate_callbacks.h +++ b/components/esp_matter/data_model/esp_matter_delegate_callbacks.h @@ -59,6 +59,7 @@ void ChimeDelegateInitCB(void *delegate, uint16_t endpoint_id); void ClosureControlDelegateInitCB(void *delegate, uint16_t endpoint_id); void ClosureDimensionDelegateInitCB(void *delegate, uint16_t endpoint_id); void PushAvStreamTransportDelegateInitCB(void *delegate, uint16_t endpoint_id); +void CommodityTariffDelegateInitCB(void *delegate, uint16_t endpoint_id); } // namespace delegate_cb } // namespace cluster diff --git a/components/esp_matter/data_model/esp_matter_feature.cpp b/components/esp_matter/data_model/esp_matter_feature.cpp index e7f9d3936..b0152d35f 100644 --- a/components/esp_matter/data_model/esp_matter_feature.cpp +++ b/components/esp_matter/data_model/esp_matter_feature.cpp @@ -4537,5 +4537,109 @@ esp_err_t add(cluster_t *cluster) } /* feature */ } /* push_av_stream_transport */ +namespace commodity_tariff { +namespace feature { +namespace pricing { + +uint32_t get_id() +{ + return static_cast(CommodityTariff::Feature::kPricing); +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Cluster cannot be NULL")); + update_feature_map(cluster, get_id()); + return ESP_OK; +} + +} /* pricing */ + +namespace friendly_credit { + +uint32_t get_id() +{ + return static_cast(CommodityTariff::Feature::kFriendlyCredit); +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Cluster cannot be NULL")); + update_feature_map(cluster, get_id()); + return ESP_OK; +} + +} /* friendly_credit */ + +namespace auxiliary_load { + +uint32_t get_id() +{ + return static_cast(CommodityTariff::Feature::kAuxiliaryLoad); +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Cluster cannot be NULL")); + update_feature_map(cluster, get_id()); + return ESP_OK; +} + +} /* auxiliary_load */ + +namespace peak_period { + +uint32_t get_id() +{ + return static_cast(CommodityTariff::Feature::kPeakPeriod); +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Cluster cannot be NULL")); + update_feature_map(cluster, get_id()); + return ESP_OK; +} + +} /* peak_period */ + +namespace power_threshold { + +uint32_t get_id() +{ + return static_cast(CommodityTariff::Feature::kPowerThreshold); +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Cluster cannot be NULL")); + update_feature_map(cluster, get_id()); + return ESP_OK; +} + +} /* power_threshold */ + +namespace randomization { + +uint32_t get_id() +{ + return static_cast(CommodityTariff::Feature::kRandomization); +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Cluster cannot be NULL")); + update_feature_map(cluster, get_id()); + // Attributes + attribute::create_default_randomization_offset(cluster, 0); + attribute::create_default_randomization_type(cluster, 0); + return ESP_OK; +} + +} /* randomization */ + +} /* feature */ +} /* commodity_tariff */ + } /* cluster */ } /* esp_matter */ diff --git a/components/esp_matter/data_model/esp_matter_feature.h b/components/esp_matter/data_model/esp_matter_feature.h index b9d2962af..71f692c35 100644 --- a/components/esp_matter/data_model/esp_matter_feature.h +++ b/components/esp_matter/data_model/esp_matter_feature.h @@ -2031,5 +2031,47 @@ esp_err_t add(cluster_t *cluster); } /* feature */ } /* push_av_stream_transport */ +namespace commodity_tariff { +namespace feature { + +namespace pricing { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* pricing */ + +namespace friendly_credit { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* friendly_credit */ + +namespace auxiliary_load { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* auxiliary_load */ + +namespace peak_period { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* peak_period */ + +namespace power_threshold { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* power_threshold */ + +namespace randomization { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* randomization */ + +} /* feature */ +} /* commodity_tariff */ + } /* cluster */ } /* esp_matter */ diff --git a/components/esp_matter/data_model/private/esp_matter_cluster_revisions.h b/components/esp_matter/data_model/private/esp_matter_cluster_revisions.h index ede631f17..a29cba322 100644 --- a/components/esp_matter/data_model/private/esp_matter_cluster_revisions.h +++ b/components/esp_matter/data_model/private/esp_matter_cluster_revisions.h @@ -399,6 +399,9 @@ namespace push_av_stream_transport { constexpr uint16_t cluster_revision = 1; } // namespace push_av_stream_transport +namespace commodity_tariff { +constexpr uint16_t cluster_revision = 1; +} // namespace commodity_tariff } // namespace cluster } // namespace esp_matter From 0293116894631eab140a616331cc472b528a1964 Mon Sep 17 00:00:00 2001 From: mahesh Date: Fri, 28 Nov 2025 17:21:27 +0530 Subject: [PATCH 2/3] components/esp_matter: add commodity_price cluster in esp_matter --- .../data_model/esp_matter_attribute.cpp | 29 +++++++++++++++ .../data_model/esp_matter_attribute.h | 9 +++++ .../esp_matter_attribute_bounds.cpp | 21 +++++++++++ .../data_model/esp_matter_attribute_bounds.h | 4 ++ .../data_model/esp_matter_cluster.cpp | 37 +++++++++++++++++++ .../data_model/esp_matter_cluster.h | 9 +++++ .../data_model/esp_matter_command.cpp | 29 +++++++++++++++ .../data_model/esp_matter_command.h | 9 +++++ .../esp_matter_delegate_callbacks.cpp | 11 ++++++ .../esp_matter_delegate_callbacks.h | 1 + .../data_model/esp_matter_event.cpp | 10 +++++ .../esp_matter/data_model/esp_matter_event.h | 6 +++ .../data_model/esp_matter_feature.cpp | 23 ++++++++++++ .../data_model/esp_matter_feature.h | 12 ++++++ .../private/esp_matter_cluster_revisions.h | 4 ++ 15 files changed, 214 insertions(+) diff --git a/components/esp_matter/data_model/esp_matter_attribute.cpp b/components/esp_matter/data_model/esp_matter_attribute.cpp index 240db7dce..c8fd999aa 100644 --- a/components/esp_matter/data_model/esp_matter_attribute.cpp +++ b/components/esp_matter/data_model/esp_matter_attribute.cpp @@ -5207,5 +5207,34 @@ attribute_t *create_default_randomization_type(cluster_t *cluster, nullabledelegate != nullptr) { + static const auto delegate_init_cb = CommodityPriceDelegateInitCB; + set_delegate_and_init_callback(cluster, delegate_init_cb, config->delegate); + } + static const auto plugin_server_init_cb = CALL_ONCE(MatterCommodityPricePluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + set_add_bounds_callback(cluster, commodity_price::add_bounds_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + attribute::create_tariff_unit(cluster, 0); + attribute::create_currency(cluster, NULL, 0, 0); + attribute::create_current_price(cluster, NULL, 0, 0); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* commodity_price */ + } /* cluster */ } /* esp_matter */ diff --git a/components/esp_matter/data_model/esp_matter_cluster.h b/components/esp_matter/data_model/esp_matter_cluster.h index 04437e6ba..b79b0a10d 100644 --- a/components/esp_matter/data_model/esp_matter_cluster.h +++ b/components/esp_matter/data_model/esp_matter_cluster.h @@ -1048,5 +1048,14 @@ typedef struct config { cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); } /* commodity_tariff */ +namespace commodity_price { +typedef struct config { + void *delegate; + config() : delegate(nullptr) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* commodity_price */ + } /* cluster */ } /* esp_matter */ diff --git a/components/esp_matter/data_model/esp_matter_command.cpp b/components/esp_matter/data_model/esp_matter_command.cpp index e602ccc3e..eadc65232 100644 --- a/components/esp_matter/data_model/esp_matter_command.cpp +++ b/components/esp_matter/data_model/esp_matter_command.cpp @@ -3175,5 +3175,34 @@ command_t *create_get_day_entry_response(cluster_t *cluster) } /* command */ } /* commodity_tariff */ +namespace commodity_price { +namespace command { +command_t *create_get_detailed_price_request(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, CommodityPrice::Commands::GetDetailedPriceRequest::Id, + COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_get_detailed_price_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, CommodityPrice::Commands::GetDetailedPriceResponse::Id, + COMMAND_FLAG_GENERATED, NULL); +} + +command_t *create_get_detailed_forecast_request(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, CommodityPrice::Commands::GetDetailedForecastRequest::Id, + COMMAND_FLAG_ACCEPTED, NULL); +} + +command_t *create_get_detailed_forecast_response(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, CommodityPrice::Commands::GetDetailedForecastResponse::Id, + COMMAND_FLAG_GENERATED, NULL); +} + +} /* command */ +} /* commodity_price */ + } /* cluster */ } /* esp_matter */ diff --git a/components/esp_matter/data_model/esp_matter_command.h b/components/esp_matter/data_model/esp_matter_command.h index 342b9c196..56acfce82 100644 --- a/components/esp_matter/data_model/esp_matter_command.h +++ b/components/esp_matter/data_model/esp_matter_command.h @@ -600,5 +600,14 @@ command_t *create_get_day_entry_response(cluster_t *cluster); } /* command */ } /* commodity_tariff */ +namespace commodity_price { +namespace command { +command_t *create_get_detailed_price_request(cluster_t *cluster); +command_t *create_get_detailed_price_response(cluster_t *cluster); +command_t *create_get_detailed_forecast_request(cluster_t *cluster); +command_t *create_get_detailed_forecast_response(cluster_t *cluster); +} /* command */ +} /* commodity_price */ + } /* cluster */ } /* esp_matter */ diff --git a/components/esp_matter/data_model/esp_matter_delegate_callbacks.cpp b/components/esp_matter/data_model/esp_matter_delegate_callbacks.cpp index 7fb320a64..c7da48e93 100644 --- a/components/esp_matter/data_model/esp_matter_delegate_callbacks.cpp +++ b/components/esp_matter/data_model/esp_matter_delegate_callbacks.cpp @@ -52,6 +52,7 @@ #include #include #include +#include #include using namespace chip::app::Clusters; @@ -595,6 +596,16 @@ void CommodityTariffDelegateInitCB(void *delegate, uint16_t endpoint_id) commodity_tariff_instance->Init(); } + +void CommodityPriceDelegateInitCB(void *delegate, uint16_t endpoint_id) +{ + VerifyOrReturn(delegate != nullptr); + CommodityPrice::Delegate *commodity_price_delegate = static_cast(delegate); + uint32_t feature_map = get_feature_map_value(endpoint_id, CommodityPrice::Id); + CommodityPrice::Instance *commodity_price_instance = new CommodityPrice::Instance(endpoint_id, *commodity_price_delegate, chip::BitMask(feature_map)); + commodity_price_instance->Init(); +} + } // namespace delegate_cb } // namespace cluster } // namespace esp_matter diff --git a/components/esp_matter/data_model/esp_matter_delegate_callbacks.h b/components/esp_matter/data_model/esp_matter_delegate_callbacks.h index 1fa2effc2..dba9f5812 100644 --- a/components/esp_matter/data_model/esp_matter_delegate_callbacks.h +++ b/components/esp_matter/data_model/esp_matter_delegate_callbacks.h @@ -60,6 +60,7 @@ void ClosureControlDelegateInitCB(void *delegate, uint16_t endpoint_id); void ClosureDimensionDelegateInitCB(void *delegate, uint16_t endpoint_id); void PushAvStreamTransportDelegateInitCB(void *delegate, uint16_t endpoint_id); void CommodityTariffDelegateInitCB(void *delegate, uint16_t endpoint_id); +void CommodityPriceDelegateInitCB(void *delegate, uint16_t endpoint_id); } // namespace delegate_cb } // namespace cluster diff --git a/components/esp_matter/data_model/esp_matter_event.cpp b/components/esp_matter/data_model/esp_matter_event.cpp index 14d11077e..d4fbddbc6 100644 --- a/components/esp_matter/data_model/esp_matter_event.cpp +++ b/components/esp_matter/data_model/esp_matter_event.cpp @@ -882,5 +882,15 @@ event_t *create_push_transport_end(cluster_t *cluster) } // namespace event } // namespace push_av_stream_transport +namespace commodity_price { +namespace event { +event_t *create_price_change(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, CommodityPrice::Events::PriceChange::Id); +} + +} // namespace event +} // namespace commodity_price + } // namespace cluster } // namespace esp_matter diff --git a/components/esp_matter/data_model/esp_matter_event.h b/components/esp_matter/data_model/esp_matter_event.h index 26da3f6ff..cdf8f513a 100644 --- a/components/esp_matter/data_model/esp_matter_event.h +++ b/components/esp_matter/data_model/esp_matter_event.h @@ -279,5 +279,11 @@ event_t *create_push_transport_end(cluster_t *cluster); } // namespace event } // namespace push_av_stream_transport +namespace commodity_price { +namespace event { +event_t *create_price_change(cluster_t *cluster); +} // namespace event +} // namespace commodity_price + } // namespace cluster } // namespace esp_matter diff --git a/components/esp_matter/data_model/esp_matter_feature.cpp b/components/esp_matter/data_model/esp_matter_feature.cpp index b0152d35f..77c32dcc4 100644 --- a/components/esp_matter/data_model/esp_matter_feature.cpp +++ b/components/esp_matter/data_model/esp_matter_feature.cpp @@ -4641,5 +4641,28 @@ esp_err_t add(cluster_t *cluster) } /* feature */ } /* commodity_tariff */ +namespace commodity_price { +namespace feature { +namespace forecasting { + +uint32_t get_id() +{ + return static_cast(CommodityPrice::Feature::kForecasting); +} + +esp_err_t add(cluster_t *cluster) +{ + VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Cluster cannot be NULL")); + update_feature_map(cluster, get_id()); + // Attributes + attribute::create_price_forecast(cluster, NULL, 0, 0); + return ESP_OK; +} + +} /* forecasting */ + +} /* feature */ +} /* commodity_price */ + } /* cluster */ } /* esp_matter */ diff --git a/components/esp_matter/data_model/esp_matter_feature.h b/components/esp_matter/data_model/esp_matter_feature.h index 71f692c35..f1d693ea1 100644 --- a/components/esp_matter/data_model/esp_matter_feature.h +++ b/components/esp_matter/data_model/esp_matter_feature.h @@ -2073,5 +2073,17 @@ esp_err_t add(cluster_t *cluster); } /* feature */ } /* commodity_tariff */ +namespace commodity_price { +namespace feature { + +namespace forecasting { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); +} /* forecasting */ + +} /* feature */ +} /* commodity_price */ + } /* cluster */ } /* esp_matter */ diff --git a/components/esp_matter/data_model/private/esp_matter_cluster_revisions.h b/components/esp_matter/data_model/private/esp_matter_cluster_revisions.h index a29cba322..5ba506447 100644 --- a/components/esp_matter/data_model/private/esp_matter_cluster_revisions.h +++ b/components/esp_matter/data_model/private/esp_matter_cluster_revisions.h @@ -402,6 +402,10 @@ constexpr uint16_t cluster_revision = 1; namespace commodity_tariff { constexpr uint16_t cluster_revision = 1; } // namespace commodity_tariff + +namespace commodity_price { +constexpr uint16_t cluster_revision = 4; +} // namespace commodity_price } // namespace cluster } // namespace esp_matter From 4ad5cd8945d7ef30fdc3e4fd25063490e860a4f8 Mon Sep 17 00:00:00 2001 From: mahesh Date: Mon, 1 Dec 2025 15:44:29 +0530 Subject: [PATCH 3/3] components/esp_matter: add commodity_metering cluster in esp_matter --- .../data_model/esp_matter_attribute.cpp | 30 ++++++++++++++++ .../data_model/esp_matter_attribute.h | 10 ++++++ .../esp_matter_attribute_bounds.cpp | 27 +++++++++++++++ .../data_model/esp_matter_attribute_bounds.h | 4 +++ .../data_model/esp_matter_cluster.cpp | 34 +++++++++++++++++++ .../data_model/esp_matter_cluster.h | 5 +++ .../private/esp_matter_cluster_revisions.h | 4 +++ 7 files changed, 114 insertions(+) diff --git a/components/esp_matter/data_model/esp_matter_attribute.cpp b/components/esp_matter/data_model/esp_matter_attribute.cpp index c8fd999aa..504ff123a 100644 --- a/components/esp_matter/data_model/esp_matter_attribute.cpp +++ b/components/esp_matter/data_model/esp_matter_attribute.cpp @@ -5236,5 +5236,35 @@ attribute_t *create_price_forecast(cluster_t *cluster, uint8_t *value, uint16_t } /* attribute */ } /* commodity_price */ +namespace commodity_metering { +namespace attribute { +attribute_t *create_metered_quantity(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) +{ + return esp_matter::attribute::create(cluster, CommodityMetering::Attributes::MeteredQuantity::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_array(value, length, count)); +} + +attribute_t *create_metered_quantity_timestamp(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, CommodityMetering::Attributes::MeteredQuantityTimestamp::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value)); +} + +attribute_t *create_tariff_unit(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, CommodityMetering::Attributes::TariffUnit::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_enum8(value)); +} + +attribute_t *create_maximum_metered_quantities(cluster_t *cluster, nullable value) +{ + return esp_matter::attribute::create(cluster, CommodityMetering::Attributes::MaximumMeteredQuantities::Id, + ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value)); +} + +} /* attribute */ + +} /* commodity_metering */ + } /* cluster */ } /* esp_matter */ diff --git a/components/esp_matter/data_model/esp_matter_attribute.h b/components/esp_matter/data_model/esp_matter_attribute.h index 556f47ac9..25536fa56 100644 --- a/components/esp_matter/data_model/esp_matter_attribute.h +++ b/components/esp_matter/data_model/esp_matter_attribute.h @@ -1357,5 +1357,15 @@ attribute_t *create_price_forecast(cluster_t *cluster, uint8_t * value, uint16_t } /* attribute */ } /* commodity_price */ +namespace commodity_metering { +namespace attribute { + +attribute_t *create_metered_quantity(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); +attribute_t *create_metered_quantity_timestamp(cluster_t *cluster, nullable value); +attribute_t *create_tariff_unit(cluster_t *cluster, nullable value); +attribute_t *create_maximum_metered_quantities(cluster_t *cluster, nullable value); +} /* attribute */ +} /* commodity_metering */ + } /* cluster */ } /* esp_matter */ diff --git a/components/esp_matter/data_model/esp_matter_attribute_bounds.cpp b/components/esp_matter/data_model/esp_matter_attribute_bounds.cpp index 83a31f915..ab0589076 100644 --- a/components/esp_matter/data_model/esp_matter_attribute_bounds.cpp +++ b/components/esp_matter/data_model/esp_matter_attribute_bounds.cpp @@ -723,5 +723,32 @@ void add_bounds_cb(cluster_t *cluster) } } } /* commodity_price */ + +namespace commodity_metering { + +void add_bounds_cb(cluster_t *cluster) +{ + VerifyOrReturn(cluster != nullptr, ESP_LOGE(TAG, "Cluster is NULL. Add bounds Failed!!")); + attribute_t *current_attribute = esp_matter::attribute::get_first(cluster); + VerifyOrReturn(current_attribute != nullptr, ESP_LOGE(TAG, "Attribute is NULL.")); + while(current_attribute) { + switch(esp_matter::attribute::get_id(current_attribute)) { + case CommodityMetering::Attributes::MaximumMeteredQuantities::Id: { + uint16_t min = 1, max = UINT16_MAX; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_uint16(min), esp_matter_uint16(max)); + break; + } + case CommodityMetering::Attributes::TariffUnit::Id: { + uint8_t min = 0, max = 1; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_enum8(min), esp_matter_enum8(max)); + break; + } + default: + break; + } + current_attribute = esp_matter::attribute::get_next(current_attribute); + } +} +} /* commodity_metering */ } /* cluster */ } /* esp_matter */ diff --git a/components/esp_matter/data_model/esp_matter_attribute_bounds.h b/components/esp_matter/data_model/esp_matter_attribute_bounds.h index b247acc03..0b845e0cc 100644 --- a/components/esp_matter/data_model/esp_matter_attribute_bounds.h +++ b/components/esp_matter/data_model/esp_matter_attribute_bounds.h @@ -57,5 +57,9 @@ void add_bounds_cb(cluster_t *cluster); namespace commodity_price { void add_bounds_cb(cluster_t *cluster); } /* commodity_price */ + +namespace commodity_metering { +void add_bounds_cb(cluster_t *cluster); +} /* commodity_metering */ } /* cluster */ } /* esp_matter */ diff --git a/components/esp_matter/data_model/esp_matter_cluster.cpp b/components/esp_matter/data_model/esp_matter_cluster.cpp index e281d17ef..c019bcbe3 100644 --- a/components/esp_matter/data_model/esp_matter_cluster.cpp +++ b/components/esp_matter/data_model/esp_matter_cluster.cpp @@ -4453,5 +4453,39 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) } /* commodity_price */ +namespace commodity_metering { +const function_generic_t *function_list = NULL; + +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) +{ + cluster_t *cluster = esp_matter::cluster::create(endpoint, CommodityMetering::Id, flags); + VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, CommodityMetering::Id)); + if (flags & CLUSTER_FLAG_SERVER) { + static const auto plugin_server_init_cb = CALL_ONCE(MatterCommodityMeteringPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + set_add_bounds_callback(cluster, commodity_metering::add_bounds_cb); + add_function_list(cluster, function_list, function_flags); + + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); + attribute::create_metered_quantity(cluster, NULL, 0, 0); + attribute::create_metered_quantity_timestamp(cluster, 0); + attribute::create_tariff_unit(cluster, 0); + attribute::create_maximum_metered_quantities(cluster, 1); + + /* Attributes not managed internally */ + global::attribute::create_cluster_revision(cluster, cluster_revision); + } + + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + return cluster; +} + +} /* commodity_metering */ + } /* cluster */ } /* esp_matter */ diff --git a/components/esp_matter/data_model/esp_matter_cluster.h b/components/esp_matter/data_model/esp_matter_cluster.h index b79b0a10d..ed23517e4 100644 --- a/components/esp_matter/data_model/esp_matter_cluster.h +++ b/components/esp_matter/data_model/esp_matter_cluster.h @@ -1057,5 +1057,10 @@ typedef struct config { cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); } /* commodity_price */ +namespace commodity_metering { +using config_t = common::config_t; +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); +} /* commodity_metering */ + } /* cluster */ } /* esp_matter */ diff --git a/components/esp_matter/data_model/private/esp_matter_cluster_revisions.h b/components/esp_matter/data_model/private/esp_matter_cluster_revisions.h index 5ba506447..de6804a35 100644 --- a/components/esp_matter/data_model/private/esp_matter_cluster_revisions.h +++ b/components/esp_matter/data_model/private/esp_matter_cluster_revisions.h @@ -406,6 +406,10 @@ constexpr uint16_t cluster_revision = 1; namespace commodity_price { constexpr uint16_t cluster_revision = 4; } // namespace commodity_price + +namespace commodity_metering { +constexpr uint16_t cluster_revision = 1; +} // namespace commodity_metering } // namespace cluster } // namespace esp_matter