Skip to content

Commit 19fcc57

Browse files
Turned on PowerSource and PowerTopology clusters in EnergyManagementApp for SVE DUTs (#32329)
* Turned on PowerSource on EP0 with WIRED mandated attributes, and PowerTopology on EP1 * Added code into EvseMain to initialise the PowerTopology cluster on EP1 * Changed ClusterRevision of PowerTopology to 2, enabled SerialNumber in BasicInfo. Added Initialization of PowerSource attributes. * Added missing PowerTopologyDelegate.h & .cpp * Added power-source and power-topology to ESP32 CMakeList.txt * Updated PowerTopology to include an Instance, and also added to EvseManufacturer class. Called PowerSource->SetEndpointList() * Restyled by whitespace --------- Co-authored-by: Restyled.io <commits@restyled.io>
1 parent 3dbb78f commit 19fcc57

10 files changed

+925
-3
lines changed

examples/energy-management-app/energy-management-common/energy-management-app.matter

+307
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,265 @@ cluster UnitLocalization = 45 {
343343
readonly attribute int16u clusterRevision = 65533;
344344
}
345345

346+
/** This cluster is used to describe the configuration and capabilities of a physical power source that provides power to the Node. */
347+
cluster PowerSource = 47 {
348+
revision 1; // NOTE: Default/not specifically set
349+
350+
enum BatApprovedChemistryEnum : enum16 {
351+
kUnspecified = 0;
352+
kAlkaline = 1;
353+
kLithiumCarbonFluoride = 2;
354+
kLithiumChromiumOxide = 3;
355+
kLithiumCopperOxide = 4;
356+
kLithiumIronDisulfide = 5;
357+
kLithiumManganeseDioxide = 6;
358+
kLithiumThionylChloride = 7;
359+
kMagnesium = 8;
360+
kMercuryOxide = 9;
361+
kNickelOxyhydride = 10;
362+
kSilverOxide = 11;
363+
kZincAir = 12;
364+
kZincCarbon = 13;
365+
kZincChloride = 14;
366+
kZincManganeseDioxide = 15;
367+
kLeadAcid = 16;
368+
kLithiumCobaltOxide = 17;
369+
kLithiumIon = 18;
370+
kLithiumIonPolymer = 19;
371+
kLithiumIronPhosphate = 20;
372+
kLithiumSulfur = 21;
373+
kLithiumTitanate = 22;
374+
kNickelCadmium = 23;
375+
kNickelHydrogen = 24;
376+
kNickelIron = 25;
377+
kNickelMetalHydride = 26;
378+
kNickelZinc = 27;
379+
kSilverZinc = 28;
380+
kSodiumIon = 29;
381+
kSodiumSulfur = 30;
382+
kZincBromide = 31;
383+
kZincCerium = 32;
384+
}
385+
386+
enum BatChargeFaultEnum : enum8 {
387+
kUnspecified = 0;
388+
kAmbientTooHot = 1;
389+
kAmbientTooCold = 2;
390+
kBatteryTooHot = 3;
391+
kBatteryTooCold = 4;
392+
kBatteryAbsent = 5;
393+
kBatteryOverVoltage = 6;
394+
kBatteryUnderVoltage = 7;
395+
kChargerOverVoltage = 8;
396+
kChargerUnderVoltage = 9;
397+
kSafetyTimeout = 10;
398+
}
399+
400+
enum BatChargeLevelEnum : enum8 {
401+
kOK = 0;
402+
kWarning = 1;
403+
kCritical = 2;
404+
}
405+
406+
enum BatChargeStateEnum : enum8 {
407+
kUnknown = 0;
408+
kIsCharging = 1;
409+
kIsAtFullCharge = 2;
410+
kIsNotCharging = 3;
411+
}
412+
413+
enum BatCommonDesignationEnum : enum16 {
414+
kUnspecified = 0;
415+
kAAA = 1;
416+
kAA = 2;
417+
kC = 3;
418+
kD = 4;
419+
k4v5 = 5;
420+
k6v0 = 6;
421+
k9v0 = 7;
422+
k12AA = 8;
423+
kAAAA = 9;
424+
kA = 10;
425+
kB = 11;
426+
kF = 12;
427+
kN = 13;
428+
kNo6 = 14;
429+
kSubC = 15;
430+
kA23 = 16;
431+
kA27 = 17;
432+
kBA5800 = 18;
433+
kDuplex = 19;
434+
k4SR44 = 20;
435+
k523 = 21;
436+
k531 = 22;
437+
k15v0 = 23;
438+
k22v5 = 24;
439+
k30v0 = 25;
440+
k45v0 = 26;
441+
k67v5 = 27;
442+
kJ = 28;
443+
kCR123A = 29;
444+
kCR2 = 30;
445+
k2CR5 = 31;
446+
kCRP2 = 32;
447+
kCRV3 = 33;
448+
kSR41 = 34;
449+
kSR43 = 35;
450+
kSR44 = 36;
451+
kSR45 = 37;
452+
kSR48 = 38;
453+
kSR54 = 39;
454+
kSR55 = 40;
455+
kSR57 = 41;
456+
kSR58 = 42;
457+
kSR59 = 43;
458+
kSR60 = 44;
459+
kSR63 = 45;
460+
kSR64 = 46;
461+
kSR65 = 47;
462+
kSR66 = 48;
463+
kSR67 = 49;
464+
kSR68 = 50;
465+
kSR69 = 51;
466+
kSR516 = 52;
467+
kSR731 = 53;
468+
kSR712 = 54;
469+
kLR932 = 55;
470+
kA5 = 56;
471+
kA10 = 57;
472+
kA13 = 58;
473+
kA312 = 59;
474+
kA675 = 60;
475+
kAC41E = 61;
476+
k10180 = 62;
477+
k10280 = 63;
478+
k10440 = 64;
479+
k14250 = 65;
480+
k14430 = 66;
481+
k14500 = 67;
482+
k14650 = 68;
483+
k15270 = 69;
484+
k16340 = 70;
485+
kRCR123A = 71;
486+
k17500 = 72;
487+
k17670 = 73;
488+
k18350 = 74;
489+
k18500 = 75;
490+
k18650 = 76;
491+
k19670 = 77;
492+
k25500 = 78;
493+
k26650 = 79;
494+
k32600 = 80;
495+
}
496+
497+
enum BatFaultEnum : enum8 {
498+
kUnspecified = 0;
499+
kOverTemp = 1;
500+
kUnderTemp = 2;
501+
}
502+
503+
enum BatReplaceabilityEnum : enum8 {
504+
kUnspecified = 0;
505+
kNotReplaceable = 1;
506+
kUserReplaceable = 2;
507+
kFactoryReplaceable = 3;
508+
}
509+
510+
enum PowerSourceStatusEnum : enum8 {
511+
kUnspecified = 0;
512+
kActive = 1;
513+
kStandby = 2;
514+
kUnavailable = 3;
515+
}
516+
517+
enum WiredCurrentTypeEnum : enum8 {
518+
kAC = 0;
519+
kDC = 1;
520+
}
521+
522+
enum WiredFaultEnum : enum8 {
523+
kUnspecified = 0;
524+
kOverVoltage = 1;
525+
kUnderVoltage = 2;
526+
}
527+
528+
bitmap Feature : bitmap32 {
529+
kWired = 0x1;
530+
kBattery = 0x2;
531+
kRechargeable = 0x4;
532+
kReplaceable = 0x8;
533+
}
534+
535+
struct BatChargeFaultChangeType {
536+
BatChargeFaultEnum current[] = 0;
537+
BatChargeFaultEnum previous[] = 1;
538+
}
539+
540+
struct BatFaultChangeType {
541+
BatFaultEnum current[] = 0;
542+
BatFaultEnum previous[] = 1;
543+
}
544+
545+
struct WiredFaultChangeType {
546+
WiredFaultEnum current[] = 0;
547+
WiredFaultEnum previous[] = 1;
548+
}
549+
550+
info event WiredFaultChange = 0 {
551+
WiredFaultEnum current[] = 0;
552+
WiredFaultEnum previous[] = 1;
553+
}
554+
555+
info event BatFaultChange = 1 {
556+
BatFaultEnum current[] = 0;
557+
BatFaultEnum previous[] = 1;
558+
}
559+
560+
info event BatChargeFaultChange = 2 {
561+
BatChargeFaultEnum current[] = 0;
562+
BatChargeFaultEnum previous[] = 1;
563+
}
564+
565+
readonly attribute PowerSourceStatusEnum status = 0;
566+
readonly attribute int8u order = 1;
567+
readonly attribute char_string<60> description = 2;
568+
readonly attribute optional nullable int32u wiredAssessedInputVoltage = 3;
569+
readonly attribute optional nullable int16u wiredAssessedInputFrequency = 4;
570+
readonly attribute optional WiredCurrentTypeEnum wiredCurrentType = 5;
571+
readonly attribute optional nullable int32u wiredAssessedCurrent = 6;
572+
readonly attribute optional int32u wiredNominalVoltage = 7;
573+
readonly attribute optional int32u wiredMaximumCurrent = 8;
574+
readonly attribute optional boolean wiredPresent = 9;
575+
readonly attribute optional WiredFaultEnum activeWiredFaults[] = 10;
576+
readonly attribute optional nullable int32u batVoltage = 11;
577+
readonly attribute optional nullable int8u batPercentRemaining = 12;
578+
readonly attribute optional nullable int32u batTimeRemaining = 13;
579+
readonly attribute optional BatChargeLevelEnum batChargeLevel = 14;
580+
readonly attribute optional boolean batReplacementNeeded = 15;
581+
readonly attribute optional BatReplaceabilityEnum batReplaceability = 16;
582+
readonly attribute optional boolean batPresent = 17;
583+
readonly attribute optional BatFaultEnum activeBatFaults[] = 18;
584+
readonly attribute optional char_string<60> batReplacementDescription = 19;
585+
readonly attribute optional BatCommonDesignationEnum batCommonDesignation = 20;
586+
readonly attribute optional char_string<20> batANSIDesignation = 21;
587+
readonly attribute optional char_string<20> batIECDesignation = 22;
588+
readonly attribute optional BatApprovedChemistryEnum batApprovedChemistry = 23;
589+
readonly attribute optional int32u batCapacity = 24;
590+
readonly attribute optional int8u batQuantity = 25;
591+
readonly attribute optional BatChargeStateEnum batChargeState = 26;
592+
readonly attribute optional nullable int32u batTimeToFullCharge = 27;
593+
readonly attribute optional boolean batFunctionalWhileCharging = 28;
594+
readonly attribute optional nullable int32u batChargingCurrent = 29;
595+
readonly attribute optional BatChargeFaultEnum activeBatChargeFaults[] = 30;
596+
readonly attribute endpoint_no endpointList[] = 31;
597+
readonly attribute command_id generatedCommandList[] = 65528;
598+
readonly attribute command_id acceptedCommandList[] = 65529;
599+
readonly attribute event_id eventList[] = 65530;
600+
readonly attribute attrib_id attributeList[] = 65531;
601+
readonly attribute bitmap32 featureMap = 65532;
602+
readonly attribute int16u clusterRevision = 65533;
603+
}
604+
346605
/** This cluster is used to manage global aspects of the Commissioning flow. */
347606
cluster GeneralCommissioning = 48 {
348607
revision 1; // NOTE: Default/not specifically set
@@ -1557,6 +1816,27 @@ provisional cluster EnergyEvse = 153 {
15571816
timed command ClearTargets(): DefaultSuccess = 7;
15581817
}
15591818

1819+
/** The Power Topology Cluster provides a mechanism for expressing how power is flowing between endpoints. */
1820+
provisional cluster PowerTopology = 156 {
1821+
revision 1;
1822+
1823+
bitmap Feature : bitmap32 {
1824+
kNodeTopology = 0x1;
1825+
kTreeTopology = 0x2;
1826+
kSetTopology = 0x4;
1827+
kDynamicPowerFlow = 0x8;
1828+
}
1829+
1830+
readonly attribute optional endpoint_no availableEndpoints[] = 0;
1831+
readonly attribute optional endpoint_no activeEndpoints[] = 1;
1832+
readonly attribute command_id generatedCommandList[] = 65528;
1833+
readonly attribute command_id acceptedCommandList[] = 65529;
1834+
readonly attribute event_id eventList[] = 65530;
1835+
readonly attribute attrib_id attributeList[] = 65531;
1836+
readonly attribute bitmap32 featureMap = 65532;
1837+
readonly attribute int16u clusterRevision = 65533;
1838+
}
1839+
15601840
/** Attributes and commands for selecting a mode from a list of supported options. */
15611841
provisional cluster EnergyEvseMode = 157 {
15621842
revision 1;
@@ -1701,6 +1981,7 @@ endpoint 0 {
17011981
callback attribute hardwareVersionString;
17021982
callback attribute softwareVersion;
17031983
callback attribute softwareVersionString;
1984+
callback attribute serialNumber;
17041985
callback attribute capabilityMinima;
17051986
callback attribute specificationVersion;
17061987
callback attribute maxPathsPerInvoke;
@@ -1742,6 +2023,22 @@ endpoint 0 {
17422023
ram attribute clusterRevision default = 1;
17432024
}
17442025

2026+
server cluster PowerSource {
2027+
ram attribute status;
2028+
ram attribute order;
2029+
ram attribute description;
2030+
ram attribute wiredCurrentType;
2031+
ram attribute wiredNominalVoltage;
2032+
ram attribute wiredMaximumCurrent;
2033+
callback attribute endpointList;
2034+
callback attribute generatedCommandList;
2035+
callback attribute acceptedCommandList;
2036+
callback attribute eventList;
2037+
callback attribute attributeList;
2038+
ram attribute featureMap default = 0;
2039+
ram attribute clusterRevision default = 2;
2040+
}
2041+
17452042
server cluster GeneralCommissioning {
17462043
ram attribute breadcrumb default = 0x0000000000000000;
17472044
callback attribute basicCommissioningInfo;
@@ -1860,6 +2157,7 @@ endpoint 0 {
18602157
}
18612158
}
18622159
endpoint 1 {
2160+
device type ma_electricalsensor = 1296, version 1;
18632161
device type energy_evse = 1292, version 1;
18642162

18652163

@@ -2006,6 +2304,15 @@ endpoint 1 {
20062304
handle command ClearTargets;
20072305
}
20082306

2307+
server cluster PowerTopology {
2308+
callback attribute generatedCommandList;
2309+
callback attribute acceptedCommandList;
2310+
callback attribute eventList;
2311+
callback attribute attributeList;
2312+
callback attribute featureMap;
2313+
ram attribute clusterRevision default = 1;
2314+
}
2315+
20092316
server cluster EnergyEvseMode {
20102317
callback attribute supportedModes;
20112318
callback attribute currentMode;

0 commit comments

Comments
 (0)