diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter index d2e33e86376e59..4e7c234a81b6c8 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter @@ -4332,6 +4332,40 @@ provisional cluster EnergyEvse = 153 { timed command ClearTargets(): DefaultSuccess = 7; } +/** This cluster provides an interface to specify preferences for how devices should consume energy. */ +cluster EnergyPreference = 155 { + revision 1; + + enum EnergyPriorityEnum : enum8 { + kComfort = 0; + kSpeed = 1; + kEfficiency = 2; + kWaterConsumption = 3; + } + + bitmap Feature : bitmap32 { + kEnergyBalance = 0x1; + kLowPowerModeSensitivity = 0x2; + } + + struct BalanceStruct { + percent step = 0; + optional char_string<64> label = 1; + } + + readonly attribute optional BalanceStruct energyBalances[] = 0; + attribute optional int8u currentEnergyBalance = 1; + readonly attribute optional EnergyPriorityEnum energyPriorities[] = 2; + readonly attribute optional BalanceStruct lowPowerModeSensitivities[] = 3; + attribute optional int8u currentLowPowerModeSensitivity = 4; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; +} + /** Attributes and commands for selecting a mode from a list of supported options. */ provisional cluster EnergyEvseMode = 157 { revision 1; @@ -8160,6 +8194,20 @@ endpoint 1 { handle command ClearTargets; } + server cluster EnergyPreference { + callback attribute energyBalances; + ram attribute currentEnergyBalance; + callback attribute energyPriorities; + callback attribute lowPowerModeSensitivities; + ram attribute currentLowPowerModeSensitivity; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; + ram attribute featureMap default = 3; + ram attribute clusterRevision default = 1; + } + server cluster EnergyEvseMode { callback attribute supportedModes; callback attribute currentMode; diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap index 7206a9da14d7aa..aa8eb2483c1698 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap @@ -14035,6 +14035,192 @@ } ] }, + { + "name": "Energy Preference", + "code": 155, + "mfgCode": null, + "define": "ENERGY_PREFERENCE_CLUSTER", + "side": "server", + "enabled": 1, + "attributes": [ + { + "name": "EnergyBalances", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "CurrentEnergyBalance", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EnergyPriorities", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "LowPowerModeSensitivities", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "CurrentLowPowerModeSensitivity", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, { "name": "Window Covering", "code": 258, diff --git a/examples/all-clusters-app/all-clusters-common/src/energy-preference-delegate.cpp b/examples/all-clusters-app/all-clusters-common/src/energy-preference-delegate.cpp new file mode 100644 index 00000000000000..4d0a6490533a28 --- /dev/null +++ b/examples/all-clusters-app/all-clusters-common/src/energy-preference-delegate.cpp @@ -0,0 +1,99 @@ +#include + +using namespace chip; +using namespace chip::app::Clusters::EnergyPreference; +using namespace chip::app::Clusters::EnergyPreference::Structs; + +static BalanceStruct::Type gsEnergyBalances[] = { + { .step = 0, .label = Optional("Efficient"_span) }, + { .step = 50, .label = Optional() }, + { .step = 100, .label = Optional("Comfort"_span) }, +}; + +static BalanceStruct::Type gsPowerBalances[] = { + { .step = 0, .label = Optional("1 Minute"_span) }, + { .step = 12, .label = Optional("5 Minutes"_span) }, + { .step = 24, .label = Optional("10 Minutes"_span) }, + { .step = 36, .label = Optional("15 Minutes"_span) }, + { .step = 48, .label = Optional("20 Minutes"_span) }, + { .step = 60, .label = Optional("25 Minutes"_span) }, + { .step = 70, .label = Optional("30 Minutes"_span) }, + { .step = 80, .label = Optional("60 Minutes"_span) }, + { .step = 90, .label = Optional("120 Minutes"_span) }, + { .step = 100, .label = Optional("Never"_span) }, +}; + +// assumes it'll be the only delegate for it's lifetime. +struct EPrefDelegate : public EnergyPreferenceDelegate +{ + EPrefDelegate(); + virtual ~EPrefDelegate(); + + CHIP_ERROR GetEnergyBalanceAtIndex(chip::EndpointId aEndpoint, size_t aIndex, BalanceStruct::Type & balance) override; + CHIP_ERROR GetEnergyPriorityAtIndex(chip::EndpointId aEndpoint, size_t aIndex, EnergyPriorityEnum & priority) override; + CHIP_ERROR GetLowPowerModeSensitivityAtIndex(chip::EndpointId aEndpoint, size_t aIndex, BalanceStruct::Type & balance) override; + + size_t GetNumEnergyBalances(chip::EndpointId aEndpoint) override; + size_t GetNumLowPowerModes(chip::EndpointId aEndpoint) override; +}; + +EPrefDelegate::EPrefDelegate() : EnergyPreferenceDelegate() +{ + VerifyOrDie(GetMatterEnergyPreferencesDelegate() == nullptr); + SetMatterEnergyPreferencesDelegate(this); +} + +EPrefDelegate::~EPrefDelegate() +{ + VerifyOrDie(GetMatterEnergyPreferencesDelegate() == this); + SetMatterEnergyPreferencesDelegate(nullptr); +} + +size_t EPrefDelegate::GetNumEnergyBalances(chip::EndpointId aEndpoint) +{ + return (ArraySize(gsEnergyBalances)); +} + +size_t EPrefDelegate::GetNumLowPowerModes(chip::EndpointId aEndpoint) +{ + return (ArraySize(gsEnergyBalances)); +} + +CHIP_ERROR +EPrefDelegate::GetEnergyBalanceAtIndex(chip::EndpointId aEndpoint, size_t aIndex, BalanceStruct::Type & balance) +{ + if (aIndex < GetNumEnergyBalances(aEndpoint)) + { + balance = gsEnergyBalances[aIndex]; + return CHIP_NO_ERROR; + } + return CHIP_ERROR_NOT_FOUND; +} + +CHIP_ERROR +EPrefDelegate::GetEnergyPriorityAtIndex(chip::EndpointId aEndpoint, size_t aIndex, EnergyPriorityEnum & priority) +{ + static EnergyPriorityEnum priorities[] = { EnergyPriorityEnum::kEfficiency, EnergyPriorityEnum::kComfort }; + + if (aIndex < (sizeof(priorities) / sizeof(priorities[0]))) + { + priority = priorities[aIndex]; + return CHIP_NO_ERROR; + } + + return CHIP_ERROR_NOT_FOUND; +} + +CHIP_ERROR +EPrefDelegate::GetLowPowerModeSensitivityAtIndex(chip::EndpointId aEndpoint, size_t aIndex, BalanceStruct::Type & balance) +{ + if (aIndex < GetNumLowPowerModes(aEndpoint)) + { + balance = gsPowerBalances[aIndex]; + return CHIP_NO_ERROR; + } + + return CHIP_ERROR_NOT_FOUND; +} + +static EPrefDelegate gsDelegate; diff --git a/examples/all-clusters-app/ameba/chip_main.cmake b/examples/all-clusters-app/ameba/chip_main.cmake index 6cc76ad25e7dd8..4f9f5a6d28fe4c 100755 --- a/examples/all-clusters-app/ameba/chip_main.cmake +++ b/examples/all-clusters-app/ameba/chip_main.cmake @@ -158,6 +158,7 @@ list( ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/concentration-measurement-instances.cpp ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/device-energy-management-stub.cpp ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp + ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/energy-preference-delegate.cpp ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/fan-stub.cpp ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/oven-modes.cpp ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/laundry-washer-controls-delegate-impl.cpp diff --git a/examples/all-clusters-app/esp32/main/CMakeLists.txt b/examples/all-clusters-app/esp32/main/CMakeLists.txt index f2f432a60d615a..635851e2460c14 100644 --- a/examples/all-clusters-app/esp32/main/CMakeLists.txt +++ b/examples/all-clusters-app/esp32/main/CMakeLists.txt @@ -95,8 +95,11 @@ set(SRC_DIRS_LIST "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/time-synchronization-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/valve-configuration-and-control-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/dishwasher-alarm-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/laundry-washer-controls-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/laundry-washer-controls-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/laundry-washer-controls-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/laundry-dryer-controls-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/all-clusters-app/all-clusters-common/src" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/energy-preference-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/electrical-energy-measurement-server" ) diff --git a/examples/all-clusters-app/linux/BUILD.gn b/examples/all-clusters-app/linux/BUILD.gn index 960d3aadbc9ed7..6c299ce7e25f45 100644 --- a/examples/all-clusters-app/linux/BUILD.gn +++ b/examples/all-clusters-app/linux/BUILD.gn @@ -30,6 +30,7 @@ source_set("chip-all-clusters-common") { "${chip_root}/examples/all-clusters-app/all-clusters-common/src/dishwasher-alarm-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/dishwasher-mode.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp", + "${chip_root}/examples/all-clusters-app/all-clusters-common/src/energy-preference-delegate.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/fan-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/laundry-dryer-controls-delegate-impl.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/laundry-washer-controls-delegate-impl.cpp", diff --git a/src/app/clusters/energy-preference-server/energy-preference-server.cpp b/src/app/clusters/energy-preference-server/energy-preference-server.cpp new file mode 100644 index 00000000000000..30407ecf53ec3a --- /dev/null +++ b/src/app/clusters/energy-preference-server/energy-preference-server.cpp @@ -0,0 +1,221 @@ +/** + * + * Copyright (c) 2020 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "energy-preference-server.h" + +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip; +using namespace chip::app; +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::EnergyPreference; +using namespace chip::app::Clusters::EnergyPreference::Structs; +using namespace chip::app::Clusters::EnergyPreference::Attributes; + +using imcode = Protocols::InteractionModel::Status; + +namespace { + +class EnergyPrefAttrAccess : public AttributeAccessInterface +{ +public: + EnergyPrefAttrAccess() : AttributeAccessInterface(Optional::Missing(), EnergyPreference::Id) {} + + CHIP_ERROR Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override; + CHIP_ERROR Write(const ConcreteDataAttributePath & aPath, AttributeValueDecoder & aDecoder) override; +}; + +EnergyPrefAttrAccess gEnergyPrefAttrAccess; +EnergyPreferenceDelegate * gsDelegate = nullptr; + +CHIP_ERROR EnergyPrefAttrAccess::Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) +{ + VerifyOrDie(aPath.mClusterId == EnergyPreference::Id); + EndpointId endpoint = aPath.mEndpointId; + uint32_t ourFeatureMap; + bool balanceSupported = (FeatureMap::Get(aPath.mEndpointId, &ourFeatureMap) == EMBER_ZCL_STATUS_SUCCESS) && + ((ourFeatureMap & to_underlying(Feature::kEnergyBalance)) != 0); + bool lowPowerSupported = (ourFeatureMap & to_underlying(Feature::kLowPowerModeSensitivity)) != 0; + + switch (aPath.mAttributeId) + { + case EnergyBalances::Id: + if (!balanceSupported) + { + return aEncoder.EncodeNull(); + } + + if (gsDelegate != nullptr) + { + return aEncoder.EncodeList([endpoint](const auto & encoder) -> CHIP_ERROR { + BalanceStruct::Type balance; + size_t index = 0; + CHIP_ERROR err = CHIP_NO_ERROR; + while ((err = gsDelegate->GetEnergyBalanceAtIndex(endpoint, index, balance)) == CHIP_NO_ERROR) + { + ReturnErrorOnFailure(encoder.Encode(balance)); + index++; + } + if (err == CHIP_ERROR_NOT_FOUND) + { + return CHIP_NO_ERROR; + } + return err; + }); + } + return CHIP_ERROR_INCORRECT_STATE; + case EnergyPriorities::Id: + if (balanceSupported == false) + { + return aEncoder.EncodeNull(); + } + + if (gsDelegate != nullptr) + { + return aEncoder.EncodeList([endpoint](const auto & encoder) -> CHIP_ERROR { + EnergyPriorityEnum priority; + size_t index = 0; + CHIP_ERROR err = CHIP_NO_ERROR; + while ((err = gsDelegate->GetEnergyPriorityAtIndex(endpoint, index, priority)) == CHIP_NO_ERROR) + { + ReturnErrorOnFailure(encoder.Encode(priority)); + index++; + } + if (err == CHIP_ERROR_NOT_FOUND) + { + return CHIP_NO_ERROR; + } + return err; + }); + } + return CHIP_ERROR_INCORRECT_STATE; + case LowPowerModeSensitivities::Id: + if (lowPowerSupported == false) + { + return aEncoder.EncodeNull(); + } + + if (gsDelegate != nullptr) + { + return aEncoder.EncodeList([endpoint](const auto & encoder) -> CHIP_ERROR { + BalanceStruct::Type balance; + size_t index = 0; + CHIP_ERROR err = CHIP_NO_ERROR; + while ((err = gsDelegate->GetLowPowerModeSensitivityAtIndex(endpoint, index, balance)) == CHIP_NO_ERROR) + { + ReturnErrorOnFailure(encoder.Encode(balance)); + index++; + } + if (err == CHIP_ERROR_NOT_FOUND) + { + return CHIP_NO_ERROR; + } + return err; + }); + } + return CHIP_ERROR_INCORRECT_STATE; + default: // return CHIP_NO_ERROR and just read from the attribute store in default + break; + } + + return CHIP_NO_ERROR; +} + +CHIP_ERROR EnergyPrefAttrAccess::Write(const ConcreteDataAttributePath & aPath, AttributeValueDecoder & aDecoder) +{ + VerifyOrDie(aPath.mClusterId == EnergyPreference::Id); + + // return CHIP_NO_ERROR and just write to the attribute store in default + return CHIP_NO_ERROR; +} + +} // anonymous namespace + +void SetMatterEnergyPreferencesDelegate(EnergyPreferenceDelegate * aDelegate) +{ + gsDelegate = aDelegate; +} + +EnergyPreferenceDelegate * GetMatterEnergyPreferencesDelegate() +{ + return gsDelegate; +} + +Protocols::InteractionModel::Status +MatterEnergyPreferenceClusterServerPreAttributeChangedCallback(const app::ConcreteAttributePath & attributePath, + EmberAfAttributeType attributeType, uint16_t size, uint8_t * value) +{ + EndpointId endpoint = attributePath.mEndpointId; + EnergyPreferenceDelegate * delegate = GetMatterEnergyPreferencesDelegate(); + uint32_t ourFeatureMap; + bool balanceSupported = (FeatureMap::Get(attributePath.mEndpointId, &ourFeatureMap) == EMBER_ZCL_STATUS_SUCCESS) && + ((ourFeatureMap & to_underlying(Feature::kEnergyBalance)) != 0); + bool lowPowerSupported = (ourFeatureMap & to_underlying(Feature::kLowPowerModeSensitivity)) != 0; + + if (delegate == nullptr) + return imcode::UnsupportedWrite; + + switch (attributePath.mAttributeId) + { + case CurrentEnergyBalance::Id: { + if (balanceSupported == false) + return imcode::UnsupportedAttribute; + + uint8_t index = chip::Encoding::Get8(value); + size_t arraySize = delegate->GetNumEnergyBalances(endpoint); + if (index >= arraySize) + { + return imcode::InvalidValue; + } + + return imcode::Success; + } + + case CurrentLowPowerModeSensitivity::Id: { + if (lowPowerSupported == false) + return imcode::UnsupportedAttribute; + + uint8_t index = chip::Encoding::Get8(value); + size_t arraySize = delegate->GetNumLowPowerModes(endpoint); + if (index >= arraySize) + { + return imcode::InvalidValue; + } + + return imcode::Success; + } + default: + return imcode::Success; + } +} + +void MatterEnergyPreferencePluginServerInitCallback() +{ + registerAttributeAccessOverride(&gEnergyPrefAttrAccess); +} diff --git a/src/app/clusters/energy-preference-server/energy-preference-server.h b/src/app/clusters/energy-preference-server/energy-preference-server.h new file mode 100644 index 00000000000000..7e93a950a19ec4 --- /dev/null +++ b/src/app/clusters/energy-preference-server/energy-preference-server.h @@ -0,0 +1,44 @@ +/** + * + * Copyright (c) 2021 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#include +#include +#include +#include + +struct EnergyPreferenceDelegate +{ + virtual ~EnergyPreferenceDelegate() {} + + virtual CHIP_ERROR GetEnergyBalanceAtIndex(chip::EndpointId aEndpoint, size_t aIndex, + chip::app::Clusters::EnergyPreference::Structs::BalanceStruct::Type & balance) = 0; + virtual CHIP_ERROR GetEnergyPriorityAtIndex(chip::EndpointId aEndpoint, size_t aIndex, + chip::app::Clusters::EnergyPreference::EnergyPriorityEnum & priority) = 0; + virtual CHIP_ERROR + GetLowPowerModeSensitivityAtIndex(chip::EndpointId aEndpoint, size_t aIndex, + chip::app::Clusters::EnergyPreference::Structs::BalanceStruct::Type & balance) = 0; + + virtual size_t GetNumEnergyBalances(chip::EndpointId aEndpoint) = 0; + virtual size_t GetNumLowPowerModes(chip::EndpointId aEndpoint) = 0; +}; + +void SetMatterEnergyPreferencesDelegate(EnergyPreferenceDelegate * aDelegate); +EnergyPreferenceDelegate * GetMatterEnergyPreferencesDelegate(); diff --git a/src/app/zap-templates/zcl/data-model/chip/energy-preference-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/energy-preference-cluster.xml index f7a45dfd016b05..7a6764bb95a39d 100644 --- a/src/app/zap-templates/zcl/data-model/chip/energy-preference-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/energy-preference-cluster.xml @@ -22,6 +22,7 @@ limitations under the License. true This cluster provides an interface to specify preferences for how devices should consume energy. + EnergyBalances diff --git a/src/app/zap_cluster_list.json b/src/app/zap_cluster_list.json index 44442c18a486a3..79f0c96ffe2a18 100644 --- a/src/app/zap_cluster_list.json +++ b/src/app/zap_cluster_list.json @@ -186,7 +186,7 @@ "ETHERNET_NETWORK_DIAGNOSTICS_CLUSTER": [ "ethernet-network-diagnostics-server" ], - "ENERGY_PREFERENCE_CLUSTER": [""], + "ENERGY_PREFERENCE_CLUSTER": ["energy-preference-server"], "FAN_CONTROL_CLUSTER": ["fan-control-server"], "FAULT_INJECTION_CLUSTER": ["fault-injection-server"], "FIXED_LABEL_CLUSTER": ["fixed-label-server"], diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 326e580d04ec2f..14a2c121c14c44 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -4765,7 +4765,7 @@ provisional cluster EnergyEvse = 153 { /** This cluster provides an interface to specify preferences for how devices should consume energy. */ cluster EnergyPreference = 155 { - revision 1; // NOTE: Default/not specifically set + revision 1; enum EnergyPriorityEnum : enum8 { kComfort = 0;