Skip to content

Commit

Permalink
Changed ClusterRevision of PowerTopology to 2, enabled SerialNumber i…
Browse files Browse the repository at this point in the history
…n BasicInfo. Added Initialization of PowerSource attributes.
  • Loading branch information
jamesharrow committed Feb 27, 2024
1 parent 6f47f06 commit 074ae84
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -1322,7 +1338,7 @@
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "1",
"defaultValue": "2",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,16 @@

#include <EVSEManufacturerImpl.h>
#include <EnergyEvseManager.h>

#include <app/clusters/electrical-energy-measurement-server/EnergyReportingTestEventTriggerHandler.h>
#include <app/clusters/electrical-energy-measurement-server/electrical-energy-measurement-server.h>
#include <app/clusters/energy-evse-server/EnergyEvseTestEventTriggerHandler.h>
#include <app/clusters/power-source-server/power-source-server.h>
#include <app/server/Server.h>

#include <app-common/zap-generated/attributes/Accessors.h>
#include <protocols/interaction_model/StatusCode.h>

using namespace chip;
using namespace chip::app;
using namespace chip::app::DataModel;
Expand All @@ -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()
{
Expand All @@ -48,6 +57,7 @@ CHIP_ERROR EVSEManufacturer::Init()

ReturnErrorOnFailure(InitializePowerMeasurementCluster());

ReturnErrorOnFailure(InitializePowerSourceCluster());
/*
* This is an example implementation for manufacturers to consider
*
Expand Down Expand Up @@ -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<uint32_t>(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>(EndpointId(1)));

return CHIP_NO_ERROR;
}

/**
* @brief Allows a client application to send in power readings into the system
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 074ae84

Please sign in to comment.