diff --git a/examples/energy-management-app/energy-management-common/energy-management-app.matter b/examples/energy-management-app/energy-management-common/energy-management-app.matter index 398910a77514fb..ea4e5db21a0b18 100644 --- a/examples/energy-management-app/energy-management-common/energy-management-app.matter +++ b/examples/energy-management-app/energy-management-common/energy-management-app.matter @@ -1981,6 +1981,7 @@ endpoint 0 { callback attribute hardwareVersionString; callback attribute softwareVersion; callback attribute softwareVersionString; + callback attribute serialNumber; callback attribute capabilityMinima; callback attribute specificationVersion; callback attribute maxPathsPerInvoke; @@ -2035,7 +2036,7 @@ endpoint 0 { callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; - ram attribute clusterRevision default = 1; + ram attribute clusterRevision default = 2; } server cluster GeneralCommissioning { diff --git a/examples/energy-management-app/energy-management-common/energy-management-app.zap b/examples/energy-management-app/energy-management-common/energy-management-app.zap index 694b6bfa83b8b6..2f3745ed979e98 100644 --- a/examples/energy-management-app/energy-management-common/energy-management-app.zap +++ b/examples/energy-management-app/energy-management-common/energy-management-app.zap @@ -600,6 +600,22 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "SerialNumber", + "code": 15, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "CapabilityMinima", "code": 19, @@ -1322,7 +1338,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "1", + "defaultValue": "2", "reportable": 1, "minInterval": 1, "maxInterval": 65534, diff --git a/examples/energy-management-app/energy-management-common/include/EVSEManufacturerImpl.h b/examples/energy-management-app/energy-management-common/include/EVSEManufacturerImpl.h index fcae38dcafd2b5..92875a3b781e33 100644 --- a/examples/energy-management-app/energy-management-common/include/EVSEManufacturerImpl.h +++ b/examples/energy-management-app/energy-management-common/include/EVSEManufacturerImpl.h @@ -82,6 +82,11 @@ class EVSEManufacturer */ CHIP_ERROR InitializePowerMeasurementCluster(); + /** + * @brief Allows a client application to initialise the PowerSource cluster + */ + CHIP_ERROR InitializePowerSourceCluster(); + /** * @brief Allows a client application to send in power readings into the system * diff --git a/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp b/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp index cb7a7a44991e16..83abac767844d1 100644 --- a/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp +++ b/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp @@ -18,11 +18,16 @@ #include #include + #include #include #include +#include #include +#include +#include + using namespace chip; using namespace chip::app; using namespace chip::app::DataModel; @@ -31,6 +36,10 @@ using namespace chip::app::Clusters::EnergyEvse; using namespace chip::app::Clusters::ElectricalPowerMeasurement; using namespace chip::app::Clusters::ElectricalEnergyMeasurement; using namespace chip::app::Clusters::ElectricalEnergyMeasurement::Structs; +using namespace chip::app::Clusters::PowerSource; +using namespace chip::app::Clusters::PowerSource::Attributes; + +using Protocols::InteractionModel::Status; CHIP_ERROR EVSEManufacturer::Init() { @@ -48,6 +57,7 @@ CHIP_ERROR EVSEManufacturer::Init() ReturnErrorOnFailure(InitializePowerMeasurementCluster()); + ReturnErrorOnFailure(InitializePowerSourceCluster()); /* * This is an example implementation for manufacturers to consider * @@ -110,6 +120,33 @@ CHIP_ERROR EVSEManufacturer::InitializePowerMeasurementCluster() return CHIP_NO_ERROR; } +/** + * @brief Allows a client application to initialise the PowerSource cluster + */ +CHIP_ERROR EVSEManufacturer::InitializePowerSourceCluster() +{ + Protocols::InteractionModel::Status status; + + status = PowerSource::Attributes::Status::Set(EndpointId(0) /*RootNode*/, PowerSourceStatusEnum::kActive); + VerifyOrReturnError(status == Protocols::InteractionModel::Status::Success, CHIP_ERROR_INTERNAL); + status = + PowerSource::Attributes::FeatureMap::Set(EndpointId(0 /*RootNode*/), static_cast(PowerSource::Feature::kWired)); + VerifyOrReturnError(status == Protocols::InteractionModel::Status::Success, CHIP_ERROR_INTERNAL); + status = PowerSource::Attributes::WiredNominalVoltage::Set(EndpointId(0 /*RootNode*/), 230'000); // 230V in mv + VerifyOrReturnError(status == Protocols::InteractionModel::Status::Success, CHIP_ERROR_INTERNAL); + status = PowerSource::Attributes::WiredMaximumCurrent::Set(EndpointId(0 /*RootNode*/), 32'000); // 32A in mA + VerifyOrReturnError(status == Protocols::InteractionModel::Status::Success, CHIP_ERROR_INTERNAL); + + status = PowerSource::Attributes::WiredCurrentType::Set(EndpointId(0 /*RootNode*/), PowerSource::WiredCurrentTypeEnum::kAc); + VerifyOrReturnError(status == Protocols::InteractionModel::Status::Success, CHIP_ERROR_INTERNAL); + status = PowerSource::Attributes::Description::Set(EndpointId(0 /*RootNode*/), CharSpan::fromCharString("Primary Mains Power")); + VerifyOrReturnError(status == Protocols::InteractionModel::Status::Success, CHIP_ERROR_INTERNAL); + + // TODO set the EndpointList - GetPowerTopologyDelegate()->SetEndpointList(Span(EndpointId(1))); + + return CHIP_NO_ERROR; +} + /** * @brief Allows a client application to send in power readings into the system * diff --git a/examples/energy-management-app/linux/include/CHIPProjectAppConfig.h b/examples/energy-management-app/linux/include/CHIPProjectAppConfig.h index e091fa9cf7c91c..4a42f0a9c04c97 100644 --- a/examples/energy-management-app/linux/include/CHIPProjectAppConfig.h +++ b/examples/energy-management-app/linux/include/CHIPProjectAppConfig.h @@ -45,3 +45,11 @@ #define CHIP_DEVICE_ENABLE_PORT_PARAMS 1 #define CHIP_DEVICE_CONFIG_DEVICE_NAME "Test Energy Management" + +#ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION +#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION 1 +#endif + +#ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING +#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING "1.0" +#endif