From 1306448e87f1aabd9d183b60ad30d7c5b497312d Mon Sep 17 00:00:00 2001 From: jamesharrow <93921463+jamesharrow@users.noreply.github.com> Date: Mon, 18 Dec 2023 20:09:55 +0000 Subject: [PATCH] EVSE and Device Energy Management XML should use new base energy reporting types (and other minor fixes) (#30701) * Fix #30665 (EVSE) - Changed to use amperage_mA, energy_mWh - removed max on epoch_s - removed access for operate - removed side for events * Fix #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). * Aligned EVSE XML to same state as PR#30857 (includes SessionID being Nullable etc and in Fault Event). * Updated Device Energy Management XML to use power_mw, energy_mwh per spec definition. * Updated controller-clusters.zap * regen_all.py * Restyled by whitespace * Fixed types to be signed=true * Fixed 31032 - revert removal of side="server". * regen_all.py * Change to cause restyled to re-run after failure. :( * Revert "Change to cause restyled to re-run after failure. :(" This reverts commit b515c33e8186018c2f437a8d91a0cf80a028467e. --------- Co-authored-by: Restyled.io --- .../chip/device-energy-management-cluster.xml | 30 +++++++++---------- .../data_model/controller-clusters.matter | 30 +++++++++---------- .../zap-generated/attributes/Accessors.cpp | 4 +-- .../zap-generated/attributes/Accessors.h | 4 +-- 4 files changed, 34 insertions(+), 34 deletions(-) diff --git a/src/app/zap-templates/zcl/data-model/chip/device-energy-management-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/device-energy-management-cluster.xml index 10e3af41e4a290..a07ac6d0d505e1 100644 --- a/src/app/zap-templates/zcl/data-model/chip/device-energy-management-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/device-energy-management-cluster.xml @@ -38,14 +38,14 @@ limitations under the License. ESAType ESACanGenerate ESAState - AbsMinPower - AbsMaxPower + AbsMinPower + AbsMaxPower PowerAdjustmentCapability Forecast - + Allows a client to request an adjustment in the power consumption of an ESA for a specified duration. @@ -79,7 +79,7 @@ limitations under the License. PowerAdjustEnd - + Paused @@ -138,8 +138,8 @@ limitations under the License. - - + + @@ -165,28 +165,28 @@ limitations under the License. - - - - + + + + - - + + - + - - + + \ No newline at end of file diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 5a622d7e1820bd..ef27bd2371d0c8 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -4451,13 +4451,13 @@ provisional cluster DeviceEnergyManagement = 152 { elapsed_s minPauseDuration = 6; elapsed_s maxPauseDuration = 7; optional int16u manufacturerESAState = 8; - optional int64s nominalPower = 9; - optional int64s minPower = 10; - optional int64s maxPower = 11; - optional int64s nominalEnergy = 12; + optional power_mw nominalPower = 9; + optional power_mw minPower = 10; + optional power_mw maxPower = 11; + optional energy_mwh nominalEnergy = 12; optional CostStruct costs[] = 13; - optional int64s minPowerAdjustment = 14; - optional int64s maxPowerAdjustment = 15; + optional power_mw minPowerAdjustment = 14; + optional power_mw maxPowerAdjustment = 15; optional elapsed_s minDurationAdjustment = 16; optional elapsed_s maxDurationAdjustment = 17; } @@ -4476,21 +4476,21 @@ provisional cluster DeviceEnergyManagement = 152 { struct ConstraintsStruct { epoch_s startTime = 0; elapsed_s duration = 1; - optional int64s nominalPower = 2; - optional int64s maximumEnergy = 3; + optional power_mw nominalPower = 2; + optional energy_mwh maximumEnergy = 3; optional int8s loadControl = 4; } struct PowerAdjustStruct { - int64s minPower = 0; - int64s maxPower = 1; + power_mw minPower = 0; + power_mw maxPower = 1; elapsed_s minDuration = 2; elapsed_s maxDuration = 3; } struct SlotAdjustmentStruct { int8u slotIndex = 0; - int64s nominalPower = 1; + power_mw nominalPower = 1; elapsed_s duration = 2; } @@ -4500,7 +4500,7 @@ provisional cluster DeviceEnergyManagement = 152 { info event PowerAdjustEnd = 1 { CauseEnum cause = 0; elapsed_s duration = 1; - int64s energyUse = 2; + energy_mwh energyUse = 2; } info event Paused = 2 { @@ -4512,8 +4512,8 @@ provisional cluster DeviceEnergyManagement = 152 { readonly attribute ESATypeEnum ESAType = 0; readonly attribute boolean ESACanGenerate = 1; readonly attribute ESAStateEnum ESAState = 2; - readonly attribute int64s absMinPower = 3; - readonly attribute int64s absMaxPower = 4; + readonly attribute power_mw absMinPower = 3; + readonly attribute power_mw absMaxPower = 4; readonly attribute optional nullable PowerAdjustStruct powerAdjustmentCapability[] = 5; readonly attribute optional nullable ForecastStruct forecast = 6; readonly attribute command_id generatedCommandList[] = 65528; @@ -4524,7 +4524,7 @@ provisional cluster DeviceEnergyManagement = 152 { readonly attribute int16u clusterRevision = 65533; request struct PowerAdjustRequestRequest { - int64s power = 0; + power_mw power = 0; elapsed_s duration = 1; } diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp index 18d8e98210b5e8..77c7512374fa94 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp @@ -10450,7 +10450,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, int64_t value) Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::DeviceEnergyManagement::Id, Id, writable, ZCL_INT64S_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::DeviceEnergyManagement::Id, Id, writable, ZCL_POWER_MW_ATTRIBUTE_TYPE); } } // namespace AbsMinPower @@ -10481,7 +10481,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, int64_t value) Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::DeviceEnergyManagement::Id, Id, writable, ZCL_INT64S_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::DeviceEnergyManagement::Id, Id, writable, ZCL_POWER_MW_ATTRIBUTE_TYPE); } } // namespace AbsMaxPower diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h index 343be821fea273..2fdeaa1fdc71e7 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h @@ -2024,12 +2024,12 @@ EmberAfStatus Set(chip::EndpointId endpoint, chip::app::Clusters::DeviceEnergyMa } // namespace ESAState namespace AbsMinPower { -EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // int64s +EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // power_mw EmberAfStatus Set(chip::EndpointId endpoint, int64_t value); } // namespace AbsMinPower namespace AbsMaxPower { -EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // int64s +EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // power_mw EmberAfStatus Set(chip::EndpointId endpoint, int64_t value); } // namespace AbsMaxPower