Skip to content

Commit 0e3320a

Browse files
jamesharrowrestyled-commitsbzbarsky-apple
authored andcommitted
Add EnergyEvse to all-clusters-app (project-chip#30857)
* Fix project-chip#30665 (EVSE) - Changed to use amperage_mA, energy_mWh - removed max on epoch_s - removed access for operate - removed side for events * Fix project-chip#30665 updates to try to get further with ZAP and autogen, but still fails with some parts of regen_all * Added ember-compatibility-functions.cpp which was missing. * Made all types all lowercase to resolve regen_all issues. * Fixed lint issue (trailing whitespace). * Fixes project-chip#30727 - Added initial EVSE cluster and Example Energy Managament app. * Tidied up old comments. * Restyled by whitespace * Restyled by gn * Restyled by prettier-markdown * Added copy of files to all-clusters-app linux BUILD.gn and did basic test with chip-tool * Fixed lint error (Remove PRId64) * Fix for Documentation Build and publish checker. * Updated all-clusters-app.zap after merge and regen_all * Added Cluster to ESP32 CMakeLists.txt * Fixed ESP32 compile error caused by %d * Added missing source files to each build variant * Restyled by gn * Fixed incorrect uint64_t in EnableCharging/EnableDischarging command * Fixed more issues seen on different platforms * Removed unused mEndpointId * Add source files to shell standalone BUILD.gn, More %d fixes for different platforms * Restyled by gn * Removed unused mMinimumChargingCurrentLimitFromCommand * Removed yet more unused variables * Fixed missing semi-colon. How did the other compilers not pick this up? * Capitalise function names * PR comment - Moved PluginServerInitCallback to sdk. Capitalised more function names in energy-management-app. * Restyled by whitespace * Fixes project-chip#30805 Updated energy-evse-cluster.xml * Fixes project-chip#30805 zap_regen_all commit. * Removed energy-management-app from this branch to make PR smaller to review * Changing something to force a rebuild once I turned off backwards compatibility check * Update examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Made Fault Event allow a nullable SessionID * Updates based on review (use kMaximumChargeCurrent instead of duplicate #define). Add HwSetVehicleID implementation * Added RFID Event support. Removed more unnecessary chip:: * Added Feature flags, optional commands and optional attributes. * Made command handling conditional based on features * Added Feature support to all-clusters-app * Restyled by clang-format * Restyled by clang-format * Fix to Darwin compile error - not checking strcmp return * Fix to Darwin compile error - not checking strcmp return * Attempt to fix Darwin errors (return after else) * Attempt to fix Darwin errors (return after else) * Merged to upstream master * Updated based on latest upstream master * Removed unnecessary mInstance and used 'this' instead. * Regen_all after merge to master. * Fix review comment. * Ensure Init() returns a failure if there is one. Aligned to mode-base-server.cpp * Backed out Read attr check based on features. * Fixed EnumerateAcceptedCommands to handle Loop::Break condition. * Had missed StartDiagnostic as an optional command in InvokeCommand * Removed extra chip:: in attr types. * Updated HwSetVehicleID to copy the value from callee * Fixed potential buffer overrun in HwSetVehicleID. * Ensured that mVehicleID free's any malloc'd CharSpan in destructor * Sync EnergyEvseDelegateImpl.cpp from Example Energy Management --------- Co-authored-by: Restyled.io <commits@restyled.io> Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
1 parent 9fcab32 commit 0e3320a

File tree

60 files changed

+3394
-465
lines changed

Some content is hidden

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

60 files changed

+3394
-465
lines changed

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

+215
Original file line numberDiff line numberDiff line change
@@ -3717,6 +3717,187 @@ provisional cluster ElectricalEnergyMeasurement = 145 {
37173717
readonly attribute int16u clusterRevision = 65533;
37183718
}
37193719

3720+
/** Electric Vehicle Supply Equipment (EVSE) is equipment used to charge an Electric Vehicle (EV) or Plug-In Hybrid Electric Vehicle. This cluster provides an interface to the functionality of Electric Vehicle Supply Equipment (EVSE) management. */
3721+
provisional cluster EnergyEvse = 153 {
3722+
revision 1; // NOTE: Default/not specifically set
3723+
3724+
enum EnergyTransferStoppedReasonEnum : enum8 {
3725+
kEVStopped = 0;
3726+
kEVSEStopped = 1;
3727+
kOther = 2;
3728+
}
3729+
3730+
enum FaultStateEnum : enum8 {
3731+
kNoError = 0;
3732+
kMeterFailure = 1;
3733+
kOverVoltage = 2;
3734+
kUnderVoltage = 3;
3735+
kOverCurrent = 4;
3736+
kContactWetFailure = 5;
3737+
kContactDryFailure = 6;
3738+
kGroundFault = 7;
3739+
kPowerLoss = 8;
3740+
kPowerQuality = 9;
3741+
kPilotShortCircuit = 10;
3742+
kEmergencyStop = 11;
3743+
kEVDisconnected = 12;
3744+
kWrongPowerSupply = 13;
3745+
kLiveNeutralSwap = 14;
3746+
kOverTemperature = 15;
3747+
kOther = 255;
3748+
}
3749+
3750+
enum StateEnum : enum8 {
3751+
kNotPluggedIn = 0;
3752+
kPluggedInNoDemand = 1;
3753+
kPluggedInDemand = 2;
3754+
kPluggedInCharging = 3;
3755+
kPluggedInDischarging = 4;
3756+
kSessionEnding = 5;
3757+
kFault = 6;
3758+
}
3759+
3760+
enum SupplyStateEnum : enum8 {
3761+
kDisabled = 0;
3762+
kChargingEnabled = 1;
3763+
kDischargingEnabled = 2;
3764+
kDisabledError = 3;
3765+
kDisabledDiagnostics = 4;
3766+
}
3767+
3768+
bitmap Feature : bitmap32 {
3769+
kChargingPreferences = 0x1;
3770+
kSoCReporting = 0x2;
3771+
kPlugAndCharge = 0x4;
3772+
kRFID = 0x8;
3773+
kV2X = 0x10;
3774+
}
3775+
3776+
bitmap TargetDayOfWeekBitmap : bitmap8 {
3777+
kSunday = 0x1;
3778+
kMonday = 0x2;
3779+
kTuesday = 0x4;
3780+
kWednesday = 0x8;
3781+
kThursday = 0x10;
3782+
kFriday = 0x20;
3783+
kSaturday = 0x40;
3784+
}
3785+
3786+
struct ChargingTargetStruct {
3787+
int16u targetTimeMinutesPastMidnight = 0;
3788+
optional percent targetSoC = 1;
3789+
optional energy_mwh addedEnergy = 2;
3790+
}
3791+
3792+
info event EVConnected = 0 {
3793+
int32u sessionID = 0;
3794+
}
3795+
3796+
info event EVNotDetected = 1 {
3797+
int32u sessionID = 0;
3798+
StateEnum state = 1;
3799+
elapsed_s sessionDuration = 2;
3800+
energy_mwh sessionEnergyCharged = 3;
3801+
optional energy_mwh sessionEnergyDischarged = 4;
3802+
}
3803+
3804+
info event EnergyTransferStarted = 2 {
3805+
int32u sessionID = 0;
3806+
StateEnum state = 1;
3807+
amperage_ma maximumCurrent = 2;
3808+
}
3809+
3810+
info event EnergyTransferStopped = 3 {
3811+
int32u sessionID = 0;
3812+
StateEnum state = 1;
3813+
EnergyTransferStoppedReasonEnum reason = 2;
3814+
energy_mwh energyTransferred = 4;
3815+
}
3816+
3817+
critical event Fault = 4 {
3818+
nullable int32u sessionID = 0;
3819+
StateEnum state = 1;
3820+
FaultStateEnum faultStatePreviousState = 2;
3821+
FaultStateEnum faultStateCurrentState = 4;
3822+
}
3823+
3824+
info event RFID = 5 {
3825+
octet_string uid = 0;
3826+
}
3827+
3828+
readonly attribute nullable StateEnum state = 0;
3829+
readonly attribute SupplyStateEnum supplyState = 1;
3830+
readonly attribute FaultStateEnum faultState = 2;
3831+
readonly attribute nullable epoch_s chargingEnabledUntil = 3;
3832+
readonly attribute optional nullable epoch_s dischargingEnabledUntil = 4;
3833+
readonly attribute amperage_ma circuitCapacity = 5;
3834+
readonly attribute amperage_ma minimumChargeCurrent = 6;
3835+
readonly attribute amperage_ma maximumChargeCurrent = 7;
3836+
readonly attribute optional amperage_ma maximumDischargeCurrent = 8;
3837+
attribute access(write: manage) optional amperage_ma userMaximumChargeCurrent = 9;
3838+
attribute access(write: manage) optional elapsed_s randomizationDelayWindow = 10;
3839+
readonly attribute optional int8u numberOfWeeklyTargets = 33;
3840+
readonly attribute optional int8u numberOfDailyTargets = 34;
3841+
readonly attribute optional nullable epoch_s nextChargeStartTime = 35;
3842+
readonly attribute optional nullable epoch_s nextChargeTargetTime = 36;
3843+
readonly attribute optional nullable energy_mwh nextChargeRequiredEnergy = 37;
3844+
readonly attribute optional nullable percent nextChargeTargetSoC = 38;
3845+
attribute access(write: manage) optional nullable int16u approximateEVEfficiency = 39;
3846+
readonly attribute optional nullable percent stateOfCharge = 48;
3847+
readonly attribute optional nullable energy_mwh batteryCapacity = 49;
3848+
readonly attribute optional nullable char_string<32> vehicleID = 50;
3849+
readonly attribute nullable int32u sessionID = 64;
3850+
readonly attribute nullable elapsed_s sessionDuration = 65;
3851+
readonly attribute nullable energy_mwh sessionEnergyCharged = 66;
3852+
readonly attribute optional nullable energy_mwh sessionEnergyDischarged = 67;
3853+
readonly attribute command_id generatedCommandList[] = 65528;
3854+
readonly attribute command_id acceptedCommandList[] = 65529;
3855+
readonly attribute event_id eventList[] = 65530;
3856+
readonly attribute attrib_id attributeList[] = 65531;
3857+
readonly attribute bitmap32 featureMap = 65532;
3858+
readonly attribute int16u clusterRevision = 65533;
3859+
3860+
response struct GetTargetsResponse = 0 {
3861+
TargetDayOfWeekBitmap dayOfWeekforSequence = 0;
3862+
ChargingTargetStruct chargingTargets[] = 1;
3863+
}
3864+
3865+
request struct EnableChargingRequest {
3866+
nullable epoch_s chargingEnabledUntil = 0;
3867+
amperage_ma minimumChargeCurrent = 1;
3868+
amperage_ma maximumChargeCurrent = 2;
3869+
}
3870+
3871+
request struct EnableDischargingRequest {
3872+
nullable epoch_s dischargingEnabledUntil = 0;
3873+
amperage_ma maximumDischargeCurrent = 1;
3874+
}
3875+
3876+
request struct SetTargetsRequest {
3877+
TargetDayOfWeekBitmap dayOfWeekforSequence = 0;
3878+
ChargingTargetStruct chargingTargets[] = 1;
3879+
}
3880+
3881+
request struct GetTargetsRequest {
3882+
TargetDayOfWeekBitmap daysToReturn = 0;
3883+
}
3884+
3885+
/** Allows a client to disable the EVSE from charging and discharging. */
3886+
timed command Disable(): DefaultSuccess = 1;
3887+
/** Allows a client to enable the EVSE to charge an EV. */
3888+
timed command EnableCharging(EnableChargingRequest): DefaultSuccess = 2;
3889+
/** Allows a client to enable the EVSE to discharge an EV. */
3890+
timed command EnableDischarging(EnableDischargingRequest): DefaultSuccess = 3;
3891+
/** Allows a client to put the EVSE into a self-diagnostics mode. */
3892+
timed command StartDiagnostics(): DefaultSuccess = 4;
3893+
/** Allows a client to set the user specified charging targets. */
3894+
timed command SetTargets(SetTargetsRequest): DefaultSuccess = 5;
3895+
/** Allows a client to retrieve the user specified charging targets. */
3896+
timed command GetTargets(GetTargetsRequest): GetTargetsResponse = 6;
3897+
/** Allows a client to clear all stored charging targets. */
3898+
timed command ClearTargets(): DefaultSuccess = 7;
3899+
}
3900+
37203901
/** Provides an interface for controlling and adjusting automatic window coverings. */
37213902
cluster WindowCovering = 258 {
37223903
revision 5;
@@ -7141,6 +7322,40 @@ endpoint 1 {
71417322
ram attribute clusterRevision default = 1;
71427323
}
71437324

7325+
server cluster EnergyEvse {
7326+
callback attribute state default = 0;
7327+
callback attribute supplyState default = 0;
7328+
callback attribute faultState default = 0;
7329+
callback attribute chargingEnabledUntil default = 0;
7330+
callback attribute dischargingEnabledUntil default = 0;
7331+
callback attribute circuitCapacity default = 0;
7332+
callback attribute minimumChargeCurrent default = 6000;
7333+
callback attribute maximumChargeCurrent default = 0;
7334+
callback attribute maximumDischargeCurrent default = 0;
7335+
callback attribute userMaximumChargeCurrent default = 0;
7336+
callback attribute randomizationDelayWindow default = 600;
7337+
callback attribute numberOfWeeklyTargets default = 0;
7338+
callback attribute numberOfDailyTargets default = 1;
7339+
callback attribute nextChargeStartTime;
7340+
callback attribute nextChargeTargetTime;
7341+
callback attribute nextChargeRequiredEnergy;
7342+
callback attribute nextChargeTargetSoC;
7343+
callback attribute approximateEVEfficiency default = 0xFFFF;
7344+
callback attribute stateOfCharge;
7345+
callback attribute batteryCapacity;
7346+
callback attribute vehicleID;
7347+
callback attribute sessionID;
7348+
callback attribute sessionDuration;
7349+
callback attribute sessionEnergyCharged;
7350+
callback attribute sessionEnergyDischarged;
7351+
callback attribute generatedCommandList;
7352+
callback attribute acceptedCommandList;
7353+
callback attribute eventList;
7354+
callback attribute attributeList;
7355+
ram attribute featureMap default = 0;
7356+
ram attribute clusterRevision default = 2;
7357+
}
7358+
71447359
server cluster WindowCovering {
71457360
ram attribute type default = 0x08;
71467361
ram attribute physicalClosedLimitLift default = 0xFFFF;

0 commit comments

Comments
 (0)