Skip to content

Commit

Permalink
Turned on PowerSource and PowerTopology clusters in EnergyManagementA…
Browse files Browse the repository at this point in the history
…pp 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 <[email protected]>
  • Loading branch information
jamesharrow and restyled-commits authored Feb 29, 2024
1 parent 3dbb78f commit 19fcc57
Show file tree
Hide file tree
Showing 10 changed files with 925 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,265 @@ cluster UnitLocalization = 45 {
readonly attribute int16u clusterRevision = 65533;
}

/** This cluster is used to describe the configuration and capabilities of a physical power source that provides power to the Node. */
cluster PowerSource = 47 {
revision 1; // NOTE: Default/not specifically set

enum BatApprovedChemistryEnum : enum16 {
kUnspecified = 0;
kAlkaline = 1;
kLithiumCarbonFluoride = 2;
kLithiumChromiumOxide = 3;
kLithiumCopperOxide = 4;
kLithiumIronDisulfide = 5;
kLithiumManganeseDioxide = 6;
kLithiumThionylChloride = 7;
kMagnesium = 8;
kMercuryOxide = 9;
kNickelOxyhydride = 10;
kSilverOxide = 11;
kZincAir = 12;
kZincCarbon = 13;
kZincChloride = 14;
kZincManganeseDioxide = 15;
kLeadAcid = 16;
kLithiumCobaltOxide = 17;
kLithiumIon = 18;
kLithiumIonPolymer = 19;
kLithiumIronPhosphate = 20;
kLithiumSulfur = 21;
kLithiumTitanate = 22;
kNickelCadmium = 23;
kNickelHydrogen = 24;
kNickelIron = 25;
kNickelMetalHydride = 26;
kNickelZinc = 27;
kSilverZinc = 28;
kSodiumIon = 29;
kSodiumSulfur = 30;
kZincBromide = 31;
kZincCerium = 32;
}

enum BatChargeFaultEnum : enum8 {
kUnspecified = 0;
kAmbientTooHot = 1;
kAmbientTooCold = 2;
kBatteryTooHot = 3;
kBatteryTooCold = 4;
kBatteryAbsent = 5;
kBatteryOverVoltage = 6;
kBatteryUnderVoltage = 7;
kChargerOverVoltage = 8;
kChargerUnderVoltage = 9;
kSafetyTimeout = 10;
}

enum BatChargeLevelEnum : enum8 {
kOK = 0;
kWarning = 1;
kCritical = 2;
}

enum BatChargeStateEnum : enum8 {
kUnknown = 0;
kIsCharging = 1;
kIsAtFullCharge = 2;
kIsNotCharging = 3;
}

enum BatCommonDesignationEnum : enum16 {
kUnspecified = 0;
kAAA = 1;
kAA = 2;
kC = 3;
kD = 4;
k4v5 = 5;
k6v0 = 6;
k9v0 = 7;
k12AA = 8;
kAAAA = 9;
kA = 10;
kB = 11;
kF = 12;
kN = 13;
kNo6 = 14;
kSubC = 15;
kA23 = 16;
kA27 = 17;
kBA5800 = 18;
kDuplex = 19;
k4SR44 = 20;
k523 = 21;
k531 = 22;
k15v0 = 23;
k22v5 = 24;
k30v0 = 25;
k45v0 = 26;
k67v5 = 27;
kJ = 28;
kCR123A = 29;
kCR2 = 30;
k2CR5 = 31;
kCRP2 = 32;
kCRV3 = 33;
kSR41 = 34;
kSR43 = 35;
kSR44 = 36;
kSR45 = 37;
kSR48 = 38;
kSR54 = 39;
kSR55 = 40;
kSR57 = 41;
kSR58 = 42;
kSR59 = 43;
kSR60 = 44;
kSR63 = 45;
kSR64 = 46;
kSR65 = 47;
kSR66 = 48;
kSR67 = 49;
kSR68 = 50;
kSR69 = 51;
kSR516 = 52;
kSR731 = 53;
kSR712 = 54;
kLR932 = 55;
kA5 = 56;
kA10 = 57;
kA13 = 58;
kA312 = 59;
kA675 = 60;
kAC41E = 61;
k10180 = 62;
k10280 = 63;
k10440 = 64;
k14250 = 65;
k14430 = 66;
k14500 = 67;
k14650 = 68;
k15270 = 69;
k16340 = 70;
kRCR123A = 71;
k17500 = 72;
k17670 = 73;
k18350 = 74;
k18500 = 75;
k18650 = 76;
k19670 = 77;
k25500 = 78;
k26650 = 79;
k32600 = 80;
}

enum BatFaultEnum : enum8 {
kUnspecified = 0;
kOverTemp = 1;
kUnderTemp = 2;
}

enum BatReplaceabilityEnum : enum8 {
kUnspecified = 0;
kNotReplaceable = 1;
kUserReplaceable = 2;
kFactoryReplaceable = 3;
}

enum PowerSourceStatusEnum : enum8 {
kUnspecified = 0;
kActive = 1;
kStandby = 2;
kUnavailable = 3;
}

enum WiredCurrentTypeEnum : enum8 {
kAC = 0;
kDC = 1;
}

enum WiredFaultEnum : enum8 {
kUnspecified = 0;
kOverVoltage = 1;
kUnderVoltage = 2;
}

bitmap Feature : bitmap32 {
kWired = 0x1;
kBattery = 0x2;
kRechargeable = 0x4;
kReplaceable = 0x8;
}

struct BatChargeFaultChangeType {
BatChargeFaultEnum current[] = 0;
BatChargeFaultEnum previous[] = 1;
}

struct BatFaultChangeType {
BatFaultEnum current[] = 0;
BatFaultEnum previous[] = 1;
}

struct WiredFaultChangeType {
WiredFaultEnum current[] = 0;
WiredFaultEnum previous[] = 1;
}

info event WiredFaultChange = 0 {
WiredFaultEnum current[] = 0;
WiredFaultEnum previous[] = 1;
}

info event BatFaultChange = 1 {
BatFaultEnum current[] = 0;
BatFaultEnum previous[] = 1;
}

info event BatChargeFaultChange = 2 {
BatChargeFaultEnum current[] = 0;
BatChargeFaultEnum previous[] = 1;
}

readonly attribute PowerSourceStatusEnum status = 0;
readonly attribute int8u order = 1;
readonly attribute char_string<60> description = 2;
readonly attribute optional nullable int32u wiredAssessedInputVoltage = 3;
readonly attribute optional nullable int16u wiredAssessedInputFrequency = 4;
readonly attribute optional WiredCurrentTypeEnum wiredCurrentType = 5;
readonly attribute optional nullable int32u wiredAssessedCurrent = 6;
readonly attribute optional int32u wiredNominalVoltage = 7;
readonly attribute optional int32u wiredMaximumCurrent = 8;
readonly attribute optional boolean wiredPresent = 9;
readonly attribute optional WiredFaultEnum activeWiredFaults[] = 10;
readonly attribute optional nullable int32u batVoltage = 11;
readonly attribute optional nullable int8u batPercentRemaining = 12;
readonly attribute optional nullable int32u batTimeRemaining = 13;
readonly attribute optional BatChargeLevelEnum batChargeLevel = 14;
readonly attribute optional boolean batReplacementNeeded = 15;
readonly attribute optional BatReplaceabilityEnum batReplaceability = 16;
readonly attribute optional boolean batPresent = 17;
readonly attribute optional BatFaultEnum activeBatFaults[] = 18;
readonly attribute optional char_string<60> batReplacementDescription = 19;
readonly attribute optional BatCommonDesignationEnum batCommonDesignation = 20;
readonly attribute optional char_string<20> batANSIDesignation = 21;
readonly attribute optional char_string<20> batIECDesignation = 22;
readonly attribute optional BatApprovedChemistryEnum batApprovedChemistry = 23;
readonly attribute optional int32u batCapacity = 24;
readonly attribute optional int8u batQuantity = 25;
readonly attribute optional BatChargeStateEnum batChargeState = 26;
readonly attribute optional nullable int32u batTimeToFullCharge = 27;
readonly attribute optional boolean batFunctionalWhileCharging = 28;
readonly attribute optional nullable int32u batChargingCurrent = 29;
readonly attribute optional BatChargeFaultEnum activeBatChargeFaults[] = 30;
readonly attribute endpoint_no endpointList[] = 31;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute event_id eventList[] = 65530;
readonly attribute attrib_id attributeList[] = 65531;
readonly attribute bitmap32 featureMap = 65532;
readonly attribute int16u clusterRevision = 65533;
}

/** This cluster is used to manage global aspects of the Commissioning flow. */
cluster GeneralCommissioning = 48 {
revision 1; // NOTE: Default/not specifically set
Expand Down Expand Up @@ -1557,6 +1816,27 @@ provisional cluster EnergyEvse = 153 {
timed command ClearTargets(): DefaultSuccess = 7;
}

/** The Power Topology Cluster provides a mechanism for expressing how power is flowing between endpoints. */
provisional cluster PowerTopology = 156 {
revision 1;

bitmap Feature : bitmap32 {
kNodeTopology = 0x1;
kTreeTopology = 0x2;
kSetTopology = 0x4;
kDynamicPowerFlow = 0x8;
}

readonly attribute optional endpoint_no availableEndpoints[] = 0;
readonly attribute optional endpoint_no activeEndpoints[] = 1;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute event_id eventList[] = 65530;
readonly attribute attrib_id attributeList[] = 65531;
readonly attribute bitmap32 featureMap = 65532;
readonly attribute int16u clusterRevision = 65533;
}

/** Attributes and commands for selecting a mode from a list of supported options. */
provisional cluster EnergyEvseMode = 157 {
revision 1;
Expand Down Expand Up @@ -1701,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 @@ -1742,6 +2023,22 @@ endpoint 0 {
ram attribute clusterRevision default = 1;
}

server cluster PowerSource {
ram attribute status;
ram attribute order;
ram attribute description;
ram attribute wiredCurrentType;
ram attribute wiredNominalVoltage;
ram attribute wiredMaximumCurrent;
callback attribute endpointList;
callback attribute generatedCommandList;
callback attribute acceptedCommandList;
callback attribute eventList;
callback attribute attributeList;
ram attribute featureMap default = 0;
ram attribute clusterRevision default = 2;
}

server cluster GeneralCommissioning {
ram attribute breadcrumb default = 0x0000000000000000;
callback attribute basicCommissioningInfo;
Expand Down Expand Up @@ -1860,6 +2157,7 @@ endpoint 0 {
}
}
endpoint 1 {
device type ma_electricalsensor = 1296, version 1;
device type energy_evse = 1292, version 1;


Expand Down Expand Up @@ -2006,6 +2304,15 @@ endpoint 1 {
handle command ClearTargets;
}

server cluster PowerTopology {
callback attribute generatedCommandList;
callback attribute acceptedCommandList;
callback attribute eventList;
callback attribute attributeList;
callback attribute featureMap;
ram attribute clusterRevision default = 1;
}

server cluster EnergyEvseMode {
callback attribute supportedModes;
callback attribute currentMode;
Expand Down
Loading

0 comments on commit 19fcc57

Please sign in to comment.