QA team requested that all attributes in EPM cluster be turned on in energy-management-app (#32095)
* Fixes: #32089
In all-clusters-app, Set the EPM PowerMode attribute to AC. In energy-management-app turned on all features and attributes for testing. Fixed issue in TC_EPM_2_1.py when valid attribute is returned. Improved type checking for HarmonicCurrents and HarmonicPhases
* Turned on additional attributes in EPM cluster on energy-management-app. Now runs tests without skipping unsupported attributes.
* Turned on additional attributes in EPM cluster on energy-management-app. Now runs tests without skipping unsupported attributes.
* Fixes #31925 - QA team expect HarmonicCurrents and HarmonicPhases to have 1 entry in the list for testing
* Turned off 3 provisional features which fail the TC_DeviceConformance.py test
* Removed EVSE attributes which are provisional in 1.3 (SOC, PNC, V2X)
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 64d3a8f..a499ce0 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
@@ -8301,11 +8301,9 @@
callback attribute supplyState;
callback attribute faultState;
callback attribute chargingEnabledUntil;
- callback attribute dischargingEnabledUntil;
callback attribute circuitCapacity;
callback attribute minimumChargeCurrent;
callback attribute maximumChargeCurrent;
- callback attribute maximumDischargeCurrent;
callback attribute userMaximumChargeCurrent;
callback attribute randomizationDelayWindow;
callback attribute nextChargeStartTime;
@@ -8313,13 +8311,9 @@
callback attribute nextChargeRequiredEnergy;
callback attribute nextChargeTargetSoC;
callback attribute approximateEVEfficiency;
- callback attribute stateOfCharge;
- callback attribute batteryCapacity;
- callback attribute vehicleID;
callback attribute sessionID;
callback attribute sessionDuration;
callback attribute sessionEnergyCharged;
- callback attribute sessionEnergyDischarged;
callback attribute generatedCommandList;
callback attribute acceptedCommandList;
callback attribute eventList;
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 cb3e8ec..f659f44 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
@@ -3097,10 +3097,10 @@
"side": "server",
"type": "bitmap32",
"included": 1,
- "storageOption": "RAM",
+ "storageOption": "External",
"singleton": 0,
"bounded": 0,
- "defaultValue": "0",
+ "defaultValue": null,
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
@@ -3113,10 +3113,10 @@
"side": "server",
"type": "int16u",
"included": 1,
- "storageOption": "RAM",
+ "storageOption": "External",
"singleton": 0,
"bounded": 0,
- "defaultValue": "0x0002",
+ "defaultValue": null,
"reportable": 1,
"minInterval": 0,
"maxInterval": 65344,
@@ -8570,6 +8570,7 @@
"define": "LAUNDRY_DRYER_CONTROLS_CLUSTER",
"side": "server",
"enabled": 1,
+ "apiMaturity": "provisional",
"attributes": [
{
"name": "SupportedDrynessLevels",
@@ -13816,22 +13817,6 @@
"reportableChange": 0
},
{
- "name": "DischargingEnabledUntil",
- "code": 4,
- "mfgCode": null,
- "side": "server",
- "type": "epoch_s",
- "included": 1,
- "storageOption": "External",
- "singleton": 0,
- "bounded": 0,
- "defaultValue": null,
- "reportable": 1,
- "minInterval": 1,
- "maxInterval": 65534,
- "reportableChange": 0
- },
- {
"name": "CircuitCapacity",
"code": 5,
"mfgCode": null,
@@ -13880,22 +13865,6 @@
"reportableChange": 0
},
{
- "name": "MaximumDischargeCurrent",
- "code": 8,
- "mfgCode": null,
- "side": "server",
- "type": "amperage_ma",
- "included": 1,
- "storageOption": "External",
- "singleton": 0,
- "bounded": 0,
- "defaultValue": null,
- "reportable": 1,
- "minInterval": 1,
- "maxInterval": 65534,
- "reportableChange": 0
- },
- {
"name": "UserMaximumChargeCurrent",
"code": 9,
"mfgCode": null,
@@ -14008,54 +13977,6 @@
"reportableChange": 0
},
{
- "name": "StateOfCharge",
- "code": 48,
- "mfgCode": null,
- "side": "server",
- "type": "percent",
- "included": 1,
- "storageOption": "External",
- "singleton": 0,
- "bounded": 0,
- "defaultValue": null,
- "reportable": 1,
- "minInterval": 1,
- "maxInterval": 65534,
- "reportableChange": 0
- },
- {
- "name": "BatteryCapacity",
- "code": 49,
- "mfgCode": null,
- "side": "server",
- "type": "energy_mwh",
- "included": 1,
- "storageOption": "External",
- "singleton": 0,
- "bounded": 0,
- "defaultValue": null,
- "reportable": 1,
- "minInterval": 1,
- "maxInterval": 65534,
- "reportableChange": 0
- },
- {
- "name": "VehicleID",
- "code": 50,
- "mfgCode": null,
- "side": "server",
- "type": "char_string",
- "included": 1,
- "storageOption": "External",
- "singleton": 0,
- "bounded": 0,
- "defaultValue": null,
- "reportable": 1,
- "minInterval": 1,
- "maxInterval": 65534,
- "reportableChange": 0
- },
- {
"name": "SessionID",
"code": 64,
"mfgCode": null,
@@ -14104,22 +14025,6 @@
"reportableChange": 0
},
{
- "name": "SessionEnergyDischarged",
- "code": 67,
- "mfgCode": null,
- "side": "server",
- "type": "energy_mwh",
- "included": 1,
- "storageOption": "External",
- "singleton": 0,
- "bounded": 0,
- "defaultValue": null,
- "reportable": 1,
- "minInterval": 1,
- "maxInterval": 65534,
- "reportableChange": 0
- },
- {
"name": "GeneratedCommandList",
"code": 65528,
"mfgCode": null,
diff --git a/examples/all-clusters-app/all-clusters-common/src/electrical-power-measurement-stub.cpp b/examples/all-clusters-app/all-clusters-common/src/electrical-power-measurement-stub.cpp
index 4bcea0e..2a4c422 100644
--- a/examples/all-clusters-app/all-clusters-common/src/electrical-power-measurement-stub.cpp
+++ b/examples/all-clusters-app/all-clusters-common/src/electrical-power-measurement-stub.cpp
@@ -47,5 +47,7 @@
OptionalAttributes::kOptionalAttributeNeutralCurrent));
gEPMInstance->Init();
+
+ gEPMDelegate->SetPowerMode(PowerModeEnum::kAc);
}
}
diff --git a/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp b/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp
index f9983d4..72fe588 100644
--- a/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp
+++ b/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp
@@ -35,9 +35,7 @@
{
gInstance = std::make_unique<EnergyEvseManager>(
endpointId, *gDelegate,
- BitMask<EnergyEvse::Feature, uint32_t>(EnergyEvse::Feature::kChargingPreferences, EnergyEvse::Feature::kPlugAndCharge,
- EnergyEvse::Feature::kRfid, EnergyEvse::Feature::kSoCReporting,
- EnergyEvse::Feature::kV2x),
+ BitMask<EnergyEvse::Feature, uint32_t>(EnergyEvse::Feature::kChargingPreferences, EnergyEvse::Feature::kRfid),
BitMask<OptionalAttributes, uint32_t>(OptionalAttributes::kSupportsUserMaximumChargingCurrent,
OptionalAttributes::kSupportsRandomizationWindow,
OptionalAttributes::kSupportsApproximateEvEfficiency),
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 1ab71d2..c56280b 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
@@ -1896,7 +1896,19 @@
callback attribute ranges;
callback attribute voltage;
callback attribute activeCurrent;
+ callback attribute reactiveCurrent;
+ callback attribute apparentCurrent;
callback attribute activePower;
+ callback attribute reactivePower;
+ callback attribute apparentPower;
+ callback attribute RMSVoltage;
+ callback attribute RMSCurrent;
+ callback attribute RMSPower;
+ callback attribute frequency;
+ callback attribute harmonicCurrents;
+ callback attribute harmonicPhases;
+ callback attribute powerFactor;
+ callback attribute neutralCurrent;
callback attribute generatedCommandList;
callback attribute acceptedCommandList;
callback attribute eventList;
@@ -1963,11 +1975,9 @@
callback attribute supplyState;
callback attribute faultState;
callback attribute chargingEnabledUntil;
- callback attribute dischargingEnabledUntil;
callback attribute circuitCapacity;
callback attribute minimumChargeCurrent;
callback attribute maximumChargeCurrent;
- callback attribute maximumDischargeCurrent;
callback attribute userMaximumChargeCurrent;
callback attribute randomizationDelayWindow;
callback attribute nextChargeStartTime;
@@ -1975,13 +1985,9 @@
callback attribute nextChargeRequiredEnergy;
callback attribute nextChargeTargetSoC;
callback attribute approximateEVEfficiency;
- callback attribute stateOfCharge;
- callback attribute batteryCapacity;
- callback attribute vehicleID;
callback attribute sessionID;
callback attribute sessionDuration;
callback attribute sessionEnergyCharged;
- callback attribute sessionEnergyDischarged;
callback attribute generatedCommandList;
callback attribute acceptedCommandList;
callback attribute eventList;
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 ba1fa29..d795b4f 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
@@ -2860,7 +2860,7 @@
"storageOption": "External",
"singleton": 0,
"bounded": 0,
- "defaultValue": "",
+ "defaultValue": null,
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
@@ -2899,6 +2899,38 @@
"reportableChange": 0
},
{
+ "name": "ReactiveCurrent",
+ "code": 6,
+ "mfgCode": null,
+ "side": "server",
+ "type": "amperage_ma",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": null,
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "ApparentCurrent",
+ "code": 7,
+ "mfgCode": null,
+ "side": "server",
+ "type": "amperage_ma",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": null,
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
"name": "ActivePower",
"code": 8,
"mfgCode": null,
@@ -2915,6 +2947,166 @@
"reportableChange": 0
},
{
+ "name": "ReactivePower",
+ "code": 9,
+ "mfgCode": null,
+ "side": "server",
+ "type": "power_mw",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": null,
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "ApparentPower",
+ "code": 10,
+ "mfgCode": null,
+ "side": "server",
+ "type": "power_mw",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": null,
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "RMSVoltage",
+ "code": 11,
+ "mfgCode": null,
+ "side": "server",
+ "type": "voltage_mv",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": null,
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "RMSCurrent",
+ "code": 12,
+ "mfgCode": null,
+ "side": "server",
+ "type": "amperage_ma",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": null,
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "RMSPower",
+ "code": 13,
+ "mfgCode": null,
+ "side": "server",
+ "type": "power_mw",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": null,
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "Frequency",
+ "code": 14,
+ "mfgCode": null,
+ "side": "server",
+ "type": "int64s",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": null,
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "HarmonicCurrents",
+ "code": 15,
+ "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": "HarmonicPhases",
+ "code": 16,
+ "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": "PowerFactor",
+ "code": 17,
+ "mfgCode": null,
+ "side": "server",
+ "type": "int64s",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": null,
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "NeutralCurrent",
+ "code": 18,
+ "mfgCode": null,
+ "side": "server",
+ "type": "amperage_ma",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": null,
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
"name": "GeneratedCommandList",
"code": 65528,
"mfgCode": null,
@@ -3702,22 +3894,6 @@
"reportableChange": 0
},
{
- "name": "DischargingEnabledUntil",
- "code": 4,
- "mfgCode": null,
- "side": "server",
- "type": "epoch_s",
- "included": 1,
- "storageOption": "External",
- "singleton": 0,
- "bounded": 0,
- "defaultValue": null,
- "reportable": 1,
- "minInterval": 1,
- "maxInterval": 65534,
- "reportableChange": 0
- },
- {
"name": "CircuitCapacity",
"code": 5,
"mfgCode": null,
@@ -3766,22 +3942,6 @@
"reportableChange": 0
},
{
- "name": "MaximumDischargeCurrent",
- "code": 8,
- "mfgCode": null,
- "side": "server",
- "type": "amperage_ma",
- "included": 1,
- "storageOption": "External",
- "singleton": 0,
- "bounded": 0,
- "defaultValue": null,
- "reportable": 1,
- "minInterval": 1,
- "maxInterval": 65534,
- "reportableChange": 0
- },
- {
"name": "UserMaximumChargeCurrent",
"code": 9,
"mfgCode": null,
@@ -3894,54 +4054,6 @@
"reportableChange": 0
},
{
- "name": "StateOfCharge",
- "code": 48,
- "mfgCode": null,
- "side": "server",
- "type": "percent",
- "included": 1,
- "storageOption": "External",
- "singleton": 0,
- "bounded": 0,
- "defaultValue": null,
- "reportable": 1,
- "minInterval": 1,
- "maxInterval": 65534,
- "reportableChange": 0
- },
- {
- "name": "BatteryCapacity",
- "code": 49,
- "mfgCode": null,
- "side": "server",
- "type": "energy_mwh",
- "included": 1,
- "storageOption": "External",
- "singleton": 0,
- "bounded": 0,
- "defaultValue": null,
- "reportable": 1,
- "minInterval": 1,
- "maxInterval": 65534,
- "reportableChange": 0
- },
- {
- "name": "VehicleID",
- "code": 50,
- "mfgCode": null,
- "side": "server",
- "type": "char_string",
- "included": 1,
- "storageOption": "External",
- "singleton": 0,
- "bounded": 0,
- "defaultValue": null,
- "reportable": 1,
- "minInterval": 1,
- "maxInterval": 65534,
- "reportableChange": 0
- },
- {
"name": "SessionID",
"code": 64,
"mfgCode": null,
@@ -3990,22 +4102,6 @@
"reportableChange": 0
},
{
- "name": "SessionEnergyDischarged",
- "code": 67,
- "mfgCode": null,
- "side": "server",
- "type": "energy_mwh",
- "included": 1,
- "storageOption": "External",
- "singleton": 0,
- "bounded": 0,
- "defaultValue": null,
- "reportable": 1,
- "minInterval": 1,
- "maxInterval": 65534,
- "reportableChange": 0
- },
- {
"name": "GeneratedCommandList",
"code": 65528,
"mfgCode": null,
diff --git a/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp b/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp
index fe712d9..fdda913 100644
--- a/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp
+++ b/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp
@@ -246,12 +246,17 @@
return CHIP_NO_ERROR;
}
+static const Structs::HarmonicMeasurementStruct::Type kHarmonicCurrentMeasurements[] = {
+ { .order = 1, .measurement = MakeNullable(static_cast<int64_t>(100000)) }
+};
+
/* @brief This function is called by the cluster server at the start of read cycle
* This could take a semaphore to stop a background update of the data
*/
-CHIP_ERROR ElectricalPowerMeasurementDelegate::StartHarmonicCurrentsRead()
+CHIP_ERROR
+ElectricalPowerMeasurementDelegate::StartHarmonicCurrentsRead()
{
- /* Since we don't an implementation here we don't need to do anything here */
+ /* Since we have a static array we don't need to do anything here */
return CHIP_NO_ERROR;
}
CHIP_ERROR
@@ -269,34 +274,34 @@
* MatterReportingAttributeChangeCallback(mEndpointId, ElectricalPowerMeasurement::Id, HarmonicCurrents::Id);
*/
- /* if (rangeIndex >= ArraySize(mHarmonicCurrentMeasurements))
- * {
- * return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
- * }
- *
- * range = mHarmonicCurrentMeasurements[rangeIndex];
- *
- * return CHIP_NO_ERROR;
- */
+ /* Added to support testing using a static array for now */
+ if (harmonicCurrentsIndex >= ArraySize(kHarmonicCurrentMeasurements))
+ {
+ return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
+ }
- /* Return an empty list for now */
- return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
+ harmonicCurrent = kHarmonicCurrentMeasurements[harmonicCurrentsIndex];
+ return CHIP_NO_ERROR;
}
/* @brief This function is called by the cluster server at the end of read cycle
* This could release a semaphore to allow a background update of the data
*/
CHIP_ERROR ElectricalPowerMeasurementDelegate::EndHarmonicCurrentsRead()
{
- /* Since we don't an implementation here we don't need to do anything here */
+ /* Since we have a static array we don't need to do anything here */
return CHIP_NO_ERROR;
}
+static const Structs::HarmonicMeasurementStruct::Type kHarmonicPhaseMeasurements[] = {
+ { .order = 1, .measurement = MakeNullable(static_cast<int64_t>(100000)) }
+};
+
/* @brief This function is called by the cluster server at the start of read cycle
* This could take a semaphore to stop a background update of the data
*/
CHIP_ERROR ElectricalPowerMeasurementDelegate::StartHarmonicPhasesRead()
{
- /* Since we don't an implementation here we don't need to do anything here */
+ /* Since we have a static array we don't need to do anything here */
return CHIP_NO_ERROR;
}
@@ -314,25 +319,21 @@
* MatterReportingAttributeChangeCallback(mEndpointId, ElectricalPowerMeasurement::Id, HarmonicPhases::Id);
*/
- /* if (rangeIndex >= ArraySize(mHarmonicPhaseMeasurements))
- * {
- * return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
- * }
- *
- * range = mHarmonicPhaseMeasurements[rangeIndex];
- *
- * return CHIP_NO_ERROR;
- */
+ /* Added to support testing using a static array for now */
+ if (harmonicPhaseIndex >= ArraySize(kHarmonicPhaseMeasurements))
+ {
+ return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
+ }
- /* Return an empty list for now */
- return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
+ harmonicPhase = kHarmonicPhaseMeasurements[harmonicPhaseIndex];
+ return CHIP_NO_ERROR;
}
/* @brief This function is called by the cluster server at the end of read cycle
* This could release a semaphore to allow a background update of the data
*/
CHIP_ERROR ElectricalPowerMeasurementDelegate::EndHarmonicPhasesRead()
{
- /* Since we don't an implementation here we don't need to do anything here */
+ /* Since we have a static array we don't need to do anything here */
return CHIP_NO_ERROR;
}
diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseMain.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseMain.cpp
index 92593ef..9beff80 100644
--- a/examples/energy-management-app/energy-management-common/src/EnergyEvseMain.cpp
+++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseMain.cpp
@@ -152,9 +152,7 @@
/* Manufacturer may optionally not support all features, commands & attributes */
gEvseInstance = std::make_unique<EnergyEvseManager>(
EndpointId(ENERGY_EVSE_ENDPOINT), *gEvseDelegate,
- BitMask<EnergyEvse::Feature, uint32_t>(EnergyEvse::Feature::kChargingPreferences, EnergyEvse::Feature::kPlugAndCharge,
- EnergyEvse::Feature::kRfid, EnergyEvse::Feature::kSoCReporting,
- EnergyEvse::Feature::kV2x),
+ BitMask<EnergyEvse::Feature, uint32_t>(EnergyEvse::Feature::kChargingPreferences, EnergyEvse::Feature::kRfid),
BitMask<EnergyEvse::OptionalAttributes, uint32_t>(EnergyEvse::OptionalAttributes::kSupportsUserMaximumChargingCurrent,
EnergyEvse::OptionalAttributes::kSupportsRandomizationWindow,
EnergyEvse::OptionalAttributes::kSupportsApproximateEvEfficiency),
@@ -224,13 +222,27 @@
}
/* Manufacturer may optionally not support all features, commands & attributes */
+ /* Turning on all optional features and attributes for test certification purposes */
gEPMInstance = std::make_unique<ElectricalPowerMeasurementInstance>(
EndpointId(ENERGY_EVSE_ENDPOINT), *gEPMDelegate,
- BitMask<ElectricalPowerMeasurement::Feature, uint32_t>(ElectricalPowerMeasurement::Feature::kAlternatingCurrent),
+ BitMask<ElectricalPowerMeasurement::Feature, uint32_t>(
+ ElectricalPowerMeasurement::Feature::kDirectCurrent, ElectricalPowerMeasurement::Feature::kAlternatingCurrent,
+ ElectricalPowerMeasurement::Feature::kPolyphasePower, ElectricalPowerMeasurement::Feature::kHarmonics,
+ ElectricalPowerMeasurement::Feature::kPowerQuality),
BitMask<ElectricalPowerMeasurement::OptionalAttributes, uint32_t>(
ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeRanges,
ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeVoltage,
- ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeActiveCurrent));
+ ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeActiveCurrent,
+ ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeReactiveCurrent,
+ ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeApparentCurrent,
+ ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeReactivePower,
+ ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeApparentPower,
+ ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeRMSVoltage,
+ ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeRMSCurrent,
+ ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeRMSPower,
+ ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeFrequency,
+ ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributePowerFactor,
+ ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeNeutralCurrent));
if (!gEPMInstance)
{
diff --git a/src/python_testing/TC_EPM_2_1.py b/src/python_testing/TC_EPM_2_1.py
index fc4347e..8be1620 100644
--- a/src/python_testing/TC_EPM_2_1.py
+++ b/src/python_testing/TC_EPM_2_1.py
@@ -23,6 +23,9 @@
logger = logging.getLogger(__name__)
+MIN_INT64_ALLOWED = -pow(2, 62) # -(2^62)
+MAX_INT64_ALLOWED = pow(2, 62) # (2^62)
+
class TC_EPM_2_1(MatterBaseTest, EnergyReportingBaseTestHelper):
@@ -133,52 +136,52 @@
self.step("6")
if self.pics_guard(Clusters.ElectricalPowerMeasurement.Attributes.Voltage.attribute_id in supported_attributes):
- voltage = await self.check_epm_attribute_in_range("Voltage", -2 ^ 62, 2 ^ 62, allow_null=True)
+ voltage = await self.check_epm_attribute_in_range("Voltage", MIN_INT64_ALLOWED, MAX_INT64_ALLOWED, allow_null=True)
logger.info(f"Rx'd Voltage: {voltage}")
self.step("7")
if self.pics_guard(Clusters.ElectricalPowerMeasurement.Attributes.ActiveCurrent.attribute_id in supported_attributes):
- active_current = await self.check_epm_attribute_in_range("ActiveCurrent", -2 ^ 62, 2 ^ 62, allow_null=True)
+ active_current = await self.check_epm_attribute_in_range("ActiveCurrent", MIN_INT64_ALLOWED, MAX_INT64_ALLOWED, allow_null=True)
logger.info(f"Rx'd ActiveCurrent: {active_current}")
self.step("8")
if self.pics_guard(Clusters.ElectricalPowerMeasurement.Attributes.ReactiveCurrent.attribute_id in supported_attributes):
- reactive_current = await self.check_epm_attribute_in_range("ReactiveCurrent", -2 ^ 62, 2 ^ 62, allow_null=True)
+ reactive_current = await self.check_epm_attribute_in_range("ReactiveCurrent", MIN_INT64_ALLOWED, MAX_INT64_ALLOWED, allow_null=True)
logger.info(f"Rx'd ReactiveCurrent: {reactive_current}")
self.step("9")
if self.pics_guard(Clusters.ElectricalPowerMeasurement.Attributes.ApparentCurrent.attribute_id in supported_attributes):
- apparent_current = await self.check_epm_attribute_in_range("ApparentCurrent", 0, 2 ^ 62, allow_null=True)
+ apparent_current = await self.check_epm_attribute_in_range("ApparentCurrent", 0, MAX_INT64_ALLOWED, allow_null=True)
logger.info(f"Rx'd ApparentCurrent: {apparent_current}")
self.step("10")
if self.pics_guard(Clusters.ElectricalPowerMeasurement.Attributes.ActivePower.attribute_id in supported_attributes):
- active_power = await self.check_epm_attribute_in_range("ActivePower", -2 ^ 62, 2 ^ 62, allow_null=True)
+ active_power = await self.check_epm_attribute_in_range("ActivePower", MIN_INT64_ALLOWED, MAX_INT64_ALLOWED, allow_null=True)
logger.info(f"Rx'd ActivePower: {active_power}")
self.step("11")
if self.pics_guard(Clusters.ElectricalPowerMeasurement.Attributes.ReactivePower.attribute_id in supported_attributes):
- reactive_power = await self.check_epm_attribute_in_range("ReactivePower", -2 ^ 62, 2 ^ 62, allow_null=True)
+ reactive_power = await self.check_epm_attribute_in_range("ReactivePower", MIN_INT64_ALLOWED, MAX_INT64_ALLOWED, allow_null=True)
logger.info(f"Rx'd ReactivePower: {reactive_power}")
self.step("12")
if self.pics_guard(Clusters.ElectricalPowerMeasurement.Attributes.ApparentPower.attribute_id in supported_attributes):
- apparent_power = await self.check_epm_attribute_in_range("ApparentPower", -2 ^ 62, 2 ^ 62, allow_null=True)
+ apparent_power = await self.check_epm_attribute_in_range("ApparentPower", MIN_INT64_ALLOWED, MAX_INT64_ALLOWED, allow_null=True)
logger.info(f"Rx'd ApparentPower: {apparent_power}")
self.step("13")
if self.pics_guard(Clusters.ElectricalPowerMeasurement.Attributes.RMSVoltage.attribute_id in supported_attributes):
- rms_voltage = await self.check_epm_attribute_in_range("RMSVoltage", -2 ^ 62, 2 ^ 62, allow_null=True)
+ rms_voltage = await self.check_epm_attribute_in_range("RMSVoltage", MIN_INT64_ALLOWED, MAX_INT64_ALLOWED, allow_null=True)
logger.info(f"Rx'd RMSVoltage: {rms_voltage}")
self.step("14")
if self.pics_guard(Clusters.ElectricalPowerMeasurement.Attributes.RMSCurrent.attribute_id in supported_attributes):
- rms_current = await self.check_epm_attribute_in_range("RMSCurrent", -2 ^ 62, 2 ^ 62, allow_null=True)
+ rms_current = await self.check_epm_attribute_in_range("RMSCurrent", MIN_INT64_ALLOWED, MAX_INT64_ALLOWED, allow_null=True)
logger.info(f"Rx'd RMSCurrent: {rms_current}")
self.step("15")
if self.pics_guard(Clusters.ElectricalPowerMeasurement.Attributes.RMSPower.attribute_id in supported_attributes):
- rms_power = await self.check_epm_attribute_in_range("RMSPower", -2 ^ 62, 2 ^ 62, allow_null=True)
+ rms_power = await self.check_epm_attribute_in_range("RMSPower", MIN_INT64_ALLOWED, MAX_INT64_ALLOWED, allow_null=True)
logger.info(f"Rx'd RMSPower: {rms_power}")
self.step("16")
@@ -188,13 +191,23 @@
self.step("17")
if self.pics_guard(Clusters.ElectricalPowerMeasurement.Attributes.HarmonicCurrents.attribute_id in supported_attributes):
- harmonic_currents = await self.read_epm_attribute_expect_success("HarmonicCurrents", allow_null=True)
+ harmonic_currents = await self.read_epm_attribute_expect_success("HarmonicCurrents")
logger.info(f"Rx'd HarmonicCurrents: {harmonic_currents}")
+ asserts.assert_is(type(harmonic_currents), list)
+ for index, entry in enumerate(harmonic_currents):
+ logging.info(f" [{index}] order:{entry.order} measurement:{entry.measurement}")
+ asserts.assert_greater_equal(entry.order, 1)
+ self.check_value_in_range("Measurement", entry.measurement, MIN_INT64_ALLOWED, MAX_INT64_ALLOWED)
self.step("18")
if self.pics_guard(Clusters.ElectricalPowerMeasurement.Attributes.HarmonicPhases.attribute_id in supported_attributes):
- harmonic_phases = await self.read_epm_attribute_expect_success("HarmonicPhases", allow_null=True)
+ harmonic_phases = await self.read_epm_attribute_expect_success("HarmonicPhases")
logger.info(f"Rx'd HarmonicPhases: {harmonic_phases}")
+ asserts.assert_is(type(harmonic_phases), list)
+ for index, entry in enumerate(harmonic_phases):
+ logging.info(f" [{index}] order:{entry.order} measurement:{entry.measurement}")
+ asserts.assert_greater_equal(entry.order, 1)
+ self.check_value_in_range("Measurement", entry.measurement, MIN_INT64_ALLOWED, MAX_INT64_ALLOWED)
self.step("19")
if self.pics_guard(Clusters.ElectricalPowerMeasurement.Attributes.PowerFactor.attribute_id in supported_attributes):
@@ -203,7 +216,7 @@
self.step("20")
if self.pics_guard(Clusters.ElectricalPowerMeasurement.Attributes.NeutralCurrent.attribute_id in supported_attributes):
- neutral_current = await self.check_epm_attribute_in_range("NeutralCurrent", -2 ^ 62, 2 ^ 62, allow_null=True)
+ neutral_current = await self.check_epm_attribute_in_range("NeutralCurrent", MIN_INT64_ALLOWED, MAX_INT64_ALLOWED, allow_null=True)
logger.info(f"Rx'd NeutralCurrent: {neutral_current}")