Skip to content

Commit 29ea755

Browse files
drempelgandy31415andreilitvin
authored
Feature/electrical energy measurement (#30389)
* Added the xml for the electrical energy measurement cluster * Added convienience functions for sending events * Fixed weird whitespace * ran codegen * Add license server * Remove chip namespace prefix because we are in the chip namespace already * Restyle and use CHIP_ERROR_FORMAT * Fix header as well * Restyle * Some changes from epoch_s to systime_ms * Update the cluster to the latest version from the SPEC PR * Zap regen * Remove files that are not generated anymore by our xmls * Mark struct type attributes as needing attributeAccessInterfaceAttributes * Ran zap_convert_all.py * zaq regen after zap convert * make all clusters compile * Fix domain * Do not use PRIu64 * Fix esp32 compilation - add server cluster directory * Start adding an attribute encoding interface - for now we write nulls * Start adding some storage capability for the energy bits * Also add attribute access interface for accuracy * Also reserve space for dynamic endpoints. Note that accuracy setting is still missing * Make reporting work when accuracy is changed * Fix featuremap default * XML updates based on review * Zap regen all * Update some copyrights * Undo submodule change * fix test --------- Co-authored-by: Andrei Litvin <andy314@gmail.com> Co-authored-by: Andrei Litvin <andreilitvin@google.com>
1 parent d4595af commit 29ea755

File tree

143 files changed

+9558
-494
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

143 files changed

+9558
-494
lines changed

docs/clusters.md

+1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ Generally regenerate using one of:
7777
| 114 | 0x72 | ActivatedCarbonFilterMonitoring |
7878
| 128 | 0x80 | BooleanSensorConfiguration |
7979
| 129 | 0x81 | ValveConfigurationAndControl |
80+
| 145 | 0x91 | ElectricalEnergyMeasurement |
8081
| 150 | 0x96 | DemandResponseLoadControl |
8182
| 152 | 0x98 | DeviceEnergyManagement |
8283
| 153 | 0x99 | EnergyEvse |

examples/air-purifier-app/air-purifier-common/air-purifier-app.zap

+2-1
Original file line numberDiff line numberDiff line change
@@ -7583,5 +7583,6 @@
75837583
"endpointId": 4,
75847584
"networkId": 0
75857585
}
7586-
]
7586+
],
7587+
"log": []
75877588
}

examples/air-quality-sensor-app/air-quality-sensor-common/air-quality-sensor-app.zap

+2-1
Original file line numberDiff line numberDiff line change
@@ -6063,5 +6063,6 @@
60636063
"endpointId": 1,
60646064
"networkId": 0
60656065
}
6066-
]
6066+
],
6067+
"log": []
60676068
}

examples/all-clusters-app/all-clusters-common/all-clusters-app.matter

+95
Original file line numberDiff line numberDiff line change
@@ -3638,6 +3638,85 @@ cluster ActivatedCarbonFilterMonitoring = 114 {
36383638
command ResetCondition(): DefaultSuccess = 0;
36393639
}
36403640

3641+
/** This cluster provides a mechanism for querying data about the electrical energy imported or provided by the server. */
3642+
provisional cluster ElectricalEnergyMeasurement = 145 {
3643+
revision 1;
3644+
3645+
enum MeasurementTypeEnum : enum16 {
3646+
kUnspecified = 0;
3647+
kVoltage = 1;
3648+
kActiveCurrent = 2;
3649+
kReactiveCurrent = 3;
3650+
kApparentCurrent = 4;
3651+
kActivePower = 5;
3652+
kReactivePower = 6;
3653+
kApparentPower = 7;
3654+
kRMSVoltage = 8;
3655+
kRMSCurrent = 9;
3656+
kRMSPower = 10;
3657+
kFrequency = 11;
3658+
kPowerFactor = 12;
3659+
kNeutralCurrent = 13;
3660+
kElectricalEnergy = 14;
3661+
}
3662+
3663+
bitmap Feature : bitmap32 {
3664+
kImportedEnergy = 0x1;
3665+
kExportedEnergy = 0x2;
3666+
kCumulativeEnergy = 0x4;
3667+
kPeriodicEnergy = 0x8;
3668+
}
3669+
3670+
struct MeasurementAccuracyRangeStruct {
3671+
int64s rangeMin = 0;
3672+
int64s rangeMax = 1;
3673+
optional percent100ths percentMax = 2;
3674+
optional percent100ths percentMin = 3;
3675+
optional percent100ths percentTypical = 4;
3676+
optional int64u fixedMax = 5;
3677+
optional int64u fixedMin = 6;
3678+
optional int64u fixedTypical = 7;
3679+
}
3680+
3681+
struct MeasurementAccuracyStruct {
3682+
MeasurementTypeEnum measurementType = 0;
3683+
boolean measured = 1;
3684+
int64s minMeasuredValue = 2;
3685+
int64s maxMeasuredValue = 3;
3686+
MeasurementAccuracyRangeStruct accuracyRanges[] = 4;
3687+
}
3688+
3689+
struct EnergyMeasurementStruct {
3690+
int64s energy = 0;
3691+
optional epoch_s startTimestamp = 1;
3692+
optional epoch_s endTimestamp = 2;
3693+
optional systime_ms startSystime = 3;
3694+
optional systime_ms endSystime = 4;
3695+
}
3696+
3697+
info event CumulativeEnergyMeasured = 0 {
3698+
optional EnergyMeasurementStruct energyImported = 0;
3699+
optional EnergyMeasurementStruct energyExported = 1;
3700+
}
3701+
3702+
info event PeriodicEnergyMeasured = 1 {
3703+
optional EnergyMeasurementStruct energyImported = 0;
3704+
optional EnergyMeasurementStruct energyExported = 1;
3705+
}
3706+
3707+
readonly attribute MeasurementAccuracyStruct accuracy = 0;
3708+
readonly attribute optional nullable EnergyMeasurementStruct cumulativeEnergyImported = 1;
3709+
readonly attribute optional nullable EnergyMeasurementStruct cumulativeEnergyExported = 2;
3710+
readonly attribute optional nullable EnergyMeasurementStruct periodicEnergyImported = 3;
3711+
readonly attribute optional nullable EnergyMeasurementStruct periodicEnergyExported = 4;
3712+
readonly attribute command_id generatedCommandList[] = 65528;
3713+
readonly attribute command_id acceptedCommandList[] = 65529;
3714+
readonly attribute event_id eventList[] = 65530;
3715+
readonly attribute attrib_id attributeList[] = 65531;
3716+
readonly attribute bitmap32 featureMap = 65532;
3717+
readonly attribute int16u clusterRevision = 65533;
3718+
}
3719+
36413720
/** Provides an interface for controlling and adjusting automatic window coverings. */
36423721
cluster WindowCovering = 258 {
36433722
revision 5;
@@ -7046,6 +7125,22 @@ endpoint 1 {
70467125
handle command ResetCondition;
70477126
}
70487127

7128+
server cluster ElectricalEnergyMeasurement {
7129+
emits event CumulativeEnergyMeasured;
7130+
emits event PeriodicEnergyMeasured;
7131+
callback attribute accuracy;
7132+
callback attribute cumulativeEnergyImported;
7133+
callback attribute cumulativeEnergyExported;
7134+
callback attribute periodicEnergyImported;
7135+
callback attribute periodicEnergyExported;
7136+
callback attribute generatedCommandList;
7137+
callback attribute acceptedCommandList;
7138+
callback attribute eventList;
7139+
callback attribute attributeList;
7140+
ram attribute featureMap default = 0x000F;
7141+
ram attribute clusterRevision default = 1;
7142+
}
7143+
70497144
server cluster WindowCovering {
70507145
ram attribute type default = 0x08;
70517146
ram attribute physicalClosedLimitLift default = 0xFFFF;

examples/all-clusters-app/all-clusters-common/all-clusters-app.zap

+220-1
Original file line numberDiff line numberDiff line change
@@ -11524,6 +11524,225 @@
1152411524
}
1152511525
]
1152611526
},
11527+
{
11528+
"name": "Electrical Energy Measurement",
11529+
"code": 145,
11530+
"mfgCode": null,
11531+
"define": "ELECTRICAL_ENERGY_MEASUREMENT_CLUSTER",
11532+
"side": "server",
11533+
"enabled": 1,
11534+
"apiMaturity": "provisional",
11535+
"attributes": [
11536+
{
11537+
"name": "Measured",
11538+
"code": 0,
11539+
"mfgCode": null,
11540+
"side": "server",
11541+
"type": "boolean",
11542+
"included": 1,
11543+
"storageOption": "RAM",
11544+
"singleton": 0,
11545+
"bounded": 0,
11546+
"defaultValue": "false",
11547+
"reportable": 1,
11548+
"minInterval": 1,
11549+
"maxInterval": 65534,
11550+
"reportableChange": 0
11551+
},
11552+
{
11553+
"name": "Accuracy",
11554+
"code": 1,
11555+
"mfgCode": null,
11556+
"side": "server",
11557+
"type": "MeasurementAccuracyStruct",
11558+
"included": 1,
11559+
"storageOption": "External",
11560+
"singleton": 0,
11561+
"bounded": 0,
11562+
"defaultValue": null,
11563+
"reportable": 1,
11564+
"minInterval": 1,
11565+
"maxInterval": 65534,
11566+
"reportableChange": 0
11567+
},
11568+
{
11569+
"name": "CumulativeEnergyImported",
11570+
"code": 2,
11571+
"mfgCode": null,
11572+
"side": "server",
11573+
"type": "EnergyMeasurementStruct",
11574+
"included": 1,
11575+
"storageOption": "External",
11576+
"singleton": 0,
11577+
"bounded": 0,
11578+
"defaultValue": null,
11579+
"reportable": 1,
11580+
"minInterval": 1,
11581+
"maxInterval": 65534,
11582+
"reportableChange": 0
11583+
},
11584+
{
11585+
"name": "CumulativeEnergyExported",
11586+
"code": 3,
11587+
"mfgCode": null,
11588+
"side": "server",
11589+
"type": "EnergyMeasurementStruct",
11590+
"included": 1,
11591+
"storageOption": "External",
11592+
"singleton": 0,
11593+
"bounded": 0,
11594+
"defaultValue": null,
11595+
"reportable": 1,
11596+
"minInterval": 1,
11597+
"maxInterval": 65534,
11598+
"reportableChange": 0
11599+
},
11600+
{
11601+
"name": "PeriodicEnergyImported",
11602+
"code": 4,
11603+
"mfgCode": null,
11604+
"side": "server",
11605+
"type": "EnergyMeasurementStruct",
11606+
"included": 1,
11607+
"storageOption": "External",
11608+
"singleton": 0,
11609+
"bounded": 0,
11610+
"defaultValue": null,
11611+
"reportable": 1,
11612+
"minInterval": 1,
11613+
"maxInterval": 65534,
11614+
"reportableChange": 0
11615+
},
11616+
{
11617+
"name": "PeriodicEnergyExported",
11618+
"code": 5,
11619+
"mfgCode": null,
11620+
"side": "server",
11621+
"type": "EnergyMeasurementStruct",
11622+
"included": 1,
11623+
"storageOption": "External",
11624+
"singleton": 0,
11625+
"bounded": 0,
11626+
"defaultValue": null,
11627+
"reportable": 1,
11628+
"minInterval": 1,
11629+
"maxInterval": 65534,
11630+
"reportableChange": 0
11631+
},
11632+
{
11633+
"name": "GeneratedCommandList",
11634+
"code": 65528,
11635+
"mfgCode": null,
11636+
"side": "server",
11637+
"type": "array",
11638+
"included": 1,
11639+
"storageOption": "External",
11640+
"singleton": 0,
11641+
"bounded": 0,
11642+
"defaultValue": null,
11643+
"reportable": 1,
11644+
"minInterval": 1,
11645+
"maxInterval": 65534,
11646+
"reportableChange": 0
11647+
},
11648+
{
11649+
"name": "AcceptedCommandList",
11650+
"code": 65529,
11651+
"mfgCode": null,
11652+
"side": "server",
11653+
"type": "array",
11654+
"included": 1,
11655+
"storageOption": "External",
11656+
"singleton": 0,
11657+
"bounded": 0,
11658+
"defaultValue": null,
11659+
"reportable": 1,
11660+
"minInterval": 1,
11661+
"maxInterval": 65534,
11662+
"reportableChange": 0
11663+
},
11664+
{
11665+
"name": "EventList",
11666+
"code": 65530,
11667+
"mfgCode": null,
11668+
"side": "server",
11669+
"type": "array",
11670+
"included": 1,
11671+
"storageOption": "External",
11672+
"singleton": 0,
11673+
"bounded": 0,
11674+
"defaultValue": null,
11675+
"reportable": 1,
11676+
"minInterval": 1,
11677+
"maxInterval": 65534,
11678+
"reportableChange": 0
11679+
},
11680+
{
11681+
"name": "AttributeList",
11682+
"code": 65531,
11683+
"mfgCode": null,
11684+
"side": "server",
11685+
"type": "array",
11686+
"included": 1,
11687+
"storageOption": "External",
11688+
"singleton": 0,
11689+
"bounded": 0,
11690+
"defaultValue": null,
11691+
"reportable": 1,
11692+
"minInterval": 1,
11693+
"maxInterval": 65534,
11694+
"reportableChange": 0
11695+
},
11696+
{
11697+
"name": "FeatureMap",
11698+
"code": 65532,
11699+
"mfgCode": null,
11700+
"side": "server",
11701+
"type": "bitmap32",
11702+
"included": 1,
11703+
"storageOption": "RAM",
11704+
"singleton": 0,
11705+
"bounded": 0,
11706+
"defaultValue": "0x000F",
11707+
"reportable": 1,
11708+
"minInterval": 1,
11709+
"maxInterval": 65534,
11710+
"reportableChange": 0
11711+
},
11712+
{
11713+
"name": "ClusterRevision",
11714+
"code": 65533,
11715+
"mfgCode": null,
11716+
"side": "server",
11717+
"type": "int16u",
11718+
"included": 1,
11719+
"storageOption": "RAM",
11720+
"singleton": 0,
11721+
"bounded": 0,
11722+
"defaultValue": "1",
11723+
"reportable": 1,
11724+
"minInterval": 1,
11725+
"maxInterval": 65534,
11726+
"reportableChange": 0
11727+
}
11728+
],
11729+
"events": [
11730+
{
11731+
"name": "CumulativeEnergyMeasured",
11732+
"code": 0,
11733+
"mfgCode": null,
11734+
"side": "server",
11735+
"included": 1
11736+
},
11737+
{
11738+
"name": "PeriodicEnergyMeasured",
11739+
"code": 1,
11740+
"mfgCode": null,
11741+
"side": "server",
11742+
"included": 1
11743+
}
11744+
]
11745+
},
1152711746
{
1152811747
"name": "Window Covering",
1152911748
"code": 258,
@@ -21742,4 +21961,4 @@
2174221961
}
2174321962
],
2174421963
"log": []
21745-
}
21964+
}

examples/all-clusters-app/esp32/main/CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,9 @@ set(SRC_DIRS_LIST
8484
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/temperature-control-server"
8585
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/time-synchronization-server"
8686
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/dishwasher-alarm-server"
87-
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/laundry-washer-controls-server"
87+
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/laundry-washer-controls-server"
8888
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/all-clusters-app/all-clusters-common/src"
89+
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/electrical-energy-measurement-server"
8990
)
9091

9192

examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap

+2-1
Original file line numberDiff line numberDiff line change
@@ -12252,5 +12252,6 @@
1225212252
"endpointId": 65534,
1225312253
"networkId": 0
1225412254
}
12255-
]
12255+
],
12256+
"log": []
1225612257
}

examples/bridge-app/bridge-common/bridge-app.zap

+2-1
Original file line numberDiff line numberDiff line change
@@ -5753,5 +5753,6 @@
57535753
"endpointId": 2,
57545754
"networkId": 0
57555755
}
5756-
]
5756+
],
5757+
"log": []
57575758
}

0 commit comments

Comments
 (0)