Update device-energy-management-cluster.xml based on latest cluster spec (#33771)
* Update device-energy-management-cluster.xml based on latest cluster spec and regenerate zap files
* Restyled by clang-format
* Address comments from Boris Zbarsky
* Address some further useful comments from Boris Zbarsky
* Restyled by clang-format
* Merge from master and regenerate zap files
---------
Co-authored-by: Restyled.io <commits@restyled.io>
diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter
index f021948..0a90e6e 100644
--- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter
+++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter
@@ -4069,7 +4069,7 @@
/** This cluster allows a client to manage the power draw of a device. An example of such a client could be an Energy Management System (EMS) which controls an Energy Smart Appliance (ESA). */
provisional cluster DeviceEnergyManagement = 152 {
- revision 3;
+ revision 4;
enum AdjustmentCauseEnum : enum8 {
kLocalOptimization = 0;
@@ -4130,6 +4130,12 @@
kOptOut = 3;
}
+ enum PowerAdjustReasonEnum : enum8 {
+ kNoAdjustment = 0;
+ kLocalOptimizationAdjustment = 1;
+ kGridOptimizationAdjustment = 2;
+ }
+
bitmap Feature : bitmap32 {
kPowerAdjustment = 0x1;
kPowerForecastReporting = 0x2;
@@ -4147,13 +4153,25 @@
optional int16u currency = 3;
}
+ struct PowerAdjustStruct {
+ power_mw minPower = 0;
+ power_mw maxPower = 1;
+ elapsed_s minDuration = 2;
+ elapsed_s maxDuration = 3;
+ }
+
+ struct PowerAdjustCapabilityStruct {
+ nullable PowerAdjustStruct powerAdjustCapability[] = 0;
+ PowerAdjustReasonEnum cause = 1;
+ }
+
struct SlotStruct {
elapsed_s minDuration = 0;
elapsed_s maxDuration = 1;
elapsed_s defaultDuration = 2;
elapsed_s elapsedSlotTime = 3;
elapsed_s remainingSlotTime = 4;
- optional boolean slotIsPauseable = 5;
+ optional boolean slotIsPausable = 5;
optional elapsed_s minPauseDuration = 6;
optional elapsed_s maxPauseDuration = 7;
optional int16u manufacturerESAState = 8;
@@ -4169,13 +4187,13 @@
}
struct ForecastStruct {
- int16u forecastId = 0;
+ int32u forecastID = 0;
nullable int16u activeSlotNumber = 1;
epoch_s startTime = 2;
epoch_s endTime = 3;
optional nullable epoch_s earliestStartTime = 4;
optional epoch_s latestEndTime = 5;
- boolean isPauseable = 6;
+ boolean isPausable = 6;
SlotStruct slots[] = 7;
ForecastUpdateReasonEnum forecastUpdateReason = 8;
}
@@ -4188,16 +4206,9 @@
optional int8s loadControl = 4;
}
- struct PowerAdjustStruct {
- power_mw minPower = 0;
- power_mw maxPower = 1;
- elapsed_s minDuration = 2;
- elapsed_s maxDuration = 3;
- }
-
struct SlotAdjustmentStruct {
int8u slotIndex = 0;
- power_mw nominalPower = 1;
+ optional power_mw nominalPower = 1;
elapsed_s duration = 2;
}
@@ -4222,7 +4233,7 @@
readonly attribute ESAStateEnum ESAState = 2;
readonly attribute power_mw absMinPower = 3;
readonly attribute power_mw absMaxPower = 4;
- readonly attribute optional nullable PowerAdjustStruct powerAdjustmentCapability[] = 5;
+ readonly attribute optional nullable PowerAdjustCapabilityStruct powerAdjustmentCapability = 5;
readonly attribute optional nullable ForecastStruct forecast = 6;
readonly attribute optional OptOutStateEnum optOutState = 7;
readonly attribute command_id generatedCommandList[] = 65528;
@@ -4249,7 +4260,7 @@
}
request struct ModifyForecastRequestRequest {
- int32u forecastId = 0;
+ int32u forecastID = 0;
SlotAdjustmentStruct slotAdjustments[] = 1;
AdjustmentCauseEnum cause = 2;
}
diff --git a/examples/energy-management-app/energy-management-common/energy-management-app.matter b/examples/energy-management-app/energy-management-common/energy-management-app.matter
index af0d316..a5c23df 100644
--- a/examples/energy-management-app/energy-management-common/energy-management-app.matter
+++ b/examples/energy-management-app/energy-management-common/energy-management-app.matter
@@ -1430,7 +1430,7 @@
/** This cluster allows a client to manage the power draw of a device. An example of such a client could be an Energy Management System (EMS) which controls an Energy Smart Appliance (ESA). */
provisional cluster DeviceEnergyManagement = 152 {
- revision 3;
+ revision 4;
enum AdjustmentCauseEnum : enum8 {
kLocalOptimization = 0;
@@ -1491,6 +1491,12 @@
kOptOut = 3;
}
+ enum PowerAdjustReasonEnum : enum8 {
+ kNoAdjustment = 0;
+ kLocalOptimizationAdjustment = 1;
+ kGridOptimizationAdjustment = 2;
+ }
+
bitmap Feature : bitmap32 {
kPowerAdjustment = 0x1;
kPowerForecastReporting = 0x2;
@@ -1508,13 +1514,25 @@
optional int16u currency = 3;
}
+ struct PowerAdjustStruct {
+ power_mw minPower = 0;
+ power_mw maxPower = 1;
+ elapsed_s minDuration = 2;
+ elapsed_s maxDuration = 3;
+ }
+
+ struct PowerAdjustCapabilityStruct {
+ nullable PowerAdjustStruct powerAdjustCapability[] = 0;
+ PowerAdjustReasonEnum cause = 1;
+ }
+
struct SlotStruct {
elapsed_s minDuration = 0;
elapsed_s maxDuration = 1;
elapsed_s defaultDuration = 2;
elapsed_s elapsedSlotTime = 3;
elapsed_s remainingSlotTime = 4;
- optional boolean slotIsPauseable = 5;
+ optional boolean slotIsPausable = 5;
optional elapsed_s minPauseDuration = 6;
optional elapsed_s maxPauseDuration = 7;
optional int16u manufacturerESAState = 8;
@@ -1530,13 +1548,13 @@
}
struct ForecastStruct {
- int16u forecastId = 0;
+ int32u forecastID = 0;
nullable int16u activeSlotNumber = 1;
epoch_s startTime = 2;
epoch_s endTime = 3;
optional nullable epoch_s earliestStartTime = 4;
optional epoch_s latestEndTime = 5;
- boolean isPauseable = 6;
+ boolean isPausable = 6;
SlotStruct slots[] = 7;
ForecastUpdateReasonEnum forecastUpdateReason = 8;
}
@@ -1549,16 +1567,9 @@
optional int8s loadControl = 4;
}
- struct PowerAdjustStruct {
- power_mw minPower = 0;
- power_mw maxPower = 1;
- elapsed_s minDuration = 2;
- elapsed_s maxDuration = 3;
- }
-
struct SlotAdjustmentStruct {
int8u slotIndex = 0;
- power_mw nominalPower = 1;
+ optional power_mw nominalPower = 1;
elapsed_s duration = 2;
}
@@ -1583,7 +1594,7 @@
readonly attribute ESAStateEnum ESAState = 2;
readonly attribute power_mw absMinPower = 3;
readonly attribute power_mw absMaxPower = 4;
- readonly attribute optional nullable PowerAdjustStruct powerAdjustmentCapability[] = 5;
+ readonly attribute optional nullable PowerAdjustCapabilityStruct powerAdjustmentCapability = 5;
readonly attribute optional nullable ForecastStruct forecast = 6;
readonly attribute optional OptOutStateEnum optOutState = 7;
readonly attribute command_id generatedCommandList[] = 65528;
@@ -1610,7 +1621,7 @@
}
request struct ModifyForecastRequestRequest {
- int32u forecastId = 0;
+ int32u forecastID = 0;
SlotAdjustmentStruct slotAdjustments[] = 1;
AdjustmentCauseEnum cause = 2;
}
diff --git a/examples/energy-management-app/energy-management-common/include/DeviceEnergyManagementDelegateImpl.h b/examples/energy-management-app/energy-management-common/include/DeviceEnergyManagementDelegateImpl.h
index a61be0f..1248fc4 100644
--- a/examples/energy-management-app/energy-management-common/include/DeviceEnergyManagementDelegateImpl.h
+++ b/examples/energy-management-app/energy-management-common/include/DeviceEnergyManagementDelegateImpl.h
@@ -69,6 +69,7 @@
virtual CHIP_ERROR SetAbsMaxPower(int64_t) override;
virtual CHIP_ERROR SetPowerAdjustmentCapability(Attributes::PowerAdjustmentCapability::TypeInfo::Type) override;
virtual CHIP_ERROR SetForecast(DataModel::Nullable<Structs::ForecastStruct::Type>) override;
+ virtual CHIP_ERROR SetOptOutState(OptOutStateEnum) override;
private:
ESATypeEnum mEsaType;
diff --git a/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp
index c918d3a..8f122bd 100644
--- a/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp
+++ b/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp
@@ -364,3 +364,8 @@
return CHIP_NO_ERROR;
}
+
+CHIP_ERROR DeviceEnergyManagementDelegate::SetOptOutState(OptOutStateEnum newValue)
+{
+ return CHIP_NO_ERROR;
+}
diff --git a/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h b/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h
index 61932b9..8289394 100644
--- a/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h
+++ b/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h
@@ -1202,7 +1202,7 @@
{ ZAP_EMPTY_DEFAULT(), 0x00000002, 1, ZAP_TYPE(ENUM8), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) }, /* ESAState */ \
{ ZAP_EMPTY_DEFAULT(), 0x00000003, 8, ZAP_TYPE(POWER_MW), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) }, /* AbsMinPower */ \
{ ZAP_EMPTY_DEFAULT(), 0x00000004, 8, ZAP_TYPE(POWER_MW), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) }, /* AbsMaxPower */ \
- { ZAP_EMPTY_DEFAULT(), 0x00000005, 0, ZAP_TYPE(ARRAY), \
+ { ZAP_EMPTY_DEFAULT(), 0x00000005, 0, ZAP_TYPE(STRUCT), \
ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* PowerAdjustmentCapability */ \
{ ZAP_EMPTY_DEFAULT(), 0x00000006, 0, ZAP_TYPE(STRUCT), \
ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* Forecast */ \
diff --git a/src/app/clusters/device-energy-management-server/DeviceEnergyManagementTestEventTriggerHandler.h b/src/app/clusters/device-energy-management-server/DeviceEnergyManagementTestEventTriggerHandler.h
new file mode 100644
index 0000000..fbacf7a
--- /dev/null
+++ b/src/app/clusters/device-energy-management-server/DeviceEnergyManagementTestEventTriggerHandler.h
@@ -0,0 +1,96 @@
+/*
+ *
+ * Copyright (c) 2024 Project CHIP Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <app-common/zap-generated/cluster-objects.h>
+#include <app/TestEventTriggerDelegate.h>
+
+/**
+ * @brief User handler for handling the test event trigger
+ *
+ * @note If TestEventTrigger is enabled, it needs to be implemented in the app
+ *
+ * @param eventTrigger Event trigger to handle
+ *
+ * @retval true on success
+ * @retval false if error happened
+ */
+bool HandleDeviceEnergyManagementTestEventTrigger(uint64_t eventTrigger);
+
+namespace chip {
+
+/*
+ * These Test EventTrigger values can be used to produce artificial DEM forecasts
+ *
+ * They are sent along with the enableKey (manufacturer defined secret)
+ * in the General Diagnostic cluster TestEventTrigger command
+ */
+enum class DeviceEnergyManagementTrigger : uint64_t
+{
+ // Simulate a fixed forecast power usage including one or more PowerAdjustmentStructs
+ kPowerAdjustment = 0x0098'0000'0000'0000,
+ // Clear the PowerAdjustment structs
+ kPowerAdjustmentClear = 0x0098'0000'0000'0001,
+ // Simulate user opt-out of Local Optimization
+ kUserOptOutLocalOptimization = 0x0098'0000'0000'0002,
+ // Simulate user opt-out of Grid Optimization
+ kUserOptOutGridOptimization = 0x0098'0000'0000'0003,
+ // Remove all user opt-out opting out
+ kUserOptOutClearAll = 0x0098'0000'0000'0004,
+ // Simulate a fixed forecast with EarliestStartTime earlier than startTime, and LatestEndTime greater than EndTime
+ kStartTimeAdjustment = 0x0098'0000'0000'0005,
+ // Clear the StartTimeAdjustment simulated forecast
+ kStartTimeAdjustmentClear = 0x0098'0000'0000'0006,
+ // Simulate a fixed forecast with one pausable slo with MinPauseDuration >1, MaxPauseDuration>1 and one non pausable slot
+ kPausable = 0x0098'0000'0000'0007,
+ // Simulate a moving time to the next forecast slot
+ kPausableNextSlot = 0x0098'0000'0000'0008,
+ // Clear the Pausable simulated forecast
+ kPausableClear = 0x0098'0000'0000'0009,
+ // Simulate a forecast power usage with at least 2 and at most 4 slots
+ kForecastAdjustment = 0x0098'0000'0000'000A,
+ // Simulate moving time to the next forecast slot
+ kForecastAdjustmentNextSlot = 0x0098'0000'0000'000B,
+ // Clear the forecast adjustment
+ kForecastAdjustmentClear = 0x0098'0000'0000'000C,
+ // Simulate a forecast power usage with at least 2 and at most 4 slots
+ kConstraintBasedAdjustment = 0x0098'0000'0000'000D,
+ // Clear the constraint based adjustment
+ kConstraintBasedAdjustmentClear = 0x0098'0000'0000'000E,
+ // Simulate a forecast with at least 1 slot
+ kForecast = 0x0098'0000'0000'000F,
+ // Clear the forecast
+ kForecastClear = 0x0098'0000'0000'0010,
+};
+
+class DeviceEnergyManagementTestEventTriggerHandler : public TestEventTriggerHandler
+{
+public:
+ DeviceEnergyManagementTestEventTriggerHandler() {}
+
+ CHIP_ERROR HandleEventTrigger(uint64_t eventTrigger) override
+ {
+ if (HandleDeviceEnergyManagementTestEventTrigger(eventTrigger))
+ {
+ return CHIP_NO_ERROR;
+ }
+ return CHIP_ERROR_INVALID_ARGUMENT;
+ }
+};
+
+} // namespace chip
diff --git a/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp b/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp
index da1fd23..035a3da 100644
--- a/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp
+++ b/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp
@@ -276,7 +276,7 @@
return Status::Success;
case AdjustmentCauseEnum::kLocalOptimization:
default:
- return Status::Failure;
+ return Status::ConstraintError;
}
case OptOutStateEnum::kGridOptOut: /* User has opted out from Grid only */
@@ -287,12 +287,12 @@
return Status::Success;
case AdjustmentCauseEnum::kGridOptimization:
default:
- return Status::Failure;
+ return Status::ConstraintError;
}
case OptOutStateEnum::kOptOut: /* User has opted out from both local and grid */
ChipLogProgress(Zcl, "DEM: OptOutState = kOptOut");
- return Status::Failure;
+ return Status::ConstraintError;
default:
ChipLogError(Zcl, "DEM: invalid optOutState %d", static_cast<int>(optOutState));
@@ -302,15 +302,21 @@
void Instance::HandlePowerAdjustRequest(HandlerContext & ctx, const Commands::PowerAdjustRequest::DecodableType & commandData)
{
- Status status;
bool validArgs = false;
- PowerAdjustmentCapability::TypeInfo::Type powerAdjustmentCapability;
int64_t power = commandData.power;
uint32_t durationSec = commandData.duration;
AdjustmentCauseEnum adjustmentCause = commandData.cause;
- status = CheckOptOutAllowsRequest(adjustmentCause);
+ // Notify the appliance if the appliance hardware cannot be adjusted, then return Failure
+ if (!HasFeature(DeviceEnergyManagement::Feature::kPowerAdjustment))
+ {
+ ChipLogError(Zcl, "PowerAdjust not supported");
+ ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure);
+ return;
+ }
+
+ Status status = CheckOptOutAllowsRequest(adjustmentCause);
if (status != Status::Success)
{
ChipLogError(Zcl, "DEM: PowerAdjustRequest command rejected");
@@ -318,16 +324,24 @@
return;
}
- powerAdjustmentCapability = mDelegate.GetPowerAdjustmentCapability();
- if (powerAdjustmentCapability.IsNull())
+ DataModel::Nullable<Structs::PowerAdjustCapabilityStruct::Type> powerAdjustmentCapabilityStruct =
+ mDelegate.GetPowerAdjustmentCapability();
+ if (powerAdjustmentCapabilityStruct.IsNull())
{
- ChipLogError(Zcl, "DEM: powerAdjustmentCapability IsNull");
+ ChipLogError(Zcl, "DEM: powerAdjustmentCapabilityStruct IsNull");
+ ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError);
+ return;
+ }
+
+ if (powerAdjustmentCapabilityStruct.Value().powerAdjustCapability.IsNull())
+ {
+ ChipLogError(Zcl, "DEM: powerAdjustmentCapabilityStruct.powerAdjustCapability IsNull");
ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError);
return;
}
/* PowerAdjustmentCapability is a list - so iterate through checking if the command is within one of the offers */
- for (auto pas : powerAdjustmentCapability.Value())
+ for (auto pas : powerAdjustmentCapabilityStruct.Value().powerAdjustCapability.Value())
{
if ((power >= pas.minPower) && (durationSec >= pas.minDuration) && (power <= pas.maxPower) &&
(durationSec <= pas.maxDuration))
@@ -358,18 +372,23 @@
void Instance::HandleCancelPowerAdjustRequest(HandlerContext & ctx,
const Commands::CancelPowerAdjustRequest::DecodableType & commandData)
{
- Status status;
+ if (!HasFeature(DeviceEnergyManagement::Feature::kPowerAdjustment))
+ {
+ ChipLogError(Zcl, "PowerAdjust not supported");
+ ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure);
+ return;
+ }
/* Check that the ESA state is PowerAdjustActive */
ESAStateEnum esaStatus = mDelegate.GetESAState();
if (ESAStateEnum::kPowerAdjustActive != esaStatus)
{
ChipLogError(Zcl, "DEM: kPowerAdjustActive != esaStatus");
- ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure);
+ ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::InvalidInState);
return;
}
- status = mDelegate.CancelPowerAdjustRequest();
+ Status status = mDelegate.CancelPowerAdjustRequest();
ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status);
if (status != Status::Success)
{
@@ -492,6 +511,13 @@
CHIP_ERROR err = CHIP_NO_ERROR;
DataModel::Nullable<Structs::ForecastStruct::Type> forecast = mDelegate.GetForecast();
+ if (!HasFeature(DeviceEnergyManagement::Feature::kPausable))
+ {
+ ChipLogError(AppServer, "Pause not supported");
+ ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure);
+ return;
+ }
+
uint32_t duration = commandData.duration;
AdjustmentCauseEnum adjustmentCause = commandData.cause;
@@ -530,10 +556,10 @@
return;
}
- /* We expect that there should be a slotIsPauseable entry (but it is optional) */
- if (!forecast.Value().slots[activeSlotNumber].slotIsPauseable.HasValue())
+ /* We expect that there should be a slotIsPausable entry (but it is optional) */
+ if (!forecast.Value().slots[activeSlotNumber].slotIsPausable.HasValue())
{
- ChipLogError(Zcl, "DEM: activeSlotNumber %d does not include slotIsPauseable.", activeSlotNumber);
+ ChipLogError(Zcl, "DEM: activeSlotNumber %d does not include slotIsPausable.", activeSlotNumber);
ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure);
return;
}
@@ -552,14 +578,14 @@
return;
}
- if (!forecast.Value().slots[activeSlotNumber].slotIsPauseable.Value())
+ if (!forecast.Value().slots[activeSlotNumber].slotIsPausable.Value())
{
- ChipLogError(Zcl, "DEM: activeSlotNumber %d is NOT pauseable.", activeSlotNumber);
+ ChipLogError(Zcl, "DEM: activeSlotNumber %d is NOT pausable.", activeSlotNumber);
ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError);
return;
}
- if ((duration < forecast.Value().slots[activeSlotNumber].minPauseDuration.Value()) &&
+ if ((duration < forecast.Value().slots[activeSlotNumber].minPauseDuration.Value()) ||
(duration > forecast.Value().slots[activeSlotNumber].maxPauseDuration.Value()))
{
ChipLogError(Zcl, "DEM: out of range pause duration %ld", static_cast<long unsigned int>(duration));
@@ -586,7 +612,12 @@
void Instance::HandleResumeRequest(HandlerContext & ctx, const Commands::ResumeRequest::DecodableType & commandData)
{
- Status status;
+ if (!HasFeature(DeviceEnergyManagement::Feature::kPausable))
+ {
+ ChipLogError(AppServer, "Pause not supported");
+ ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure);
+ return;
+ }
if (ESAStateEnum::kPaused != mDelegate.GetESAState())
{
@@ -595,7 +626,7 @@
return;
}
- status = mDelegate.ResumeRequest();
+ Status status = mDelegate.ResumeRequest();
ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status);
if (status != Status::Success)
{
@@ -606,10 +637,17 @@
void Instance::HandleModifyForecastRequest(HandlerContext & ctx, const Commands::ModifyForecastRequest::DecodableType & commandData)
{
+ if (!HasFeature(DeviceEnergyManagement::Feature::kForecastAdjustment))
+ {
+ ChipLogError(Zcl, "ModifyForecast not supported");
+ ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure);
+ return;
+ }
+
Status status;
DataModel::Nullable<Structs::ForecastStruct::Type> forecast;
- uint32_t forecastId = commandData.forecastId;
+ uint32_t forecastID = commandData.forecastID;
DataModel::DecodableList<Structs::SlotAdjustmentStruct::Type> slotAdjustments = commandData.slotAdjustments;
AdjustmentCauseEnum adjustmentCause = commandData.cause;
@@ -629,7 +667,60 @@
return;
}
- status = mDelegate.ModifyForecastRequest(forecastId, slotAdjustments, adjustmentCause);
+ // Check the various values in the slot structures
+ auto iterator = slotAdjustments.begin();
+ while (iterator.Next())
+ {
+ const Structs::SlotAdjustmentStruct::Type & slotAdjustment = iterator.GetValue();
+
+ // Check for an invalid slotIndex
+ if (slotAdjustment.slotIndex > forecast.Value().slots.size())
+ {
+ ChipLogError(Zcl, "DEM: Bad slot index %d", slotAdjustment.slotIndex);
+ ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError);
+ return;
+ }
+
+ // Check to see if trying to modify a slot which has already been run
+ if (!forecast.Value().activeSlotNumber.IsNull() && slotAdjustment.slotIndex < forecast.Value().activeSlotNumber.Value())
+ {
+ ChipLogError(Zcl, "DEM: Modifying already run slot index %d", slotAdjustment.slotIndex);
+ ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError);
+ return;
+ }
+
+ const Structs::SlotStruct::Type & slot = forecast.Value().slots[slotAdjustment.slotIndex];
+
+ // NominalPower is only relevant if PFR is supported
+ if (HasFeature(Feature::kPowerForecastReporting))
+ {
+ if (!slot.minPowerAdjustment.HasValue() || !slot.maxPowerAdjustment.HasValue() ||
+ slotAdjustment.nominalPower.Value() < slot.minPowerAdjustment.Value() ||
+ slotAdjustment.nominalPower.Value() > slot.maxPowerAdjustment.Value())
+ {
+ ChipLogError(Zcl, "DEM: Bad nominalPower");
+ ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError);
+ return;
+ }
+ }
+
+ if (!slot.minDurationAdjustment.HasValue() || !slot.maxDurationAdjustment.HasValue() ||
+ slotAdjustment.duration < slot.minDurationAdjustment.Value() ||
+ slotAdjustment.duration > slot.maxDurationAdjustment.Value())
+ {
+ ChipLogError(Zcl, "DEM: Bad min/max duration");
+ ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError);
+ return;
+ }
+ }
+
+ if (iterator.GetStatus() != CHIP_NO_ERROR)
+ {
+ ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::InvalidCommand);
+ return;
+ }
+
+ status = mDelegate.ModifyForecastRequest(forecastID, slotAdjustments, adjustmentCause);
ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status);
if (status != Status::Success)
{
@@ -641,7 +732,14 @@
void Instance::HandleRequestConstraintBasedForecast(HandlerContext & ctx,
const Commands::RequestConstraintBasedForecast::DecodableType & commandData)
{
- Status status;
+ if (!HasFeature(DeviceEnergyManagement::Feature::kConstraintBasedAdjustment))
+ {
+ ChipLogError(AppServer, "RequestConstraintBasedForecast CON not supported");
+ ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure);
+ return;
+ }
+
+ Status status = Status::Success;
DataModel::DecodableList<Structs::ConstraintsStruct::DecodableType> constraints = commandData.constraints;
AdjustmentCauseEnum adjustmentCause = commandData.cause;
@@ -654,6 +752,115 @@
return;
}
+ uint32_t currentUtcTime = 0;
+ status = GetMatterEpochTimeFromUnixTime(currentUtcTime);
+ if (status != Status::Success)
+ {
+ ChipLogError(Zcl, "DEM: Failed to get UTC time");
+ ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status);
+ return;
+ }
+
+ // Check for invalid power levels and whether the constraint time/duration is in the past
+ {
+ auto iterator = constraints.begin();
+ if (iterator.Next())
+ {
+ const Structs::ConstraintsStruct::DecodableType & constraint = iterator.GetValue();
+
+ // Check to see if this constraint is in the past
+ if (constraint.startTime < currentUtcTime)
+ {
+ ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError);
+ return;
+ }
+
+ if (HasFeature(Feature::kPowerForecastReporting))
+ {
+ if (!constraint.nominalPower.HasValue())
+ {
+ ChipLogError(Zcl, "DEM: RequestConstraintBasedForecast no nominalPower");
+ ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::InvalidCommand);
+ return;
+ }
+
+ if (constraint.nominalPower.Value() < mDelegate.GetAbsMinPower() ||
+ constraint.nominalPower.Value() > mDelegate.GetAbsMaxPower())
+ {
+ ChipLogError(Zcl,
+ "DEM: RequestConstraintBasedForecast nominalPower " ChipLogFormatX64
+ " out of range [" ChipLogFormatX64 ", " ChipLogFormatX64 "]",
+ ChipLogValueX64(constraint.nominalPower.Value()), ChipLogValueX64(mDelegate.GetAbsMinPower()),
+ ChipLogValueX64(mDelegate.GetAbsMaxPower()));
+
+ ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError);
+ return;
+ }
+
+ if (!constraint.maximumEnergy.HasValue())
+ {
+ ChipLogError(Zcl, "DEM: RequestConstraintBasedForecast no value for maximumEnergy");
+ ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::InvalidCommand);
+ return;
+ }
+ }
+
+ if (HasFeature(Feature::kStateForecastReporting))
+ {
+ if (!constraint.loadControl.HasValue())
+ {
+ ChipLogError(Zcl, "DEM: RequestConstraintBasedForecast no loadControl");
+ ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::InvalidCommand);
+ return;
+ }
+
+ if (constraint.loadControl.Value() < -100 || constraint.loadControl.Value() > 100)
+ {
+ ChipLogError(Zcl, "DEM: RequestConstraintBasedForecast bad loadControl %d", constraint.loadControl.Value());
+ ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError);
+ return;
+ }
+ }
+ }
+
+ if (iterator.GetStatus() != CHIP_NO_ERROR)
+ {
+ ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::InvalidCommand);
+ return;
+ }
+ }
+
+ // Check for overlappping elements
+ {
+ auto iterator = constraints.begin();
+ if (iterator.Next())
+ {
+ // Get the first constraint
+ Structs::ConstraintsStruct::DecodableType prevConstraint = iterator.GetValue();
+
+ // Start comparing next vs prev constraints
+ while (iterator.Next())
+ {
+ const Structs::ConstraintsStruct::DecodableType & constraint = iterator.GetValue();
+ if (constraint.startTime < prevConstraint.startTime ||
+ prevConstraint.startTime + prevConstraint.duration >= constraint.startTime)
+ {
+ ChipLogError(Zcl, "DEM: RequestConstraintBasedForecast overlapping constraint times");
+ ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError);
+ return;
+ }
+
+ prevConstraint = constraint;
+ }
+ }
+
+ if (iterator.GetStatus() != CHIP_NO_ERROR)
+ {
+ ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::InvalidCommand);
+ return;
+ }
+ }
+
status = mDelegate.RequestConstraintBasedForecast(constraints, adjustmentCause);
ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status);
if (status != Status::Success)
@@ -665,15 +872,47 @@
void Instance::HandleCancelRequest(HandlerContext & ctx, const Commands::CancelRequest::DecodableType & commandData)
{
- Status status;
+ Status status = Status::Failure;
+ DataModel::Nullable<Structs::ForecastStruct::Type> forecast = mDelegate.GetForecast();
- status = mDelegate.CancelRequest();
- ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status);
- if (status != Status::Success)
+ if (forecast.IsNull())
{
- ChipLogError(Zcl, "DEM: CancelRequest FAILURE");
- return;
+ ChipLogDetail(AppServer, "Cancelling on a Null forecast!");
+ status = Status::Failure;
}
+ else if (forecast.Value().forecastUpdateReason == ForecastUpdateReasonEnum::kInternalOptimization)
+ {
+ ChipLogDetail(AppServer, "Bad Cancel when ESA ForecastUpdateReason was already Internal Optimization!");
+ status = Status::InvalidInState;
+ }
+ else
+ {
+ status = mDelegate.CancelRequest();
+ }
+
+ ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status);
+}
+
+Status Instance::GetMatterEpochTimeFromUnixTime(uint32_t & currentUtcTime) const
+{
+ currentUtcTime = 0;
+ System::Clock::Milliseconds64 cTMs;
+
+ CHIP_ERROR err = System::SystemClock().GetClock_RealTimeMS(cTMs);
+ if (err != CHIP_NO_ERROR)
+ {
+ ChipLogError(Zcl, "DEM: Unable to get current time - err:%" CHIP_ERROR_FORMAT, err.Format());
+ return Status::Failure;
+ }
+
+ auto unixEpoch = std::chrono::duration_cast<System::Clock::Seconds32>(cTMs).count();
+ if (!UnixEpochToChipEpochTime(unixEpoch, currentUtcTime))
+ {
+ ChipLogError(Zcl, "DEM: unable to convert Unix Epoch time to Matter Epoch Time");
+ return Status::Failure;
+ }
+
+ return Status::Success;
}
} // namespace DeviceEnergyManagement
diff --git a/src/app/clusters/device-energy-management-server/device-energy-management-server.h b/src/app/clusters/device-energy-management-server/device-energy-management-server.h
index 2f09dad..b0d27b0 100644
--- a/src/app/clusters/device-energy-management-server/device-energy-management-server.h
+++ b/src/app/clusters/device-energy-management-server/device-energy-management-server.h
@@ -61,7 +61,7 @@
virtual Protocols::InteractionModel::Status CancelPowerAdjustRequest() = 0;
/**
- * @brief Delegate for the ESA SHALL update its Forecast attribute with the RequestedStartTime including a new ForecastId.
+ * @brief Delegate for the ESA SHALL update its Forecast attribute with the RequestedStartTime including a new ForecastID.
*
* If the ESA supports ForecastAdjustment, and the ESAState is not UserOptOut and the RequestedStartTime is after
* the EarliestStartTime and the resulting EndTime is before the LatestEndTime, then ESA SHALL accept the request
@@ -71,6 +71,8 @@
*
* @param requestedStartTime The requested start time in UTC that the client would like the appliance to shift its power
* forecast to.
+ * @param cause Who (Grid/local) is triggering this change.
+ *
* @return Success if the StartTime in the Forecast is updated, otherwise the command SHALL be rejected with appropriate
* IM_Status.
*/
@@ -109,16 +111,16 @@
* If the ESA supports FA, and the ESAState is not UserOptOut it SHALL attempt to adjust its power forecast.
* This allows a one or more modifications in a single command by sending a list of modifications (one for each 'slot').
* Attempts to modify slots which have already past, SHALL result in the entire command being rejected.
- * If the ESA accepts the requested Forecast then it SHALL update its Forecast attribute (incrementing its ForecastId)
+ * If the ESA accepts the requested Forecast then it SHALL update its Forecast attribute (incrementing its ForecastID)
* and run the revised Forecast as its new intended operation.
*
- * @param forecastId Indicates the ESA ForecastId that is to be modified.
- * @param slotAdjustments List of adjustments to be applied to the ESA, corresponding to the expected ESA forecastId.
+ * @param forecastID Indicates the ESA ForecastID that is to be modified.
+ * @param slotAdjustments List of adjustments to be applied to the ESA, corresponding to the expected ESA forecastID.
* @return Success if the entire list of SlotAdjustmentStruct are accepted, otherwise the command
* SHALL be rejected returning other IM_Status.
*/
virtual Protocols::InteractionModel::Status
- ModifyForecastRequest(const uint32_t forecastId,
+ ModifyForecastRequest(const uint32_t forecastID,
const DataModel::DecodableList<Structs::SlotAdjustmentStruct::Type> & slotAdjustments,
AdjustmentCauseEnum cause) = 0;
@@ -128,7 +130,7 @@
* The ESA SHALL inspect the requested power limits to ensure that there are no overlapping elements. The ESA
* manufacturer may also reject the request if it could cause the user’s preferences to be breached (e.g. may
* cause the home to be too hot or too cold, or a battery to be insufficiently charged).
- * If the ESA can meet the requested power limits, it SHALL regenerate a new Power Forecast with a new ForecastId.
+ * If the ESA can meet the requested power limits, it SHALL regenerate a new Power Forecast with a new ForecastID.
*
* @param constraints Sequence of turn up/down power requests that the ESA is being asked to constrain its operation within.
* @return Success if successful, otherwise the command SHALL be rejected returning other IM_Status.
@@ -158,24 +160,25 @@
// ------------------------------------------------------------------
// Get attribute methods
- virtual ESATypeEnum GetESAType() = 0;
- virtual bool GetESACanGenerate() = 0;
- virtual ESAStateEnum GetESAState() = 0;
- virtual int64_t GetAbsMinPower() = 0;
- virtual int64_t GetAbsMaxPower() = 0;
- virtual Attributes::PowerAdjustmentCapability::TypeInfo::Type GetPowerAdjustmentCapability() = 0;
- virtual DataModel::Nullable<Structs::ForecastStruct::Type> GetForecast() = 0;
- virtual OptOutStateEnum GetOptOutState() = 0;
+ virtual ESATypeEnum GetESAType() = 0;
+ virtual bool GetESACanGenerate() = 0;
+ virtual ESAStateEnum GetESAState() = 0;
+ virtual int64_t GetAbsMinPower() = 0;
+ virtual int64_t GetAbsMaxPower() = 0;
+ virtual DataModel::Nullable<Structs::PowerAdjustCapabilityStruct::Type> GetPowerAdjustmentCapability() = 0;
+ virtual DataModel::Nullable<Structs::ForecastStruct::Type> GetForecast() = 0;
+ virtual OptOutStateEnum GetOptOutState() = 0;
// ------------------------------------------------------------------
// Set attribute methods
- virtual CHIP_ERROR SetESAType(ESATypeEnum) = 0;
- virtual CHIP_ERROR SetESACanGenerate(bool) = 0;
- virtual CHIP_ERROR SetESAState(ESAStateEnum) = 0;
- virtual CHIP_ERROR SetAbsMinPower(int64_t) = 0;
- virtual CHIP_ERROR SetAbsMaxPower(int64_t) = 0;
- virtual CHIP_ERROR SetPowerAdjustmentCapability(Attributes::PowerAdjustmentCapability::TypeInfo::Type) = 0;
- virtual CHIP_ERROR SetForecast(DataModel::Nullable<Structs::ForecastStruct::Type>) = 0;
+ virtual CHIP_ERROR SetESAType(ESATypeEnum) = 0;
+ virtual CHIP_ERROR SetESACanGenerate(bool) = 0;
+ virtual CHIP_ERROR SetESAState(ESAStateEnum) = 0;
+ virtual CHIP_ERROR SetAbsMinPower(int64_t) = 0;
+ virtual CHIP_ERROR SetAbsMaxPower(int64_t) = 0;
+ virtual CHIP_ERROR SetPowerAdjustmentCapability(DataModel::Nullable<Structs::PowerAdjustCapabilityStruct::Type>) = 0;
+ virtual CHIP_ERROR SetForecast(DataModel::Nullable<Structs::ForecastStruct::Type>) = 0;
+ virtual CHIP_ERROR SetOptOutState(OptOutStateEnum) = 0;
protected:
EndpointId mEndpointId = 0;
@@ -200,6 +203,9 @@
bool HasFeature(Feature aFeature) const;
private:
+ Protocols::InteractionModel::Status GetMatterEpochTimeFromUnixTime(uint32_t & currentUtcTime) const;
+
+private:
Delegate & mDelegate;
BitMask<Feature> mFeature;
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 3f921f4..b087f3c 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
@@ -16,8 +16,6 @@
-->
<configurator>
<domain name="Energy Management"/>
-
-
<cluster apiMaturity="provisional">
<name>Device Energy Management</name>
<domain>Energy Management</domain>
@@ -26,139 +24,133 @@
<client init="false" tick="false">true</client>
<server init="false" tick="false">true</server>
<description>This cluster allows a client to manage the power draw of a device. An example of such a client could be an Energy Management System (EMS) which controls an Energy Smart Appliance (ESA).</description>
- <globalAttribute side="either" code="0xFFFD" value="3"/>
-
+ <globalAttribute side="either" code="0xFFFD" value="4"/>
<features>
<feature bit="0" code="PA" name="PowerAdjustment" summary="Allows an EMS to make a temporary power
- adjustment (within the limits offered by the ESA).">
- <optionalConform choice="a" more="true"/>
+adjustment (within the limits offered by the ESA).">
+ <optionalConform/>
</feature>
<feature bit="1" code="PFR" name="PowerForecastReporting" summary="Allows an ESA to advertise its indicative
- future power consumption vs time.">
+future power consumption vs time.">
<otherwiseConform>
+ <optionalConform choice="a">
+ <notTerm>
+ <feature name="PA"/>
+ </notTerm>
+ </optionalConform>
<mandatoryConform>
- <andTerm>
- <orTerm>
- <feature name="STA"/>
- <feature name="PAU"/>
- <feature name="FA"/>
- <feature name="CON"/>
- </orTerm>
- <notTerm>
- <feature name="SFR"/>
- </notTerm>
- </andTerm>
+ <orTerm>
+ <feature name="STA"/>
+ <feature name="PAU"/>
+ <feature name="FA"/>
+ <feature name="CON"/>
+ </orTerm>
</mandatoryConform>
- <optionalConform choice="a" more="true"/>
+ <optionalConform/>
</otherwiseConform>
</feature>
<feature bit="2" code="SFR" name="StateForecastReporting" summary="Allows an ESA to advertise its indicative
- future state vs time.">
- <otherwiseConform>
- <mandatoryConform>
- <andTerm>
- <orTerm>
- <feature name="STA"/>
- <feature name="PAU"/>
- <feature name="FA"/>
- <feature name="CON"/>
- </orTerm>
- <notTerm>
- <feature name="PFR"/>
- </notTerm>
- </andTerm>
- </mandatoryConform>
- <optionalConform choice="a" more="true"/>
- </otherwiseConform>
+future state vs time.">
+ <optionalConform choice="a">
+ <notTerm>
+ <feature name="PA"/>
+ </notTerm>
+ </optionalConform>
</feature>
- <feature bit="3" code="STA" name="StartTimeAdjustment" summary="Allows an EMS to delay an ESA's
- planned operation.">
- <optionalConform choice="a" more="true"/>
+ <feature bit="3" code="STA" name="StartTimeAdjustment" summary="Allows an EMS to delay an ESA's
+planned operation.">
+ <optionalConform/>
</feature>
- <feature bit="4" code="PAU" name="Pausable" summary="Allows an EMS to pause an ESA's
- planned operation.">
- <optionalConform choice="a" more="true"/>
+ <feature bit="4" code="PAU" name="Pausable" summary="Allows an EMS to pause an ESA's
+planned operation.">
+ <optionalConform/>
</feature>
- <feature bit="5" code="FA" name="ForecastAdjustment" summary="Allows an EMS to adjust an ESA's
- planned operation.">
- <otherwiseConform>
- <provisionalConform/>
- <optionalConform choice="a" more="true"/>
- </otherwiseConform>
+ <feature bit="5" code="FA" name="ForecastAdjustment" summary="Allows an EMS to adjust an ESA's
+planned operation.">
+ <optionalConform/>
</feature>
- <feature bit="6" code="CON" name="ConstraintBasedAdjustment" summary="Allows an EMS to request constraints to an ESA's
- planned operation.">
- <otherwiseConform>
- <provisionalConform/>
- <optionalConform choice="a" more="true"/>
- </otherwiseConform>
+ <feature bit="6" code="CON" name="ConstraintBasedAdjustment" summary="Allows an EMS to request constraints to an ESA's
+planned operation.">
+ <optionalConform/>
</feature>
</features>
-
<!--Attributes-->
- <attribute code="0x0000" side="server" type="ESATypeEnum" define="ESA_TYPE" writable="false" optional="false" min="0x00" max="0xFF" default="0xFF">ESAType</attribute>
- <attribute code="0x0001" side="server" type="boolean" define="ESA_CAN_GENERATE" writable="false" optional="false" default="0">ESACanGenerate</attribute>
- <attribute code="0x0002" side="server" type="ESAStateEnum" define="ESA_STATE" default="0x00" writable="false" optional="false" min="0x00" max="0x04">ESAState</attribute>
- <attribute code="0x0003" side="server" type="power_mw" define="ABS_MIN_POWER" default="0" writable="false" optional="false">AbsMinPower</attribute>
- <attribute code="0x0004" side="server" type="power_mw" define="ABS_MAX_POWER" default="0" writable="false" optional="false">AbsMaxPower</attribute>
+ <attribute code="0x0000" side="server" type="ESATypeEnum" define="ESA_TYPE" min="0x00" max="0xFF" default="0xFF">ESAType</attribute>
+ <attribute code="0x0001" side="server" type="boolean" define="ESA_CAN_GENERATE" default="0">ESACanGenerate</attribute>
+ <attribute code="0x0002" side="server" type="ESAStateEnum" define="ESA_STATE" default="0x00" min="0x00" max="0x04">ESAState</attribute>
+ <attribute code="0x0003" side="server" type="power_mw" define="ABS_MIN_POWER" default="0">AbsMinPower</attribute>
+ <attribute code="0x0004" side="server" type="power_mw" define="ABS_MAX_POWER" default="0">AbsMaxPower</attribute>
<!--Conformance feature PA - for now optional-->
- <attribute code="0x0005" side="server" type="array" entryType="PowerAdjustStruct" define="POWER_ADJUSTMENT_CAPABILITY" isNullable="true" writable="false" optional="true" length="8">PowerAdjustmentCapability</attribute>
+ <attribute code="0x0005" side="server" type="PowerAdjustCapabilityStruct" define="POWER_ADJUSTMENT_CAPABILITY" isNullable="true" optional="true">PowerAdjustmentCapability</attribute>
<!--Conformance feature PFR \| SFR - for now optional-->
- <attribute code="0x0006" side="server" type="ForecastStruct" define="FORECAST" isNullable="true" writable="false" optional="true">Forecast</attribute>
- <attribute code="0x0007" side="server" type="OptOutStateEnum" define="OPT_OUT_STATE" min="0x00" max="0x03" default="0x00" writable="false" optional="true">OptOutState</attribute>
+ <attribute code="0x0006" side="server" type="ForecastStruct" define="FORECAST" isNullable="true" optional="true">Forecast</attribute>
+ <attribute code="0x0007" side="server" type="OptOutStateEnum" define="OPT_OUT_STATE" min="0x00" max="0x03" default="0x00" optional="true">OptOutState</attribute>
<command source="client" code="0x00" name="PowerAdjustRequest" optional="true" apiMaturity="provisional">
<description>Allows a client to request an adjustment in the power consumption of an ESA for a specified duration.</description>
- <arg name="Power" type="power_mw"/>
- <arg name="Duration" type="elapsed_s"/>
- <arg name="Cause" type="AdjustmentCauseEnum" min="0x00" max="0x01"/>
+ <arg id="0" name="Power" type="power_mw"/>
+ <arg id="1" name="Duration" type="elapsed_s"/>
+ <arg id="2" name="Cause" type="AdjustmentCauseEnum" min="0x00" max="0x01"/>
</command>
+
<command source="client" code="0x01" name="CancelPowerAdjustRequest" optional="true" apiMaturity="provisional">
<description>Allows a client to cancel an ongoing PowerAdjustmentRequest operation.</description>
</command>
+
<command source="client" code="0x02" name="StartTimeAdjustRequest" optional="true" apiMaturity="provisional">
<description>Allows a client to adjust the start time of a Forecast sequence that has not yet started operation (i.e. where the current Forecast StartTime is in the future).</description>
- <arg name="RequestedStartTime" type="epoch_s"/>
- <arg name="Cause" type="AdjustmentCauseEnum" min="0x00" max="0x01"/>
+ <arg id="0" name="RequestedStartTime" type="epoch_s"/>
+ <arg id="1" name="Cause" type="AdjustmentCauseEnum" min="0x00" max="0x01"/>
</command>
+
<command source="client" code="0x03" name="PauseRequest" optional="true" apiMaturity="provisional">
<description>Allows a client to temporarily pause an operation and reduce the ESAs energy demand.</description>
- <arg name="Duration" type="elapsed_s"/>
- <arg name="Cause" type="AdjustmentCauseEnum" min="0x00" max="0x01"/>
+ <arg id="0" name="Duration" type="elapsed_s"/>
+ <arg id="1" name="Cause" type="AdjustmentCauseEnum" min="0x00" max="0x01"/>
</command>
+
<command source="client" code="0x04" name="ResumeRequest" optional="true" apiMaturity="provisional">
<description>Allows a client to cancel the PauseRequest command and enable earlier resumption of operation.</description>
</command>
+
<command source="client" code="0x05" name="ModifyForecastRequest" optional="true" apiMaturity="provisional">
<description>Allows a client to modify a Forecast within the limits allowed by the ESA.</description>
- <arg name="ForecastId" type="int32u"/>
- <arg name="SlotAdjustments" array="true" type="SlotAdjustmentStruct" length="10"/>
- <arg name="Cause" type="AdjustmentCauseEnum" min="0x00" max="0x01"/>
+ <arg id="0" name="ForecastID" type="int32u"/>
+ <arg id="1" name="SlotAdjustments" array="true" type="SlotAdjustmentStruct" length="10"/>
+ <arg id="2" name="Cause" type="AdjustmentCauseEnum" min="0x00" max="0x01"/>
</command>
+
<command source="client" code="0x06" name="RequestConstraintBasedForecast" optional="true" apiMaturity="provisional">
<description>Allows a client to ask the ESA to recompute its Forecast based on power and time constraints.</description>
- <arg name="Constraints" array="true" type="ConstraintsStruct" length="10"/>
- <arg name="Cause" type="AdjustmentCauseEnum" min="0x00" max="0x01"/>
+ <arg id="0" name="Constraints" array="true" type="ConstraintsStruct" length="10"/>
+ <arg id="1" name="Cause" type="AdjustmentCauseEnum" min="0x00" max="0x01"/>
</command>
+
<command source="client" code="0x07" name="CancelRequest" optional="true">
<description>Allows a client to request cancellation of a previous adjustment request in a StartTimeAdjustRequest, ModifyForecastRequest or RequestConstraintBasedForecast command</description>
</command>
+
<event code="0x00" name="PowerAdjustStart" priority="info" side="server" apiMaturity="provisional" optional="true">
<description>PowerAdjustStart</description>
</event>
+
<event code="0x01" name="PowerAdjustEnd" priority="info" side="server" apiMaturity="provisional" optional="true">
<description>PowerAdjustEnd</description>
<field id="0" name="Cause" type="CauseEnum" apiMaturity="provisional" default="0x00" min="0x00" max="0x04"/>
<field id="1" name="Duration" type="elapsed_s" apiMaturity="provisional"/>
<field id="2" name="EnergyUse" type="energy_mwh" apiMaturity="provisional"/>
</event>
+
<event code="0x02" name="Paused" priority="info" side="server" apiMaturity="provisional" optional="true">
<description>Paused</description>
</event>
+
<event code="0x03" name="Resumed" priority="info" side="server" apiMaturity="provisional" optional="true">
<description>Resumed</description>
<field id="0" name="Cause" type="CauseEnum" apiMaturity="provisional" default="0x00" min="0x00" max="0x04"/>
</event>
+
</cluster>
+
<enum name="CostTypeEnum" type="enum8" apiMaturity="provisional">
<cluster code="0x0098"/>
<item name="Financial" value="0x00"/>
@@ -225,6 +217,13 @@
<item name="OptOut" value="0x03"/>
</enum>
+ <enum name="PowerAdjustReasonEnum" type="enum8">
+ <cluster code="0x0098"/>
+ <item name="NoAdjustment" value="0x00"/>
+ <item name="LocalOptimizationAdjustment" value="0x01"/>
+ <item name="GridOptimizationAdjustment" value="0x02"/>
+ </enum>
+
<struct name="CostStruct" apiMaturity="provisional">
<cluster code="0x0098"/>
<item fieldId="0" name="CostType" type="CostTypeEnum" default="0x00" min="0x00" max="0x03"/>
@@ -233,6 +232,12 @@
<item fieldId="3" name="Currency" type="int16u" max="999" optional="true" default="0"/>
</struct>
+ <struct name="PowerAdjustCapabilityStruct" apiMaturity="provisional">
+ <cluster code="0x0098"/>
+ <item fieldId="0" name="PowerAdjustCapability" array="true" type="PowerAdjustStruct" isNullable="true" length="8"/>
+ <item fieldId="1" name="Cause" type="PowerAdjustReasonEnum" default="0x00" min="0x00" max="0x02"/>
+ </struct>
+
<struct name="PowerAdjustStruct" apiMaturity="provisional">
<cluster code="0x0098"/>
<item fieldId="0" name="MinPower" type="power_mw" default="0"/>
@@ -243,13 +248,13 @@
<struct name="ForecastStruct" apiMaturity="provisional">
<cluster code="0x0098"/>
- <item fieldId="0" name="ForecastId" type="int16u" default="0"/>
+ <item fieldId="0" name="ForecastID" type="int32u" default="0"/>
<item fieldId="1" name="ActiveSlotNumber" type="int16u" isNullable="true" default="0"/>
<item fieldId="2" name="StartTime" type="epoch_s"/>
<item fieldId="3" name="EndTime" type="epoch_s"/>
<item fieldId="4" name="EarliestStartTime" type="epoch_s" isNullable="true" optional="true"/>
<item fieldId="5" name="LatestEndTime" type="epoch_s" optional="true"/>
- <item fieldId="6" name="IsPauseable" type="boolean"/>
+ <item fieldId="6" name="IsPausable" type="boolean"/>
<item fieldId="7" name="Slots" array="true" type="SlotStruct" length="10"/>
<item fieldId="8" name="ForecastUpdateReason" type="ForecastUpdateReasonEnum" min="0x00" max="0x02"/>
</struct>
@@ -261,7 +266,7 @@
<item fieldId="2" name="DefaultDuration" type="elapsed_s"/>
<item fieldId="3" name="ElapsedSlotTime" type="elapsed_s"/>
<item fieldId="4" name="RemainingSlotTime" type="elapsed_s"/>
- <item fieldId="5" name="SlotIsPauseable" type="boolean" optional="true"/>
+ <item fieldId="5" name="SlotIsPausable" type="boolean" optional="true"/>
<item fieldId="6" name="MinPauseDuration" type="elapsed_s" optional="true"/>
<item fieldId="7" name="MaxPauseDuration" type="elapsed_s" optional="true"/>
<item fieldId="8" name="ManufacturerESAState" type="int16u" optional="true"/>
@@ -279,17 +284,16 @@
<struct name="SlotAdjustmentStruct" apiMaturity="provisional">
<cluster code="0x0098"/>
<item fieldId="0" name="SlotIndex" type="int8u"/>
- <item fieldId="1" name="NominalPower" type="power_mw"/>
+ <item fieldId="1" name="NominalPower" type="power_mw" optional="true"/>
<item fieldId="2" name="Duration" type="elapsed_s"/>
</struct>
<struct name="ConstraintsStruct" apiMaturity="provisional">
<cluster code="0x0098"/>
<item fieldId="0" name="StartTime" type="epoch_s"/>
- <item fieldId="1" name="Duration" type="elapsed_s" min="0" max="86400"/>
+ <item fieldId="1" name="Duration" type="elapsed_s" max="86400"/>
<item fieldId="2" name="NominalPower" type="power_mw" optional="true"/>
<item fieldId="3" name="MaximumEnergy" type="energy_mwh" optional="true"/>
<item fieldId="4" name="LoadControl" type="int8s" optional="true"/>
</struct>
-
</configurator>
diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter
index cb11897..cfc5664 100644
--- a/src/controller/data_model/controller-clusters.matter
+++ b/src/controller/data_model/controller-clusters.matter
@@ -4594,7 +4594,7 @@
/** This cluster allows a client to manage the power draw of a device. An example of such a client could be an Energy Management System (EMS) which controls an Energy Smart Appliance (ESA). */
provisional cluster DeviceEnergyManagement = 152 {
- revision 3;
+ revision 4;
enum AdjustmentCauseEnum : enum8 {
kLocalOptimization = 0;
@@ -4655,6 +4655,12 @@
kOptOut = 3;
}
+ enum PowerAdjustReasonEnum : enum8 {
+ kNoAdjustment = 0;
+ kLocalOptimizationAdjustment = 1;
+ kGridOptimizationAdjustment = 2;
+ }
+
bitmap Feature : bitmap32 {
kPowerAdjustment = 0x1;
kPowerForecastReporting = 0x2;
@@ -4672,13 +4678,25 @@
optional int16u currency = 3;
}
+ struct PowerAdjustStruct {
+ power_mw minPower = 0;
+ power_mw maxPower = 1;
+ elapsed_s minDuration = 2;
+ elapsed_s maxDuration = 3;
+ }
+
+ struct PowerAdjustCapabilityStruct {
+ nullable PowerAdjustStruct powerAdjustCapability[] = 0;
+ PowerAdjustReasonEnum cause = 1;
+ }
+
struct SlotStruct {
elapsed_s minDuration = 0;
elapsed_s maxDuration = 1;
elapsed_s defaultDuration = 2;
elapsed_s elapsedSlotTime = 3;
elapsed_s remainingSlotTime = 4;
- optional boolean slotIsPauseable = 5;
+ optional boolean slotIsPausable = 5;
optional elapsed_s minPauseDuration = 6;
optional elapsed_s maxPauseDuration = 7;
optional int16u manufacturerESAState = 8;
@@ -4694,13 +4712,13 @@
}
struct ForecastStruct {
- int16u forecastId = 0;
+ int32u forecastID = 0;
nullable int16u activeSlotNumber = 1;
epoch_s startTime = 2;
epoch_s endTime = 3;
optional nullable epoch_s earliestStartTime = 4;
optional epoch_s latestEndTime = 5;
- boolean isPauseable = 6;
+ boolean isPausable = 6;
SlotStruct slots[] = 7;
ForecastUpdateReasonEnum forecastUpdateReason = 8;
}
@@ -4713,16 +4731,9 @@
optional int8s loadControl = 4;
}
- struct PowerAdjustStruct {
- power_mw minPower = 0;
- power_mw maxPower = 1;
- elapsed_s minDuration = 2;
- elapsed_s maxDuration = 3;
- }
-
struct SlotAdjustmentStruct {
int8u slotIndex = 0;
- power_mw nominalPower = 1;
+ optional power_mw nominalPower = 1;
elapsed_s duration = 2;
}
@@ -4747,7 +4758,7 @@
readonly attribute ESAStateEnum ESAState = 2;
readonly attribute power_mw absMinPower = 3;
readonly attribute power_mw absMaxPower = 4;
- readonly attribute optional nullable PowerAdjustStruct powerAdjustmentCapability[] = 5;
+ readonly attribute optional nullable PowerAdjustCapabilityStruct powerAdjustmentCapability = 5;
readonly attribute optional nullable ForecastStruct forecast = 6;
readonly attribute optional OptOutStateEnum optOutState = 7;
readonly attribute command_id generatedCommandList[] = 65528;
@@ -4774,7 +4785,7 @@
}
request struct ModifyForecastRequestRequest {
- int32u forecastId = 0;
+ int32u forecastID = 0;
SlotAdjustmentStruct slotAdjustments[] = 1;
AdjustmentCauseEnum cause = 2;
}
diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java
index 31c9e63..40725b1 100644
--- a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java
+++ b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java
@@ -31198,17 +31198,17 @@
}}, commandId, commandArgs, timedInvokeTimeoutMs);
}
- public void modifyForecastRequest(DefaultClusterCallback callback, Long forecastId, ArrayList<ChipStructs.DeviceEnergyManagementClusterSlotAdjustmentStruct> slotAdjustments, Integer cause) {
- modifyForecastRequest(callback, forecastId, slotAdjustments, cause, 0);
+ public void modifyForecastRequest(DefaultClusterCallback callback, Long forecastID, ArrayList<ChipStructs.DeviceEnergyManagementClusterSlotAdjustmentStruct> slotAdjustments, Integer cause) {
+ modifyForecastRequest(callback, forecastID, slotAdjustments, cause, 0);
}
- public void modifyForecastRequest(DefaultClusterCallback callback, Long forecastId, ArrayList<ChipStructs.DeviceEnergyManagementClusterSlotAdjustmentStruct> slotAdjustments, Integer cause, int timedInvokeTimeoutMs) {
+ public void modifyForecastRequest(DefaultClusterCallback callback, Long forecastID, ArrayList<ChipStructs.DeviceEnergyManagementClusterSlotAdjustmentStruct> slotAdjustments, Integer cause, int timedInvokeTimeoutMs) {
final long commandId = 5L;
ArrayList<StructElement> elements = new ArrayList<>();
- final long forecastIdFieldID = 0L;
- BaseTLVType forecastIdtlvValue = new UIntType(forecastId);
- elements.add(new StructElement(forecastIdFieldID, forecastIdtlvValue));
+ final long forecastIDFieldID = 0L;
+ BaseTLVType forecastIDtlvValue = new UIntType(forecastID);
+ elements.add(new StructElement(forecastIDFieldID, forecastIDtlvValue));
final long slotAdjustmentsFieldID = 1L;
BaseTLVType slotAdjustmentstlvValue = ArrayType.generateArrayType(slotAdjustments, (elementslotAdjustments) -> elementslotAdjustments.encodeTlv());
@@ -31267,7 +31267,7 @@
}
public interface PowerAdjustmentCapabilityAttributeCallback extends BaseAttributeCallback {
- void onSuccess(@Nullable List<ChipStructs.DeviceEnergyManagementClusterPowerAdjustStruct> value);
+ void onSuccess(@Nullable ChipStructs.DeviceEnergyManagementClusterPowerAdjustCapabilityStruct value);
}
public interface ForecastAttributeCallback extends BaseAttributeCallback {
@@ -31427,7 +31427,7 @@
readAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
- @Nullable List<ChipStructs.DeviceEnergyManagementClusterPowerAdjustStruct> value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ @Nullable ChipStructs.DeviceEnergyManagementClusterPowerAdjustCapabilityStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
callback.onSuccess(value);
}
}, POWER_ADJUSTMENT_CAPABILITY_ATTRIBUTE_ID, true);
@@ -31440,7 +31440,7 @@
subscribeAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
- @Nullable List<ChipStructs.DeviceEnergyManagementClusterPowerAdjustStruct> value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ @Nullable ChipStructs.DeviceEnergyManagementClusterPowerAdjustCapabilityStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
callback.onSuccess(value);
}
}, POWER_ADJUSTMENT_CAPABILITY_ATTRIBUTE_ID, minInterval, maxInterval);
diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java
index c8d48cc..426e73b 100644
--- a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java
+++ b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java
@@ -7352,13 +7352,165 @@
return output.toString();
}
}
+public static class DeviceEnergyManagementClusterPowerAdjustStruct {
+ public Long minPower;
+ public Long maxPower;
+ public Long minDuration;
+ public Long maxDuration;
+ private static final long MIN_POWER_ID = 0L;
+ private static final long MAX_POWER_ID = 1L;
+ private static final long MIN_DURATION_ID = 2L;
+ private static final long MAX_DURATION_ID = 3L;
+
+ public DeviceEnergyManagementClusterPowerAdjustStruct(
+ Long minPower,
+ Long maxPower,
+ Long minDuration,
+ Long maxDuration
+ ) {
+ this.minPower = minPower;
+ this.maxPower = maxPower;
+ this.minDuration = minDuration;
+ this.maxDuration = maxDuration;
+ }
+
+ public StructType encodeTlv() {
+ ArrayList<StructElement> values = new ArrayList<>();
+ values.add(new StructElement(MIN_POWER_ID, new IntType(minPower)));
+ values.add(new StructElement(MAX_POWER_ID, new IntType(maxPower)));
+ values.add(new StructElement(MIN_DURATION_ID, new UIntType(minDuration)));
+ values.add(new StructElement(MAX_DURATION_ID, new UIntType(maxDuration)));
+
+ return new StructType(values);
+ }
+
+ public static DeviceEnergyManagementClusterPowerAdjustStruct decodeTlv(BaseTLVType tlvValue) {
+ if (tlvValue == null || tlvValue.type() != TLVType.Struct) {
+ return null;
+ }
+ Long minPower = null;
+ Long maxPower = null;
+ Long minDuration = null;
+ Long maxDuration = null;
+ for (StructElement element: ((StructType)tlvValue).value()) {
+ if (element.contextTagNum() == MIN_POWER_ID) {
+ if (element.value(BaseTLVType.class).type() == TLVType.Int) {
+ IntType castingValue = element.value(IntType.class);
+ minPower = castingValue.value(Long.class);
+ }
+ } else if (element.contextTagNum() == MAX_POWER_ID) {
+ if (element.value(BaseTLVType.class).type() == TLVType.Int) {
+ IntType castingValue = element.value(IntType.class);
+ maxPower = castingValue.value(Long.class);
+ }
+ } else if (element.contextTagNum() == MIN_DURATION_ID) {
+ if (element.value(BaseTLVType.class).type() == TLVType.UInt) {
+ UIntType castingValue = element.value(UIntType.class);
+ minDuration = castingValue.value(Long.class);
+ }
+ } else if (element.contextTagNum() == MAX_DURATION_ID) {
+ if (element.value(BaseTLVType.class).type() == TLVType.UInt) {
+ UIntType castingValue = element.value(UIntType.class);
+ maxDuration = castingValue.value(Long.class);
+ }
+ }
+ }
+ return new DeviceEnergyManagementClusterPowerAdjustStruct(
+ minPower,
+ maxPower,
+ minDuration,
+ maxDuration
+ );
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder output = new StringBuilder();
+ output.append("DeviceEnergyManagementClusterPowerAdjustStruct {\n");
+ output.append("\tminPower: ");
+ output.append(minPower);
+ output.append("\n");
+ output.append("\tmaxPower: ");
+ output.append(maxPower);
+ output.append("\n");
+ output.append("\tminDuration: ");
+ output.append(minDuration);
+ output.append("\n");
+ output.append("\tmaxDuration: ");
+ output.append(maxDuration);
+ output.append("\n");
+ output.append("}\n");
+ return output.toString();
+ }
+}
+public static class DeviceEnergyManagementClusterPowerAdjustCapabilityStruct {
+ public @Nullable ArrayList<ChipStructs.DeviceEnergyManagementClusterPowerAdjustStruct> powerAdjustCapability;
+ public Integer cause;
+ private static final long POWER_ADJUST_CAPABILITY_ID = 0L;
+ private static final long CAUSE_ID = 1L;
+
+ public DeviceEnergyManagementClusterPowerAdjustCapabilityStruct(
+ @Nullable ArrayList<ChipStructs.DeviceEnergyManagementClusterPowerAdjustStruct> powerAdjustCapability,
+ Integer cause
+ ) {
+ this.powerAdjustCapability = powerAdjustCapability;
+ this.cause = cause;
+ }
+
+ public StructType encodeTlv() {
+ ArrayList<StructElement> values = new ArrayList<>();
+ values.add(new StructElement(POWER_ADJUST_CAPABILITY_ID, powerAdjustCapability != null ? ArrayType.generateArrayType(powerAdjustCapability, (elementpowerAdjustCapability) -> elementpowerAdjustCapability.encodeTlv()) : new NullType()));
+ values.add(new StructElement(CAUSE_ID, new UIntType(cause)));
+
+ return new StructType(values);
+ }
+
+ public static DeviceEnergyManagementClusterPowerAdjustCapabilityStruct decodeTlv(BaseTLVType tlvValue) {
+ if (tlvValue == null || tlvValue.type() != TLVType.Struct) {
+ return null;
+ }
+ @Nullable ArrayList<ChipStructs.DeviceEnergyManagementClusterPowerAdjustStruct> powerAdjustCapability = null;
+ Integer cause = null;
+ for (StructElement element: ((StructType)tlvValue).value()) {
+ if (element.contextTagNum() == POWER_ADJUST_CAPABILITY_ID) {
+ if (element.value(BaseTLVType.class).type() == TLVType.Array) {
+ ArrayType castingValue = element.value(ArrayType.class);
+ powerAdjustCapability = castingValue.map((elementcastingValue) -> ChipStructs.DeviceEnergyManagementClusterPowerAdjustStruct.decodeTlv(elementcastingValue));
+ }
+ } else if (element.contextTagNum() == CAUSE_ID) {
+ if (element.value(BaseTLVType.class).type() == TLVType.UInt) {
+ UIntType castingValue = element.value(UIntType.class);
+ cause = castingValue.value(Integer.class);
+ }
+ }
+ }
+ return new DeviceEnergyManagementClusterPowerAdjustCapabilityStruct(
+ powerAdjustCapability,
+ cause
+ );
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder output = new StringBuilder();
+ output.append("DeviceEnergyManagementClusterPowerAdjustCapabilityStruct {\n");
+ output.append("\tpowerAdjustCapability: ");
+ output.append(powerAdjustCapability);
+ output.append("\n");
+ output.append("\tcause: ");
+ output.append(cause);
+ output.append("\n");
+ output.append("}\n");
+ return output.toString();
+ }
+}
public static class DeviceEnergyManagementClusterSlotStruct {
public Long minDuration;
public Long maxDuration;
public Long defaultDuration;
public Long elapsedSlotTime;
public Long remainingSlotTime;
- public Optional<Boolean> slotIsPauseable;
+ public Optional<Boolean> slotIsPausable;
public Optional<Long> minPauseDuration;
public Optional<Long> maxPauseDuration;
public Optional<Integer> manufacturerESAState;
@@ -7376,7 +7528,7 @@
private static final long DEFAULT_DURATION_ID = 2L;
private static final long ELAPSED_SLOT_TIME_ID = 3L;
private static final long REMAINING_SLOT_TIME_ID = 4L;
- private static final long SLOT_IS_PAUSEABLE_ID = 5L;
+ private static final long SLOT_IS_PAUSABLE_ID = 5L;
private static final long MIN_PAUSE_DURATION_ID = 6L;
private static final long MAX_PAUSE_DURATION_ID = 7L;
private static final long MANUFACTURER_E_S_A_STATE_ID = 8L;
@@ -7396,7 +7548,7 @@
Long defaultDuration,
Long elapsedSlotTime,
Long remainingSlotTime,
- Optional<Boolean> slotIsPauseable,
+ Optional<Boolean> slotIsPausable,
Optional<Long> minPauseDuration,
Optional<Long> maxPauseDuration,
Optional<Integer> manufacturerESAState,
@@ -7415,7 +7567,7 @@
this.defaultDuration = defaultDuration;
this.elapsedSlotTime = elapsedSlotTime;
this.remainingSlotTime = remainingSlotTime;
- this.slotIsPauseable = slotIsPauseable;
+ this.slotIsPausable = slotIsPausable;
this.minPauseDuration = minPauseDuration;
this.maxPauseDuration = maxPauseDuration;
this.manufacturerESAState = manufacturerESAState;
@@ -7437,7 +7589,7 @@
values.add(new StructElement(DEFAULT_DURATION_ID, new UIntType(defaultDuration)));
values.add(new StructElement(ELAPSED_SLOT_TIME_ID, new UIntType(elapsedSlotTime)));
values.add(new StructElement(REMAINING_SLOT_TIME_ID, new UIntType(remainingSlotTime)));
- values.add(new StructElement(SLOT_IS_PAUSEABLE_ID, slotIsPauseable.<BaseTLVType>map((nonOptionalslotIsPauseable) -> new BooleanType(nonOptionalslotIsPauseable)).orElse(new EmptyType())));
+ values.add(new StructElement(SLOT_IS_PAUSABLE_ID, slotIsPausable.<BaseTLVType>map((nonOptionalslotIsPausable) -> new BooleanType(nonOptionalslotIsPausable)).orElse(new EmptyType())));
values.add(new StructElement(MIN_PAUSE_DURATION_ID, minPauseDuration.<BaseTLVType>map((nonOptionalminPauseDuration) -> new UIntType(nonOptionalminPauseDuration)).orElse(new EmptyType())));
values.add(new StructElement(MAX_PAUSE_DURATION_ID, maxPauseDuration.<BaseTLVType>map((nonOptionalmaxPauseDuration) -> new UIntType(nonOptionalmaxPauseDuration)).orElse(new EmptyType())));
values.add(new StructElement(MANUFACTURER_E_S_A_STATE_ID, manufacturerESAState.<BaseTLVType>map((nonOptionalmanufacturerESAState) -> new UIntType(nonOptionalmanufacturerESAState)).orElse(new EmptyType())));
@@ -7463,7 +7615,7 @@
Long defaultDuration = null;
Long elapsedSlotTime = null;
Long remainingSlotTime = null;
- Optional<Boolean> slotIsPauseable = Optional.empty();
+ Optional<Boolean> slotIsPausable = Optional.empty();
Optional<Long> minPauseDuration = Optional.empty();
Optional<Long> maxPauseDuration = Optional.empty();
Optional<Integer> manufacturerESAState = Optional.empty();
@@ -7502,10 +7654,10 @@
UIntType castingValue = element.value(UIntType.class);
remainingSlotTime = castingValue.value(Long.class);
}
- } else if (element.contextTagNum() == SLOT_IS_PAUSEABLE_ID) {
+ } else if (element.contextTagNum() == SLOT_IS_PAUSABLE_ID) {
if (element.value(BaseTLVType.class).type() == TLVType.Boolean) {
BooleanType castingValue = element.value(BooleanType.class);
- slotIsPauseable = Optional.of(castingValue.value(Boolean.class));
+ slotIsPausable = Optional.of(castingValue.value(Boolean.class));
}
} else if (element.contextTagNum() == MIN_PAUSE_DURATION_ID) {
if (element.value(BaseTLVType.class).type() == TLVType.UInt) {
@@ -7575,7 +7727,7 @@
defaultDuration,
elapsedSlotTime,
remainingSlotTime,
- slotIsPauseable,
+ slotIsPausable,
minPauseDuration,
maxPauseDuration,
manufacturerESAState,
@@ -7610,8 +7762,8 @@
output.append("\tremainingSlotTime: ");
output.append(remainingSlotTime);
output.append("\n");
- output.append("\tslotIsPauseable: ");
- output.append(slotIsPauseable);
+ output.append("\tslotIsPausable: ");
+ output.append(slotIsPausable);
output.append("\n");
output.append("\tminPauseDuration: ");
output.append(minPauseDuration);
@@ -7654,56 +7806,56 @@
}
}
public static class DeviceEnergyManagementClusterForecastStruct {
- public Integer forecastId;
+ public Long forecastID;
public @Nullable Integer activeSlotNumber;
public Long startTime;
public Long endTime;
public @Nullable Optional<Long> earliestStartTime;
public Optional<Long> latestEndTime;
- public Boolean isPauseable;
+ public Boolean isPausable;
public ArrayList<ChipStructs.DeviceEnergyManagementClusterSlotStruct> slots;
public Integer forecastUpdateReason;
- private static final long FORECAST_ID_ID = 0L;
+ private static final long FORECAST_I_D_ID = 0L;
private static final long ACTIVE_SLOT_NUMBER_ID = 1L;
private static final long START_TIME_ID = 2L;
private static final long END_TIME_ID = 3L;
private static final long EARLIEST_START_TIME_ID = 4L;
private static final long LATEST_END_TIME_ID = 5L;
- private static final long IS_PAUSEABLE_ID = 6L;
+ private static final long IS_PAUSABLE_ID = 6L;
private static final long SLOTS_ID = 7L;
private static final long FORECAST_UPDATE_REASON_ID = 8L;
public DeviceEnergyManagementClusterForecastStruct(
- Integer forecastId,
+ Long forecastID,
@Nullable Integer activeSlotNumber,
Long startTime,
Long endTime,
@Nullable Optional<Long> earliestStartTime,
Optional<Long> latestEndTime,
- Boolean isPauseable,
+ Boolean isPausable,
ArrayList<ChipStructs.DeviceEnergyManagementClusterSlotStruct> slots,
Integer forecastUpdateReason
) {
- this.forecastId = forecastId;
+ this.forecastID = forecastID;
this.activeSlotNumber = activeSlotNumber;
this.startTime = startTime;
this.endTime = endTime;
this.earliestStartTime = earliestStartTime;
this.latestEndTime = latestEndTime;
- this.isPauseable = isPauseable;
+ this.isPausable = isPausable;
this.slots = slots;
this.forecastUpdateReason = forecastUpdateReason;
}
public StructType encodeTlv() {
ArrayList<StructElement> values = new ArrayList<>();
- values.add(new StructElement(FORECAST_ID_ID, new UIntType(forecastId)));
+ values.add(new StructElement(FORECAST_I_D_ID, new UIntType(forecastID)));
values.add(new StructElement(ACTIVE_SLOT_NUMBER_ID, activeSlotNumber != null ? new UIntType(activeSlotNumber) : new NullType()));
values.add(new StructElement(START_TIME_ID, new UIntType(startTime)));
values.add(new StructElement(END_TIME_ID, new UIntType(endTime)));
values.add(new StructElement(EARLIEST_START_TIME_ID, earliestStartTime != null ? earliestStartTime.<BaseTLVType>map((nonOptionalearliestStartTime) -> new UIntType(nonOptionalearliestStartTime)).orElse(new EmptyType()) : new NullType()));
values.add(new StructElement(LATEST_END_TIME_ID, latestEndTime.<BaseTLVType>map((nonOptionallatestEndTime) -> new UIntType(nonOptionallatestEndTime)).orElse(new EmptyType())));
- values.add(new StructElement(IS_PAUSEABLE_ID, new BooleanType(isPauseable)));
+ values.add(new StructElement(IS_PAUSABLE_ID, new BooleanType(isPausable)));
values.add(new StructElement(SLOTS_ID, ArrayType.generateArrayType(slots, (elementslots) -> elementslots.encodeTlv())));
values.add(new StructElement(FORECAST_UPDATE_REASON_ID, new UIntType(forecastUpdateReason)));
@@ -7714,20 +7866,20 @@
if (tlvValue == null || tlvValue.type() != TLVType.Struct) {
return null;
}
- Integer forecastId = null;
+ Long forecastID = null;
@Nullable Integer activeSlotNumber = null;
Long startTime = null;
Long endTime = null;
@Nullable Optional<Long> earliestStartTime = null;
Optional<Long> latestEndTime = Optional.empty();
- Boolean isPauseable = null;
+ Boolean isPausable = null;
ArrayList<ChipStructs.DeviceEnergyManagementClusterSlotStruct> slots = null;
Integer forecastUpdateReason = null;
for (StructElement element: ((StructType)tlvValue).value()) {
- if (element.contextTagNum() == FORECAST_ID_ID) {
+ if (element.contextTagNum() == FORECAST_I_D_ID) {
if (element.value(BaseTLVType.class).type() == TLVType.UInt) {
UIntType castingValue = element.value(UIntType.class);
- forecastId = castingValue.value(Integer.class);
+ forecastID = castingValue.value(Long.class);
}
} else if (element.contextTagNum() == ACTIVE_SLOT_NUMBER_ID) {
if (element.value(BaseTLVType.class).type() == TLVType.UInt) {
@@ -7754,10 +7906,10 @@
UIntType castingValue = element.value(UIntType.class);
latestEndTime = Optional.of(castingValue.value(Long.class));
}
- } else if (element.contextTagNum() == IS_PAUSEABLE_ID) {
+ } else if (element.contextTagNum() == IS_PAUSABLE_ID) {
if (element.value(BaseTLVType.class).type() == TLVType.Boolean) {
BooleanType castingValue = element.value(BooleanType.class);
- isPauseable = castingValue.value(Boolean.class);
+ isPausable = castingValue.value(Boolean.class);
}
} else if (element.contextTagNum() == SLOTS_ID) {
if (element.value(BaseTLVType.class).type() == TLVType.Array) {
@@ -7772,13 +7924,13 @@
}
}
return new DeviceEnergyManagementClusterForecastStruct(
- forecastId,
+ forecastID,
activeSlotNumber,
startTime,
endTime,
earliestStartTime,
latestEndTime,
- isPauseable,
+ isPausable,
slots,
forecastUpdateReason
);
@@ -7788,8 +7940,8 @@
public String toString() {
StringBuilder output = new StringBuilder();
output.append("DeviceEnergyManagementClusterForecastStruct {\n");
- output.append("\tforecastId: ");
- output.append(forecastId);
+ output.append("\tforecastID: ");
+ output.append(forecastID);
output.append("\n");
output.append("\tactiveSlotNumber: ");
output.append(activeSlotNumber);
@@ -7806,8 +7958,8 @@
output.append("\tlatestEndTime: ");
output.append(latestEndTime);
output.append("\n");
- output.append("\tisPauseable: ");
- output.append(isPauseable);
+ output.append("\tisPausable: ");
+ output.append(isPausable);
output.append("\n");
output.append("\tslots: ");
output.append(slots);
@@ -7925,100 +8077,9 @@
return output.toString();
}
}
-public static class DeviceEnergyManagementClusterPowerAdjustStruct {
- public Long minPower;
- public Long maxPower;
- public Long minDuration;
- public Long maxDuration;
- private static final long MIN_POWER_ID = 0L;
- private static final long MAX_POWER_ID = 1L;
- private static final long MIN_DURATION_ID = 2L;
- private static final long MAX_DURATION_ID = 3L;
-
- public DeviceEnergyManagementClusterPowerAdjustStruct(
- Long minPower,
- Long maxPower,
- Long minDuration,
- Long maxDuration
- ) {
- this.minPower = minPower;
- this.maxPower = maxPower;
- this.minDuration = minDuration;
- this.maxDuration = maxDuration;
- }
-
- public StructType encodeTlv() {
- ArrayList<StructElement> values = new ArrayList<>();
- values.add(new StructElement(MIN_POWER_ID, new IntType(minPower)));
- values.add(new StructElement(MAX_POWER_ID, new IntType(maxPower)));
- values.add(new StructElement(MIN_DURATION_ID, new UIntType(minDuration)));
- values.add(new StructElement(MAX_DURATION_ID, new UIntType(maxDuration)));
-
- return new StructType(values);
- }
-
- public static DeviceEnergyManagementClusterPowerAdjustStruct decodeTlv(BaseTLVType tlvValue) {
- if (tlvValue == null || tlvValue.type() != TLVType.Struct) {
- return null;
- }
- Long minPower = null;
- Long maxPower = null;
- Long minDuration = null;
- Long maxDuration = null;
- for (StructElement element: ((StructType)tlvValue).value()) {
- if (element.contextTagNum() == MIN_POWER_ID) {
- if (element.value(BaseTLVType.class).type() == TLVType.Int) {
- IntType castingValue = element.value(IntType.class);
- minPower = castingValue.value(Long.class);
- }
- } else if (element.contextTagNum() == MAX_POWER_ID) {
- if (element.value(BaseTLVType.class).type() == TLVType.Int) {
- IntType castingValue = element.value(IntType.class);
- maxPower = castingValue.value(Long.class);
- }
- } else if (element.contextTagNum() == MIN_DURATION_ID) {
- if (element.value(BaseTLVType.class).type() == TLVType.UInt) {
- UIntType castingValue = element.value(UIntType.class);
- minDuration = castingValue.value(Long.class);
- }
- } else if (element.contextTagNum() == MAX_DURATION_ID) {
- if (element.value(BaseTLVType.class).type() == TLVType.UInt) {
- UIntType castingValue = element.value(UIntType.class);
- maxDuration = castingValue.value(Long.class);
- }
- }
- }
- return new DeviceEnergyManagementClusterPowerAdjustStruct(
- minPower,
- maxPower,
- minDuration,
- maxDuration
- );
- }
-
- @Override
- public String toString() {
- StringBuilder output = new StringBuilder();
- output.append("DeviceEnergyManagementClusterPowerAdjustStruct {\n");
- output.append("\tminPower: ");
- output.append(minPower);
- output.append("\n");
- output.append("\tmaxPower: ");
- output.append(maxPower);
- output.append("\n");
- output.append("\tminDuration: ");
- output.append(minDuration);
- output.append("\n");
- output.append("\tmaxDuration: ");
- output.append(maxDuration);
- output.append("\n");
- output.append("}\n");
- return output.toString();
- }
-}
public static class DeviceEnergyManagementClusterSlotAdjustmentStruct {
public Integer slotIndex;
- public Long nominalPower;
+ public Optional<Long> nominalPower;
public Long duration;
private static final long SLOT_INDEX_ID = 0L;
private static final long NOMINAL_POWER_ID = 1L;
@@ -8026,7 +8087,7 @@
public DeviceEnergyManagementClusterSlotAdjustmentStruct(
Integer slotIndex,
- Long nominalPower,
+ Optional<Long> nominalPower,
Long duration
) {
this.slotIndex = slotIndex;
@@ -8037,7 +8098,7 @@
public StructType encodeTlv() {
ArrayList<StructElement> values = new ArrayList<>();
values.add(new StructElement(SLOT_INDEX_ID, new UIntType(slotIndex)));
- values.add(new StructElement(NOMINAL_POWER_ID, new IntType(nominalPower)));
+ values.add(new StructElement(NOMINAL_POWER_ID, nominalPower.<BaseTLVType>map((nonOptionalnominalPower) -> new IntType(nonOptionalnominalPower)).orElse(new EmptyType())));
values.add(new StructElement(DURATION_ID, new UIntType(duration)));
return new StructType(values);
@@ -8048,7 +8109,7 @@
return null;
}
Integer slotIndex = null;
- Long nominalPower = null;
+ Optional<Long> nominalPower = Optional.empty();
Long duration = null;
for (StructElement element: ((StructType)tlvValue).value()) {
if (element.contextTagNum() == SLOT_INDEX_ID) {
@@ -8059,7 +8120,7 @@
} else if (element.contextTagNum() == NOMINAL_POWER_ID) {
if (element.value(BaseTLVType.class).type() == TLVType.Int) {
IntType castingValue = element.value(IntType.class);
- nominalPower = castingValue.value(Long.class);
+ nominalPower = Optional.of(castingValue.value(Long.class));
}
} else if (element.contextTagNum() == DURATION_ID) {
if (element.value(BaseTLVType.class).type() == TLVType.UInt) {
diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java
index ae1b08a..df03516 100644
--- a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java
+++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java
@@ -9761,7 +9761,7 @@
}
throw new NoSuchFieldError();
}
- }public enum ModifyForecastRequestCommandField {ForecastId(0),SlotAdjustments(1),Cause(2),;
+ }public enum ModifyForecastRequestCommandField {ForecastID(0),SlotAdjustments(1),Cause(2),;
private final int id;
ModifyForecastRequestCommandField(int id) {
this.id = id;
diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java
index 7bf6b1b..219baca 100644
--- a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java
+++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java
@@ -10882,10 +10882,10 @@
}
@Override
- public void onSuccess(@Nullable List<ChipStructs.DeviceEnergyManagementClusterPowerAdjustStruct> valueList) {
+ public void onSuccess(@Nullable ChipStructs.DeviceEnergyManagementClusterPowerAdjustCapabilityStruct value) {
Map<CommandResponseInfo, Object> responseValues = new LinkedHashMap<>();
- CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List<ChipStructs.DeviceEnergyManagementClusterPowerAdjustStruct>");
- responseValues.put(commandResponseInfo, valueList);
+ CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "ChipStructs.DeviceEnergyManagementClusterPowerAdjustCapabilityStruct");
+ responseValues.put(commandResponseInfo, value);
callback.onSuccess(responseValues);
}
@@ -24897,8 +24897,8 @@
Map<String, CommandParameterInfo> deviceEnergyManagementmodifyForecastRequestCommandParams = new LinkedHashMap<String, CommandParameterInfo>();
- CommandParameterInfo deviceEnergyManagementmodifyForecastRequestforecastIdCommandParameterInfo = new CommandParameterInfo("forecastId", Long.class, Long.class);
- deviceEnergyManagementmodifyForecastRequestCommandParams.put("forecastId",deviceEnergyManagementmodifyForecastRequestforecastIdCommandParameterInfo);
+ CommandParameterInfo deviceEnergyManagementmodifyForecastRequestforecastIDCommandParameterInfo = new CommandParameterInfo("forecastID", Long.class, Long.class);
+ deviceEnergyManagementmodifyForecastRequestCommandParams.put("forecastID",deviceEnergyManagementmodifyForecastRequestforecastIDCommandParameterInfo);
CommandParameterInfo deviceEnergyManagementmodifyForecastRequestcauseCommandParameterInfo = new CommandParameterInfo("cause", Integer.class, Integer.class);
@@ -24908,7 +24908,7 @@
((ChipClusters.DeviceEnergyManagementCluster) cluster)
.modifyForecastRequest((DefaultClusterCallback) callback
, (Long)
- commandArguments.get("forecastId")
+ commandArguments.get("forecastID")
, (ArrayList<ChipStructs.DeviceEnergyManagementClusterSlotAdjustmentStruct>)
commandArguments.get("slotAdjustments")
, (Integer)
diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java
index 8f038db..23261b74 100644
--- a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java
+++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java
@@ -9619,17 +9619,6 @@
readDeviceEnergyManagementAbsMaxPowerCommandParams
);
result.put("readAbsMaxPowerAttribute", readDeviceEnergyManagementAbsMaxPowerAttributeInteractionInfo);
- Map<String, CommandParameterInfo> readDeviceEnergyManagementPowerAdjustmentCapabilityCommandParams = new LinkedHashMap<String, CommandParameterInfo>();
- InteractionInfo readDeviceEnergyManagementPowerAdjustmentCapabilityAttributeInteractionInfo = new InteractionInfo(
- (cluster, callback, commandArguments) -> {
- ((ChipClusters.DeviceEnergyManagementCluster) cluster).readPowerAdjustmentCapabilityAttribute(
- (ChipClusters.DeviceEnergyManagementCluster.PowerAdjustmentCapabilityAttributeCallback) callback
- );
- },
- () -> new ClusterInfoMapping.DelegatedDeviceEnergyManagementClusterPowerAdjustmentCapabilityAttributeCallback(),
- readDeviceEnergyManagementPowerAdjustmentCapabilityCommandParams
- );
- result.put("readPowerAdjustmentCapabilityAttribute", readDeviceEnergyManagementPowerAdjustmentCapabilityAttributeInteractionInfo);
Map<String, CommandParameterInfo> readDeviceEnergyManagementOptOutStateCommandParams = new LinkedHashMap<String, CommandParameterInfo>();
InteractionInfo readDeviceEnergyManagementOptOutStateAttributeInteractionInfo = new InteractionInfo(
(cluster, callback, commandArguments) -> {
diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni b/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni
index 4f8bcd1..a5f7518 100644
--- a/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni
+++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni
@@ -47,6 +47,7 @@
"${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DeviceEnergyManagementClusterConstraintsStruct.kt",
"${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DeviceEnergyManagementClusterCostStruct.kt",
"${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DeviceEnergyManagementClusterForecastStruct.kt",
+ "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DeviceEnergyManagementClusterPowerAdjustCapabilityStruct.kt",
"${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DeviceEnergyManagementClusterPowerAdjustStruct.kt",
"${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DeviceEnergyManagementClusterSlotAdjustmentStruct.kt",
"${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DeviceEnergyManagementClusterSlotStruct.kt",
diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DeviceEnergyManagementClusterForecastStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DeviceEnergyManagementClusterForecastStruct.kt
index 17e45fa..ad9120a 100644
--- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DeviceEnergyManagementClusterForecastStruct.kt
+++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DeviceEnergyManagementClusterForecastStruct.kt
@@ -25,25 +25,25 @@
import matter.tlv.TlvWriter
class DeviceEnergyManagementClusterForecastStruct(
- val forecastId: UInt,
+ val forecastID: ULong,
val activeSlotNumber: UInt?,
val startTime: ULong,
val endTime: ULong,
val earliestStartTime: Optional<ULong>?,
val latestEndTime: Optional<ULong>,
- val isPauseable: Boolean,
+ val isPausable: Boolean,
val slots: List<DeviceEnergyManagementClusterSlotStruct>,
val forecastUpdateReason: UInt
) {
override fun toString(): String = buildString {
append("DeviceEnergyManagementClusterForecastStruct {\n")
- append("\tforecastId : $forecastId\n")
+ append("\tforecastID : $forecastID\n")
append("\tactiveSlotNumber : $activeSlotNumber\n")
append("\tstartTime : $startTime\n")
append("\tendTime : $endTime\n")
append("\tearliestStartTime : $earliestStartTime\n")
append("\tlatestEndTime : $latestEndTime\n")
- append("\tisPauseable : $isPauseable\n")
+ append("\tisPausable : $isPausable\n")
append("\tslots : $slots\n")
append("\tforecastUpdateReason : $forecastUpdateReason\n")
append("}\n")
@@ -52,7 +52,7 @@
fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) {
tlvWriter.apply {
startStructure(tlvTag)
- put(ContextSpecificTag(TAG_FORECAST_ID), forecastId)
+ put(ContextSpecificTag(TAG_FORECAST_I_D), forecastID)
if (activeSlotNumber != null) {
put(ContextSpecificTag(TAG_ACTIVE_SLOT_NUMBER), activeSlotNumber)
} else {
@@ -72,7 +72,7 @@
val optlatestEndTime = latestEndTime.get()
put(ContextSpecificTag(TAG_LATEST_END_TIME), optlatestEndTime)
}
- put(ContextSpecificTag(TAG_IS_PAUSEABLE), isPauseable)
+ put(ContextSpecificTag(TAG_IS_PAUSABLE), isPausable)
startArray(ContextSpecificTag(TAG_SLOTS))
for (item in slots.iterator()) {
item.toTlv(AnonymousTag, this)
@@ -84,19 +84,19 @@
}
companion object {
- private const val TAG_FORECAST_ID = 0
+ private const val TAG_FORECAST_I_D = 0
private const val TAG_ACTIVE_SLOT_NUMBER = 1
private const val TAG_START_TIME = 2
private const val TAG_END_TIME = 3
private const val TAG_EARLIEST_START_TIME = 4
private const val TAG_LATEST_END_TIME = 5
- private const val TAG_IS_PAUSEABLE = 6
+ private const val TAG_IS_PAUSABLE = 6
private const val TAG_SLOTS = 7
private const val TAG_FORECAST_UPDATE_REASON = 8
fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): DeviceEnergyManagementClusterForecastStruct {
tlvReader.enterStructure(tlvTag)
- val forecastId = tlvReader.getUInt(ContextSpecificTag(TAG_FORECAST_ID))
+ val forecastID = tlvReader.getULong(ContextSpecificTag(TAG_FORECAST_I_D))
val activeSlotNumber =
if (!tlvReader.isNull()) {
tlvReader.getUInt(ContextSpecificTag(TAG_ACTIVE_SLOT_NUMBER))
@@ -123,7 +123,7 @@
} else {
Optional.empty()
}
- val isPauseable = tlvReader.getBoolean(ContextSpecificTag(TAG_IS_PAUSEABLE))
+ val isPausable = tlvReader.getBoolean(ContextSpecificTag(TAG_IS_PAUSABLE))
val slots =
buildList<DeviceEnergyManagementClusterSlotStruct> {
tlvReader.enterArray(ContextSpecificTag(TAG_SLOTS))
@@ -137,13 +137,13 @@
tlvReader.exitContainer()
return DeviceEnergyManagementClusterForecastStruct(
- forecastId,
+ forecastID,
activeSlotNumber,
startTime,
endTime,
earliestStartTime,
latestEndTime,
- isPauseable,
+ isPausable,
slots,
forecastUpdateReason
)
diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DeviceEnergyManagementClusterPowerAdjustCapabilityStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DeviceEnergyManagementClusterPowerAdjustCapabilityStruct.kt
new file mode 100644
index 0000000..e2172a7
--- /dev/null
+++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DeviceEnergyManagementClusterPowerAdjustCapabilityStruct.kt
@@ -0,0 +1,83 @@
+/*
+ *
+ * Copyright (c) 2023 Project CHIP Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package chip.devicecontroller.cluster.structs
+
+import chip.devicecontroller.cluster.*
+import matter.tlv.AnonymousTag
+import matter.tlv.ContextSpecificTag
+import matter.tlv.Tag
+import matter.tlv.TlvReader
+import matter.tlv.TlvWriter
+
+class DeviceEnergyManagementClusterPowerAdjustCapabilityStruct(
+ val powerAdjustCapability: List<DeviceEnergyManagementClusterPowerAdjustStruct>?,
+ val cause: UInt
+) {
+ override fun toString(): String = buildString {
+ append("DeviceEnergyManagementClusterPowerAdjustCapabilityStruct {\n")
+ append("\tpowerAdjustCapability : $powerAdjustCapability\n")
+ append("\tcause : $cause\n")
+ append("}\n")
+ }
+
+ fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) {
+ tlvWriter.apply {
+ startStructure(tlvTag)
+ if (powerAdjustCapability != null) {
+ startArray(ContextSpecificTag(TAG_POWER_ADJUST_CAPABILITY))
+ for (item in powerAdjustCapability.iterator()) {
+ item.toTlv(AnonymousTag, this)
+ }
+ endArray()
+ } else {
+ putNull(ContextSpecificTag(TAG_POWER_ADJUST_CAPABILITY))
+ }
+ put(ContextSpecificTag(TAG_CAUSE), cause)
+ endStructure()
+ }
+ }
+
+ companion object {
+ private const val TAG_POWER_ADJUST_CAPABILITY = 0
+ private const val TAG_CAUSE = 1
+
+ fun fromTlv(
+ tlvTag: Tag,
+ tlvReader: TlvReader
+ ): DeviceEnergyManagementClusterPowerAdjustCapabilityStruct {
+ tlvReader.enterStructure(tlvTag)
+ val powerAdjustCapability =
+ if (!tlvReader.isNull()) {
+ buildList<DeviceEnergyManagementClusterPowerAdjustStruct> {
+ tlvReader.enterArray(ContextSpecificTag(TAG_POWER_ADJUST_CAPABILITY))
+ while (!tlvReader.isEndOfContainer()) {
+ add(DeviceEnergyManagementClusterPowerAdjustStruct.fromTlv(AnonymousTag, tlvReader))
+ }
+ tlvReader.exitContainer()
+ }
+ } else {
+ tlvReader.getNull(ContextSpecificTag(TAG_POWER_ADJUST_CAPABILITY))
+ null
+ }
+ val cause = tlvReader.getUInt(ContextSpecificTag(TAG_CAUSE))
+
+ tlvReader.exitContainer()
+
+ return DeviceEnergyManagementClusterPowerAdjustCapabilityStruct(powerAdjustCapability, cause)
+ }
+ }
+}
diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DeviceEnergyManagementClusterSlotAdjustmentStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DeviceEnergyManagementClusterSlotAdjustmentStruct.kt
index 11fcf97..22aa9bd 100644
--- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DeviceEnergyManagementClusterSlotAdjustmentStruct.kt
+++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DeviceEnergyManagementClusterSlotAdjustmentStruct.kt
@@ -17,6 +17,7 @@
package chip.devicecontroller.cluster.structs
import chip.devicecontroller.cluster.*
+import java.util.Optional
import matter.tlv.ContextSpecificTag
import matter.tlv.Tag
import matter.tlv.TlvReader
@@ -24,7 +25,7 @@
class DeviceEnergyManagementClusterSlotAdjustmentStruct(
val slotIndex: UInt,
- val nominalPower: Long,
+ val nominalPower: Optional<Long>,
val duration: ULong
) {
override fun toString(): String = buildString {
@@ -39,7 +40,10 @@
tlvWriter.apply {
startStructure(tlvTag)
put(ContextSpecificTag(TAG_SLOT_INDEX), slotIndex)
- put(ContextSpecificTag(TAG_NOMINAL_POWER), nominalPower)
+ if (nominalPower.isPresent) {
+ val optnominalPower = nominalPower.get()
+ put(ContextSpecificTag(TAG_NOMINAL_POWER), optnominalPower)
+ }
put(ContextSpecificTag(TAG_DURATION), duration)
endStructure()
}
@@ -56,7 +60,12 @@
): DeviceEnergyManagementClusterSlotAdjustmentStruct {
tlvReader.enterStructure(tlvTag)
val slotIndex = tlvReader.getUInt(ContextSpecificTag(TAG_SLOT_INDEX))
- val nominalPower = tlvReader.getLong(ContextSpecificTag(TAG_NOMINAL_POWER))
+ val nominalPower =
+ if (tlvReader.isNextTag(ContextSpecificTag(TAG_NOMINAL_POWER))) {
+ Optional.of(tlvReader.getLong(ContextSpecificTag(TAG_NOMINAL_POWER)))
+ } else {
+ Optional.empty()
+ }
val duration = tlvReader.getULong(ContextSpecificTag(TAG_DURATION))
tlvReader.exitContainer()
diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DeviceEnergyManagementClusterSlotStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DeviceEnergyManagementClusterSlotStruct.kt
index 1875943..f6d35be 100644
--- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DeviceEnergyManagementClusterSlotStruct.kt
+++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DeviceEnergyManagementClusterSlotStruct.kt
@@ -30,7 +30,7 @@
val defaultDuration: ULong,
val elapsedSlotTime: ULong,
val remainingSlotTime: ULong,
- val slotIsPauseable: Optional<Boolean>,
+ val slotIsPausable: Optional<Boolean>,
val minPauseDuration: Optional<ULong>,
val maxPauseDuration: Optional<ULong>,
val manufacturerESAState: Optional<UInt>,
@@ -51,7 +51,7 @@
append("\tdefaultDuration : $defaultDuration\n")
append("\telapsedSlotTime : $elapsedSlotTime\n")
append("\tremainingSlotTime : $remainingSlotTime\n")
- append("\tslotIsPauseable : $slotIsPauseable\n")
+ append("\tslotIsPausable : $slotIsPausable\n")
append("\tminPauseDuration : $minPauseDuration\n")
append("\tmaxPauseDuration : $maxPauseDuration\n")
append("\tmanufacturerESAState : $manufacturerESAState\n")
@@ -75,9 +75,9 @@
put(ContextSpecificTag(TAG_DEFAULT_DURATION), defaultDuration)
put(ContextSpecificTag(TAG_ELAPSED_SLOT_TIME), elapsedSlotTime)
put(ContextSpecificTag(TAG_REMAINING_SLOT_TIME), remainingSlotTime)
- if (slotIsPauseable.isPresent) {
- val optslotIsPauseable = slotIsPauseable.get()
- put(ContextSpecificTag(TAG_SLOT_IS_PAUSEABLE), optslotIsPauseable)
+ if (slotIsPausable.isPresent) {
+ val optslotIsPausable = slotIsPausable.get()
+ put(ContextSpecificTag(TAG_SLOT_IS_PAUSABLE), optslotIsPausable)
}
if (minPauseDuration.isPresent) {
val optminPauseDuration = minPauseDuration.get()
@@ -141,7 +141,7 @@
private const val TAG_DEFAULT_DURATION = 2
private const val TAG_ELAPSED_SLOT_TIME = 3
private const val TAG_REMAINING_SLOT_TIME = 4
- private const val TAG_SLOT_IS_PAUSEABLE = 5
+ private const val TAG_SLOT_IS_PAUSABLE = 5
private const val TAG_MIN_PAUSE_DURATION = 6
private const val TAG_MAX_PAUSE_DURATION = 7
private const val TAG_MANUFACTURER_E_S_A_STATE = 8
@@ -162,9 +162,9 @@
val defaultDuration = tlvReader.getULong(ContextSpecificTag(TAG_DEFAULT_DURATION))
val elapsedSlotTime = tlvReader.getULong(ContextSpecificTag(TAG_ELAPSED_SLOT_TIME))
val remainingSlotTime = tlvReader.getULong(ContextSpecificTag(TAG_REMAINING_SLOT_TIME))
- val slotIsPauseable =
- if (tlvReader.isNextTag(ContextSpecificTag(TAG_SLOT_IS_PAUSEABLE))) {
- Optional.of(tlvReader.getBoolean(ContextSpecificTag(TAG_SLOT_IS_PAUSEABLE)))
+ val slotIsPausable =
+ if (tlvReader.isNextTag(ContextSpecificTag(TAG_SLOT_IS_PAUSABLE))) {
+ Optional.of(tlvReader.getBoolean(ContextSpecificTag(TAG_SLOT_IS_PAUSABLE)))
} else {
Optional.empty()
}
@@ -257,7 +257,7 @@
defaultDuration,
elapsedSlotTime,
remainingSlotTime,
- slotIsPauseable,
+ slotIsPausable,
minPauseDuration,
maxPauseDuration,
manufacturerESAState,
diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/DeviceEnergyManagementCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/DeviceEnergyManagementCluster.kt
index eb68ec4..6549ec0 100644
--- a/src/controller/java/generated/java/matter/controller/cluster/clusters/DeviceEnergyManagementCluster.kt
+++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/DeviceEnergyManagementCluster.kt
@@ -47,11 +47,11 @@
private val endpointId: UShort
) {
class PowerAdjustmentCapabilityAttribute(
- val value: List<DeviceEnergyManagementClusterPowerAdjustStruct>?
+ val value: DeviceEnergyManagementClusterPowerAdjustCapabilityStruct?
)
sealed class PowerAdjustmentCapabilityAttributeSubscriptionState {
- data class Success(val value: List<DeviceEnergyManagementClusterPowerAdjustStruct>?) :
+ data class Success(val value: DeviceEnergyManagementClusterPowerAdjustCapabilityStruct?) :
PowerAdjustmentCapabilityAttributeSubscriptionState()
data class Error(val exception: Exception) :
@@ -232,7 +232,7 @@
}
suspend fun modifyForecastRequest(
- forecastId: UInt,
+ forecastID: UInt,
slotAdjustments: List<DeviceEnergyManagementClusterSlotAdjustmentStruct>,
cause: UByte,
timedInvokeTimeout: Duration? = null
@@ -242,8 +242,8 @@
val tlvWriter = TlvWriter()
tlvWriter.startStructure(AnonymousTag)
- val TAG_FORECAST_ID_REQ: Int = 0
- tlvWriter.put(ContextSpecificTag(TAG_FORECAST_ID_REQ), forecastId)
+ val TAG_FORECAST_I_D_REQ: Int = 0
+ tlvWriter.put(ContextSpecificTag(TAG_FORECAST_I_D_REQ), forecastID)
val TAG_SLOT_ADJUSTMENTS_REQ: Int = 1
tlvWriter.startArray(ContextSpecificTag(TAG_SLOT_ADJUSTMENTS_REQ))
@@ -750,16 +750,10 @@
// Decode the TLV data into the appropriate type
val tlvReader = TlvReader(attributeData.data)
- val decodedValue: List<DeviceEnergyManagementClusterPowerAdjustStruct>? =
+ val decodedValue: DeviceEnergyManagementClusterPowerAdjustCapabilityStruct? =
if (!tlvReader.isNull()) {
if (tlvReader.isNextTag(AnonymousTag)) {
- buildList<DeviceEnergyManagementClusterPowerAdjustStruct> {
- tlvReader.enterArray(AnonymousTag)
- while (!tlvReader.isEndOfContainer()) {
- add(DeviceEnergyManagementClusterPowerAdjustStruct.fromTlv(AnonymousTag, tlvReader))
- }
- tlvReader.exitContainer()
- }
+ DeviceEnergyManagementClusterPowerAdjustCapabilityStruct.fromTlv(AnonymousTag, tlvReader)
} else {
null
}
@@ -812,21 +806,13 @@
// Decode the TLV data into the appropriate type
val tlvReader = TlvReader(attributeData.data)
- val decodedValue: List<DeviceEnergyManagementClusterPowerAdjustStruct>? =
+ val decodedValue: DeviceEnergyManagementClusterPowerAdjustCapabilityStruct? =
if (!tlvReader.isNull()) {
if (tlvReader.isNextTag(AnonymousTag)) {
- buildList<DeviceEnergyManagementClusterPowerAdjustStruct> {
- tlvReader.enterArray(AnonymousTag)
- while (!tlvReader.isEndOfContainer()) {
- add(
- DeviceEnergyManagementClusterPowerAdjustStruct.fromTlv(
- AnonymousTag,
- tlvReader
- )
- )
- }
- tlvReader.exitContainer()
- }
+ DeviceEnergyManagementClusterPowerAdjustCapabilityStruct.fromTlv(
+ AnonymousTag,
+ tlvReader
+ )
} else {
null
}
diff --git a/src/controller/java/generated/java/matter/controller/cluster/files.gni b/src/controller/java/generated/java/matter/controller/cluster/files.gni
index 6190897..ff3afa7 100644
--- a/src/controller/java/generated/java/matter/controller/cluster/files.gni
+++ b/src/controller/java/generated/java/matter/controller/cluster/files.gni
@@ -47,6 +47,7 @@
"${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/DeviceEnergyManagementClusterConstraintsStruct.kt",
"${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/DeviceEnergyManagementClusterCostStruct.kt",
"${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/DeviceEnergyManagementClusterForecastStruct.kt",
+ "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/DeviceEnergyManagementClusterPowerAdjustCapabilityStruct.kt",
"${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/DeviceEnergyManagementClusterPowerAdjustStruct.kt",
"${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/DeviceEnergyManagementClusterSlotAdjustmentStruct.kt",
"${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/DeviceEnergyManagementClusterSlotStruct.kt",
diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/DeviceEnergyManagementClusterForecastStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/DeviceEnergyManagementClusterForecastStruct.kt
index a83d26e..f78288a 100644
--- a/src/controller/java/generated/java/matter/controller/cluster/structs/DeviceEnergyManagementClusterForecastStruct.kt
+++ b/src/controller/java/generated/java/matter/controller/cluster/structs/DeviceEnergyManagementClusterForecastStruct.kt
@@ -25,25 +25,25 @@
import matter.tlv.TlvWriter
class DeviceEnergyManagementClusterForecastStruct(
- val forecastId: UShort,
+ val forecastID: UInt,
val activeSlotNumber: UShort?,
val startTime: UInt,
val endTime: UInt,
val earliestStartTime: Optional<UInt>?,
val latestEndTime: Optional<UInt>,
- val isPauseable: Boolean,
+ val isPausable: Boolean,
val slots: List<DeviceEnergyManagementClusterSlotStruct>,
val forecastUpdateReason: UByte
) {
override fun toString(): String = buildString {
append("DeviceEnergyManagementClusterForecastStruct {\n")
- append("\tforecastId : $forecastId\n")
+ append("\tforecastID : $forecastID\n")
append("\tactiveSlotNumber : $activeSlotNumber\n")
append("\tstartTime : $startTime\n")
append("\tendTime : $endTime\n")
append("\tearliestStartTime : $earliestStartTime\n")
append("\tlatestEndTime : $latestEndTime\n")
- append("\tisPauseable : $isPauseable\n")
+ append("\tisPausable : $isPausable\n")
append("\tslots : $slots\n")
append("\tforecastUpdateReason : $forecastUpdateReason\n")
append("}\n")
@@ -52,7 +52,7 @@
fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) {
tlvWriter.apply {
startStructure(tlvTag)
- put(ContextSpecificTag(TAG_FORECAST_ID), forecastId)
+ put(ContextSpecificTag(TAG_FORECAST_I_D), forecastID)
if (activeSlotNumber != null) {
put(ContextSpecificTag(TAG_ACTIVE_SLOT_NUMBER), activeSlotNumber)
} else {
@@ -72,7 +72,7 @@
val optlatestEndTime = latestEndTime.get()
put(ContextSpecificTag(TAG_LATEST_END_TIME), optlatestEndTime)
}
- put(ContextSpecificTag(TAG_IS_PAUSEABLE), isPauseable)
+ put(ContextSpecificTag(TAG_IS_PAUSABLE), isPausable)
startArray(ContextSpecificTag(TAG_SLOTS))
for (item in slots.iterator()) {
item.toTlv(AnonymousTag, this)
@@ -84,19 +84,19 @@
}
companion object {
- private const val TAG_FORECAST_ID = 0
+ private const val TAG_FORECAST_I_D = 0
private const val TAG_ACTIVE_SLOT_NUMBER = 1
private const val TAG_START_TIME = 2
private const val TAG_END_TIME = 3
private const val TAG_EARLIEST_START_TIME = 4
private const val TAG_LATEST_END_TIME = 5
- private const val TAG_IS_PAUSEABLE = 6
+ private const val TAG_IS_PAUSABLE = 6
private const val TAG_SLOTS = 7
private const val TAG_FORECAST_UPDATE_REASON = 8
fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): DeviceEnergyManagementClusterForecastStruct {
tlvReader.enterStructure(tlvTag)
- val forecastId = tlvReader.getUShort(ContextSpecificTag(TAG_FORECAST_ID))
+ val forecastID = tlvReader.getUInt(ContextSpecificTag(TAG_FORECAST_I_D))
val activeSlotNumber =
if (!tlvReader.isNull()) {
tlvReader.getUShort(ContextSpecificTag(TAG_ACTIVE_SLOT_NUMBER))
@@ -123,7 +123,7 @@
} else {
Optional.empty()
}
- val isPauseable = tlvReader.getBoolean(ContextSpecificTag(TAG_IS_PAUSEABLE))
+ val isPausable = tlvReader.getBoolean(ContextSpecificTag(TAG_IS_PAUSABLE))
val slots =
buildList<DeviceEnergyManagementClusterSlotStruct> {
tlvReader.enterArray(ContextSpecificTag(TAG_SLOTS))
@@ -137,13 +137,13 @@
tlvReader.exitContainer()
return DeviceEnergyManagementClusterForecastStruct(
- forecastId,
+ forecastID,
activeSlotNumber,
startTime,
endTime,
earliestStartTime,
latestEndTime,
- isPauseable,
+ isPausable,
slots,
forecastUpdateReason
)
diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/DeviceEnergyManagementClusterPowerAdjustCapabilityStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/DeviceEnergyManagementClusterPowerAdjustCapabilityStruct.kt
new file mode 100644
index 0000000..eda6c16
--- /dev/null
+++ b/src/controller/java/generated/java/matter/controller/cluster/structs/DeviceEnergyManagementClusterPowerAdjustCapabilityStruct.kt
@@ -0,0 +1,83 @@
+/*
+ *
+ * Copyright (c) 2023 Project CHIP Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package matter.controller.cluster.structs
+
+import matter.controller.cluster.*
+import matter.tlv.AnonymousTag
+import matter.tlv.ContextSpecificTag
+import matter.tlv.Tag
+import matter.tlv.TlvReader
+import matter.tlv.TlvWriter
+
+class DeviceEnergyManagementClusterPowerAdjustCapabilityStruct(
+ val powerAdjustCapability: List<DeviceEnergyManagementClusterPowerAdjustStruct>?,
+ val cause: UByte
+) {
+ override fun toString(): String = buildString {
+ append("DeviceEnergyManagementClusterPowerAdjustCapabilityStruct {\n")
+ append("\tpowerAdjustCapability : $powerAdjustCapability\n")
+ append("\tcause : $cause\n")
+ append("}\n")
+ }
+
+ fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) {
+ tlvWriter.apply {
+ startStructure(tlvTag)
+ if (powerAdjustCapability != null) {
+ startArray(ContextSpecificTag(TAG_POWER_ADJUST_CAPABILITY))
+ for (item in powerAdjustCapability.iterator()) {
+ item.toTlv(AnonymousTag, this)
+ }
+ endArray()
+ } else {
+ putNull(ContextSpecificTag(TAG_POWER_ADJUST_CAPABILITY))
+ }
+ put(ContextSpecificTag(TAG_CAUSE), cause)
+ endStructure()
+ }
+ }
+
+ companion object {
+ private const val TAG_POWER_ADJUST_CAPABILITY = 0
+ private const val TAG_CAUSE = 1
+
+ fun fromTlv(
+ tlvTag: Tag,
+ tlvReader: TlvReader
+ ): DeviceEnergyManagementClusterPowerAdjustCapabilityStruct {
+ tlvReader.enterStructure(tlvTag)
+ val powerAdjustCapability =
+ if (!tlvReader.isNull()) {
+ buildList<DeviceEnergyManagementClusterPowerAdjustStruct> {
+ tlvReader.enterArray(ContextSpecificTag(TAG_POWER_ADJUST_CAPABILITY))
+ while (!tlvReader.isEndOfContainer()) {
+ add(DeviceEnergyManagementClusterPowerAdjustStruct.fromTlv(AnonymousTag, tlvReader))
+ }
+ tlvReader.exitContainer()
+ }
+ } else {
+ tlvReader.getNull(ContextSpecificTag(TAG_POWER_ADJUST_CAPABILITY))
+ null
+ }
+ val cause = tlvReader.getUByte(ContextSpecificTag(TAG_CAUSE))
+
+ tlvReader.exitContainer()
+
+ return DeviceEnergyManagementClusterPowerAdjustCapabilityStruct(powerAdjustCapability, cause)
+ }
+ }
+}
diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/DeviceEnergyManagementClusterSlotAdjustmentStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/DeviceEnergyManagementClusterSlotAdjustmentStruct.kt
index e11febd..5d4cef6 100644
--- a/src/controller/java/generated/java/matter/controller/cluster/structs/DeviceEnergyManagementClusterSlotAdjustmentStruct.kt
+++ b/src/controller/java/generated/java/matter/controller/cluster/structs/DeviceEnergyManagementClusterSlotAdjustmentStruct.kt
@@ -16,6 +16,7 @@
*/
package matter.controller.cluster.structs
+import java.util.Optional
import matter.controller.cluster.*
import matter.tlv.ContextSpecificTag
import matter.tlv.Tag
@@ -24,7 +25,7 @@
class DeviceEnergyManagementClusterSlotAdjustmentStruct(
val slotIndex: UByte,
- val nominalPower: Long,
+ val nominalPower: Optional<Long>,
val duration: UInt
) {
override fun toString(): String = buildString {
@@ -39,7 +40,10 @@
tlvWriter.apply {
startStructure(tlvTag)
put(ContextSpecificTag(TAG_SLOT_INDEX), slotIndex)
- put(ContextSpecificTag(TAG_NOMINAL_POWER), nominalPower)
+ if (nominalPower.isPresent) {
+ val optnominalPower = nominalPower.get()
+ put(ContextSpecificTag(TAG_NOMINAL_POWER), optnominalPower)
+ }
put(ContextSpecificTag(TAG_DURATION), duration)
endStructure()
}
@@ -56,7 +60,12 @@
): DeviceEnergyManagementClusterSlotAdjustmentStruct {
tlvReader.enterStructure(tlvTag)
val slotIndex = tlvReader.getUByte(ContextSpecificTag(TAG_SLOT_INDEX))
- val nominalPower = tlvReader.getLong(ContextSpecificTag(TAG_NOMINAL_POWER))
+ val nominalPower =
+ if (tlvReader.isNextTag(ContextSpecificTag(TAG_NOMINAL_POWER))) {
+ Optional.of(tlvReader.getLong(ContextSpecificTag(TAG_NOMINAL_POWER)))
+ } else {
+ Optional.empty()
+ }
val duration = tlvReader.getUInt(ContextSpecificTag(TAG_DURATION))
tlvReader.exitContainer()
diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/DeviceEnergyManagementClusterSlotStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/DeviceEnergyManagementClusterSlotStruct.kt
index 992a415..7759d96 100644
--- a/src/controller/java/generated/java/matter/controller/cluster/structs/DeviceEnergyManagementClusterSlotStruct.kt
+++ b/src/controller/java/generated/java/matter/controller/cluster/structs/DeviceEnergyManagementClusterSlotStruct.kt
@@ -30,7 +30,7 @@
val defaultDuration: UInt,
val elapsedSlotTime: UInt,
val remainingSlotTime: UInt,
- val slotIsPauseable: Optional<Boolean>,
+ val slotIsPausable: Optional<Boolean>,
val minPauseDuration: Optional<UInt>,
val maxPauseDuration: Optional<UInt>,
val manufacturerESAState: Optional<UShort>,
@@ -51,7 +51,7 @@
append("\tdefaultDuration : $defaultDuration\n")
append("\telapsedSlotTime : $elapsedSlotTime\n")
append("\tremainingSlotTime : $remainingSlotTime\n")
- append("\tslotIsPauseable : $slotIsPauseable\n")
+ append("\tslotIsPausable : $slotIsPausable\n")
append("\tminPauseDuration : $minPauseDuration\n")
append("\tmaxPauseDuration : $maxPauseDuration\n")
append("\tmanufacturerESAState : $manufacturerESAState\n")
@@ -75,9 +75,9 @@
put(ContextSpecificTag(TAG_DEFAULT_DURATION), defaultDuration)
put(ContextSpecificTag(TAG_ELAPSED_SLOT_TIME), elapsedSlotTime)
put(ContextSpecificTag(TAG_REMAINING_SLOT_TIME), remainingSlotTime)
- if (slotIsPauseable.isPresent) {
- val optslotIsPauseable = slotIsPauseable.get()
- put(ContextSpecificTag(TAG_SLOT_IS_PAUSEABLE), optslotIsPauseable)
+ if (slotIsPausable.isPresent) {
+ val optslotIsPausable = slotIsPausable.get()
+ put(ContextSpecificTag(TAG_SLOT_IS_PAUSABLE), optslotIsPausable)
}
if (minPauseDuration.isPresent) {
val optminPauseDuration = minPauseDuration.get()
@@ -141,7 +141,7 @@
private const val TAG_DEFAULT_DURATION = 2
private const val TAG_ELAPSED_SLOT_TIME = 3
private const val TAG_REMAINING_SLOT_TIME = 4
- private const val TAG_SLOT_IS_PAUSEABLE = 5
+ private const val TAG_SLOT_IS_PAUSABLE = 5
private const val TAG_MIN_PAUSE_DURATION = 6
private const val TAG_MAX_PAUSE_DURATION = 7
private const val TAG_MANUFACTURER_E_S_A_STATE = 8
@@ -162,9 +162,9 @@
val defaultDuration = tlvReader.getUInt(ContextSpecificTag(TAG_DEFAULT_DURATION))
val elapsedSlotTime = tlvReader.getUInt(ContextSpecificTag(TAG_ELAPSED_SLOT_TIME))
val remainingSlotTime = tlvReader.getUInt(ContextSpecificTag(TAG_REMAINING_SLOT_TIME))
- val slotIsPauseable =
- if (tlvReader.isNextTag(ContextSpecificTag(TAG_SLOT_IS_PAUSEABLE))) {
- Optional.of(tlvReader.getBoolean(ContextSpecificTag(TAG_SLOT_IS_PAUSEABLE)))
+ val slotIsPausable =
+ if (tlvReader.isNextTag(ContextSpecificTag(TAG_SLOT_IS_PAUSABLE))) {
+ Optional.of(tlvReader.getBoolean(ContextSpecificTag(TAG_SLOT_IS_PAUSABLE)))
} else {
Optional.empty()
}
@@ -257,7 +257,7 @@
defaultDuration,
elapsedSlotTime,
remainingSlotTime,
- slotIsPauseable,
+ slotIsPausable,
minPauseDuration,
maxPauseDuration,
manufacturerESAState,
diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp
index 894be24..6f9ee58 100644
--- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp
+++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp
@@ -23441,67 +23441,106 @@
}
else
{
- chip::JniReferences::GetInstance().CreateArrayList(value);
-
- auto iter_value_1 = cppValue.Value().begin();
- while (iter_value_1.Next())
+ jobject value_powerAdjustCapability;
+ if (cppValue.Value().powerAdjustCapability.IsNull())
{
- auto & entry_1 = iter_value_1.GetValue();
- jobject newElement_1;
- jobject newElement_1_minPower;
- std::string newElement_1_minPowerClassName = "java/lang/Long";
- std::string newElement_1_minPowerCtorSignature = "(J)V";
- jlong jninewElement_1_minPower = static_cast<jlong>(entry_1.minPower);
- chip::JniReferences::GetInstance().CreateBoxedObject<jlong>(newElement_1_minPowerClassName.c_str(),
- newElement_1_minPowerCtorSignature.c_str(),
- jninewElement_1_minPower, newElement_1_minPower);
- jobject newElement_1_maxPower;
- std::string newElement_1_maxPowerClassName = "java/lang/Long";
- std::string newElement_1_maxPowerCtorSignature = "(J)V";
- jlong jninewElement_1_maxPower = static_cast<jlong>(entry_1.maxPower);
- chip::JniReferences::GetInstance().CreateBoxedObject<jlong>(newElement_1_maxPowerClassName.c_str(),
- newElement_1_maxPowerCtorSignature.c_str(),
- jninewElement_1_maxPower, newElement_1_maxPower);
- jobject newElement_1_minDuration;
- std::string newElement_1_minDurationClassName = "java/lang/Long";
- std::string newElement_1_minDurationCtorSignature = "(J)V";
- jlong jninewElement_1_minDuration = static_cast<jlong>(entry_1.minDuration);
- chip::JniReferences::GetInstance().CreateBoxedObject<jlong>(
- newElement_1_minDurationClassName.c_str(), newElement_1_minDurationCtorSignature.c_str(),
- jninewElement_1_minDuration, newElement_1_minDuration);
- jobject newElement_1_maxDuration;
- std::string newElement_1_maxDurationClassName = "java/lang/Long";
- std::string newElement_1_maxDurationCtorSignature = "(J)V";
- jlong jninewElement_1_maxDuration = static_cast<jlong>(entry_1.maxDuration);
- chip::JniReferences::GetInstance().CreateBoxedObject<jlong>(
- newElement_1_maxDurationClassName.c_str(), newElement_1_maxDurationCtorSignature.c_str(),
- jninewElement_1_maxDuration, newElement_1_maxDuration);
-
- jclass powerAdjustStructStructClass_2;
- err = chip::JniReferences::GetInstance().GetLocalClassRef(
- env, "chip/devicecontroller/ChipStructs$DeviceEnergyManagementClusterPowerAdjustStruct",
- powerAdjustStructStructClass_2);
- if (err != CHIP_NO_ERROR)
- {
- ChipLogError(Zcl, "Could not find class ChipStructs$DeviceEnergyManagementClusterPowerAdjustStruct");
- return nullptr;
- }
-
- jmethodID powerAdjustStructStructCtor_2;
- err = chip::JniReferences::GetInstance().FindMethod(
- env, powerAdjustStructStructClass_2, "<init>",
- "(Ljava/lang/Long;Ljava/lang/Long;Ljava/lang/Long;Ljava/lang/Long;)V", &powerAdjustStructStructCtor_2);
- if (err != CHIP_NO_ERROR || powerAdjustStructStructCtor_2 == nullptr)
- {
- ChipLogError(Zcl, "Could not find ChipStructs$DeviceEnergyManagementClusterPowerAdjustStruct constructor");
- return nullptr;
- }
-
- newElement_1 =
- env->NewObject(powerAdjustStructStructClass_2, powerAdjustStructStructCtor_2, newElement_1_minPower,
- newElement_1_maxPower, newElement_1_minDuration, newElement_1_maxDuration);
- chip::JniReferences::GetInstance().AddToList(value, newElement_1);
+ value_powerAdjustCapability = nullptr;
}
+ else
+ {
+ chip::JniReferences::GetInstance().CreateArrayList(value_powerAdjustCapability);
+
+ auto iter_value_powerAdjustCapability_3 = cppValue.Value().powerAdjustCapability.Value().begin();
+ while (iter_value_powerAdjustCapability_3.Next())
+ {
+ auto & entry_3 = iter_value_powerAdjustCapability_3.GetValue();
+ jobject newElement_3;
+ jobject newElement_3_minPower;
+ std::string newElement_3_minPowerClassName = "java/lang/Long";
+ std::string newElement_3_minPowerCtorSignature = "(J)V";
+ jlong jninewElement_3_minPower = static_cast<jlong>(entry_3.minPower);
+ chip::JniReferences::GetInstance().CreateBoxedObject<jlong>(
+ newElement_3_minPowerClassName.c_str(), newElement_3_minPowerCtorSignature.c_str(),
+ jninewElement_3_minPower, newElement_3_minPower);
+ jobject newElement_3_maxPower;
+ std::string newElement_3_maxPowerClassName = "java/lang/Long";
+ std::string newElement_3_maxPowerCtorSignature = "(J)V";
+ jlong jninewElement_3_maxPower = static_cast<jlong>(entry_3.maxPower);
+ chip::JniReferences::GetInstance().CreateBoxedObject<jlong>(
+ newElement_3_maxPowerClassName.c_str(), newElement_3_maxPowerCtorSignature.c_str(),
+ jninewElement_3_maxPower, newElement_3_maxPower);
+ jobject newElement_3_minDuration;
+ std::string newElement_3_minDurationClassName = "java/lang/Long";
+ std::string newElement_3_minDurationCtorSignature = "(J)V";
+ jlong jninewElement_3_minDuration = static_cast<jlong>(entry_3.minDuration);
+ chip::JniReferences::GetInstance().CreateBoxedObject<jlong>(
+ newElement_3_minDurationClassName.c_str(), newElement_3_minDurationCtorSignature.c_str(),
+ jninewElement_3_minDuration, newElement_3_minDuration);
+ jobject newElement_3_maxDuration;
+ std::string newElement_3_maxDurationClassName = "java/lang/Long";
+ std::string newElement_3_maxDurationCtorSignature = "(J)V";
+ jlong jninewElement_3_maxDuration = static_cast<jlong>(entry_3.maxDuration);
+ chip::JniReferences::GetInstance().CreateBoxedObject<jlong>(
+ newElement_3_maxDurationClassName.c_str(), newElement_3_maxDurationCtorSignature.c_str(),
+ jninewElement_3_maxDuration, newElement_3_maxDuration);
+
+ jclass powerAdjustStructStructClass_4;
+ err = chip::JniReferences::GetInstance().GetLocalClassRef(
+ env, "chip/devicecontroller/ChipStructs$DeviceEnergyManagementClusterPowerAdjustStruct",
+ powerAdjustStructStructClass_4);
+ if (err != CHIP_NO_ERROR)
+ {
+ ChipLogError(Zcl, "Could not find class ChipStructs$DeviceEnergyManagementClusterPowerAdjustStruct");
+ return nullptr;
+ }
+
+ jmethodID powerAdjustStructStructCtor_4;
+ err = chip::JniReferences::GetInstance().FindMethod(
+ env, powerAdjustStructStructClass_4, "<init>",
+ "(Ljava/lang/Long;Ljava/lang/Long;Ljava/lang/Long;Ljava/lang/Long;)V", &powerAdjustStructStructCtor_4);
+ if (err != CHIP_NO_ERROR || powerAdjustStructStructCtor_4 == nullptr)
+ {
+ ChipLogError(Zcl,
+ "Could not find ChipStructs$DeviceEnergyManagementClusterPowerAdjustStruct constructor");
+ return nullptr;
+ }
+
+ newElement_3 =
+ env->NewObject(powerAdjustStructStructClass_4, powerAdjustStructStructCtor_4, newElement_3_minPower,
+ newElement_3_maxPower, newElement_3_minDuration, newElement_3_maxDuration);
+ chip::JniReferences::GetInstance().AddToList(value_powerAdjustCapability, newElement_3);
+ }
+ }
+ jobject value_cause;
+ std::string value_causeClassName = "java/lang/Integer";
+ std::string value_causeCtorSignature = "(I)V";
+ jint jnivalue_cause = static_cast<jint>(cppValue.Value().cause);
+ chip::JniReferences::GetInstance().CreateBoxedObject<jint>(
+ value_causeClassName.c_str(), value_causeCtorSignature.c_str(), jnivalue_cause, value_cause);
+
+ jclass powerAdjustCapabilityStructStructClass_1;
+ err = chip::JniReferences::GetInstance().GetLocalClassRef(
+ env, "chip/devicecontroller/ChipStructs$DeviceEnergyManagementClusterPowerAdjustCapabilityStruct",
+ powerAdjustCapabilityStructStructClass_1);
+ if (err != CHIP_NO_ERROR)
+ {
+ ChipLogError(Zcl, "Could not find class ChipStructs$DeviceEnergyManagementClusterPowerAdjustCapabilityStruct");
+ return nullptr;
+ }
+
+ jmethodID powerAdjustCapabilityStructStructCtor_1;
+ err = chip::JniReferences::GetInstance().FindMethod(env, powerAdjustCapabilityStructStructClass_1, "<init>",
+ "(Ljava/util/ArrayList;Ljava/lang/Integer;)V",
+ &powerAdjustCapabilityStructStructCtor_1);
+ if (err != CHIP_NO_ERROR || powerAdjustCapabilityStructStructCtor_1 == nullptr)
+ {
+ ChipLogError(Zcl,
+ "Could not find ChipStructs$DeviceEnergyManagementClusterPowerAdjustCapabilityStruct constructor");
+ return nullptr;
+ }
+
+ value = env->NewObject(powerAdjustCapabilityStructStructClass_1, powerAdjustCapabilityStructStructCtor_1,
+ value_powerAdjustCapability, value_cause);
}
return value;
}
@@ -23520,13 +23559,13 @@
}
else
{
- jobject value_forecastId;
- std::string value_forecastIdClassName = "java/lang/Integer";
- std::string value_forecastIdCtorSignature = "(I)V";
- jint jnivalue_forecastId = static_cast<jint>(cppValue.Value().forecastId);
- chip::JniReferences::GetInstance().CreateBoxedObject<jint>(value_forecastIdClassName.c_str(),
- value_forecastIdCtorSignature.c_str(),
- jnivalue_forecastId, value_forecastId);
+ jobject value_forecastID;
+ std::string value_forecastIDClassName = "java/lang/Long";
+ std::string value_forecastIDCtorSignature = "(J)V";
+ jlong jnivalue_forecastID = static_cast<jlong>(cppValue.Value().forecastID);
+ chip::JniReferences::GetInstance().CreateBoxedObject<jlong>(value_forecastIDClassName.c_str(),
+ value_forecastIDCtorSignature.c_str(),
+ jnivalue_forecastID, value_forecastID);
jobject value_activeSlotNumber;
if (cppValue.Value().activeSlotNumber.IsNull())
{
@@ -23595,13 +23634,13 @@
jnivalue_latestEndTimeInsideOptional, value_latestEndTimeInsideOptional);
chip::JniReferences::GetInstance().CreateOptional(value_latestEndTimeInsideOptional, value_latestEndTime);
}
- jobject value_isPauseable;
- std::string value_isPauseableClassName = "java/lang/Boolean";
- std::string value_isPauseableCtorSignature = "(Z)V";
- jboolean jnivalue_isPauseable = static_cast<jboolean>(cppValue.Value().isPauseable);
- chip::JniReferences::GetInstance().CreateBoxedObject<jboolean>(value_isPauseableClassName.c_str(),
- value_isPauseableCtorSignature.c_str(),
- jnivalue_isPauseable, value_isPauseable);
+ jobject value_isPausable;
+ std::string value_isPausableClassName = "java/lang/Boolean";
+ std::string value_isPausableCtorSignature = "(Z)V";
+ jboolean jnivalue_isPausable = static_cast<jboolean>(cppValue.Value().isPausable);
+ chip::JniReferences::GetInstance().CreateBoxedObject<jboolean>(value_isPausableClassName.c_str(),
+ value_isPausableCtorSignature.c_str(),
+ jnivalue_isPausable, value_isPausable);
jobject value_slots;
chip::JniReferences::GetInstance().CreateArrayList(value_slots);
@@ -23645,24 +23684,24 @@
chip::JniReferences::GetInstance().CreateBoxedObject<jlong>(
newElement_2_remainingSlotTimeClassName.c_str(), newElement_2_remainingSlotTimeCtorSignature.c_str(),
jninewElement_2_remainingSlotTime, newElement_2_remainingSlotTime);
- jobject newElement_2_slotIsPauseable;
- if (!entry_2.slotIsPauseable.HasValue())
+ jobject newElement_2_slotIsPausable;
+ if (!entry_2.slotIsPausable.HasValue())
{
- chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_slotIsPauseable);
+ chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_slotIsPausable);
}
else
{
- jobject newElement_2_slotIsPauseableInsideOptional;
- std::string newElement_2_slotIsPauseableInsideOptionalClassName = "java/lang/Boolean";
- std::string newElement_2_slotIsPauseableInsideOptionalCtorSignature = "(Z)V";
- jboolean jninewElement_2_slotIsPauseableInsideOptional =
- static_cast<jboolean>(entry_2.slotIsPauseable.Value());
+ jobject newElement_2_slotIsPausableInsideOptional;
+ std::string newElement_2_slotIsPausableInsideOptionalClassName = "java/lang/Boolean";
+ std::string newElement_2_slotIsPausableInsideOptionalCtorSignature = "(Z)V";
+ jboolean jninewElement_2_slotIsPausableInsideOptional =
+ static_cast<jboolean>(entry_2.slotIsPausable.Value());
chip::JniReferences::GetInstance().CreateBoxedObject<jboolean>(
- newElement_2_slotIsPauseableInsideOptionalClassName.c_str(),
- newElement_2_slotIsPauseableInsideOptionalCtorSignature.c_str(),
- jninewElement_2_slotIsPauseableInsideOptional, newElement_2_slotIsPauseableInsideOptional);
- chip::JniReferences::GetInstance().CreateOptional(newElement_2_slotIsPauseableInsideOptional,
- newElement_2_slotIsPauseable);
+ newElement_2_slotIsPausableInsideOptionalClassName.c_str(),
+ newElement_2_slotIsPausableInsideOptionalCtorSignature.c_str(),
+ jninewElement_2_slotIsPausableInsideOptional, newElement_2_slotIsPausableInsideOptional);
+ chip::JniReferences::GetInstance().CreateOptional(newElement_2_slotIsPausableInsideOptional,
+ newElement_2_slotIsPausable);
}
jobject newElement_2_minPauseDuration;
if (!entry_2.minPauseDuration.HasValue())
@@ -23976,7 +24015,7 @@
newElement_2 = env->NewObject(
slotStructStructClass_3, slotStructStructCtor_3, newElement_2_minDuration, newElement_2_maxDuration,
newElement_2_defaultDuration, newElement_2_elapsedSlotTime, newElement_2_remainingSlotTime,
- newElement_2_slotIsPauseable, newElement_2_minPauseDuration, newElement_2_maxPauseDuration,
+ newElement_2_slotIsPausable, newElement_2_minPauseDuration, newElement_2_maxPauseDuration,
newElement_2_manufacturerESAState, newElement_2_nominalPower, newElement_2_minPower, newElement_2_maxPower,
newElement_2_nominalEnergy, newElement_2_costs, newElement_2_minPowerAdjustment,
newElement_2_maxPowerAdjustment, newElement_2_minDurationAdjustment, newElement_2_maxDurationAdjustment);
@@ -24003,7 +24042,7 @@
jmethodID forecastStructStructCtor_1;
err = chip::JniReferences::GetInstance().FindMethod(
env, forecastStructStructClass_1, "<init>",
- "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Long;Ljava/lang/Long;Ljava/util/Optional;Ljava/util/"
+ "(Ljava/lang/Long;Ljava/lang/Integer;Ljava/lang/Long;Ljava/lang/Long;Ljava/util/Optional;Ljava/util/"
"Optional;Ljava/lang/Boolean;Ljava/util/ArrayList;Ljava/lang/Integer;)V",
&forecastStructStructCtor_1);
if (err != CHIP_NO_ERROR || forecastStructStructCtor_1 == nullptr)
@@ -24012,9 +24051,9 @@
return nullptr;
}
- value = env->NewObject(forecastStructStructClass_1, forecastStructStructCtor_1, value_forecastId,
+ value = env->NewObject(forecastStructStructClass_1, forecastStructStructCtor_1, value_forecastID,
value_activeSlotNumber, value_startTime, value_endTime, value_earliestStartTime,
- value_latestEndTime, value_isPauseable, value_slots, value_forecastUpdateReason);
+ value_latestEndTime, value_isPausable, value_slots, value_forecastUpdateReason);
}
return value;
}
diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py
index 33a1dd9..c89a767 100644
--- a/src/controller/python/chip/clusters/CHIPClusters.py
+++ b/src/controller/python/chip/clusters/CHIPClusters.py
@@ -6829,7 +6829,7 @@
"commandId": 0x00000005,
"commandName": "ModifyForecastRequest",
"args": {
- "forecastId": "int",
+ "forecastID": "int",
"slotAdjustments": "SlotAdjustmentStruct",
"cause": "int",
},
diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py
index b3239f3..0c84c46 100644
--- a/src/controller/python/chip/clusters/Objects.py
+++ b/src/controller/python/chip/clusters/Objects.py
@@ -24138,7 +24138,7 @@
ClusterObjectFieldDescriptor(Label="ESAState", Tag=0x00000002, Type=DeviceEnergyManagement.Enums.ESAStateEnum),
ClusterObjectFieldDescriptor(Label="absMinPower", Tag=0x00000003, Type=int),
ClusterObjectFieldDescriptor(Label="absMaxPower", Tag=0x00000004, Type=int),
- ClusterObjectFieldDescriptor(Label="powerAdjustmentCapability", Tag=0x00000005, Type=typing.Union[None, Nullable, typing.List[DeviceEnergyManagement.Structs.PowerAdjustStruct]]),
+ ClusterObjectFieldDescriptor(Label="powerAdjustmentCapability", Tag=0x00000005, Type=typing.Union[None, Nullable, DeviceEnergyManagement.Structs.PowerAdjustCapabilityStruct]),
ClusterObjectFieldDescriptor(Label="forecast", Tag=0x00000006, Type=typing.Union[None, Nullable, DeviceEnergyManagement.Structs.ForecastStruct]),
ClusterObjectFieldDescriptor(Label="optOutState", Tag=0x00000007, Type=typing.Optional[DeviceEnergyManagement.Enums.OptOutStateEnum]),
ClusterObjectFieldDescriptor(Label="generatedCommandList", Tag=0x0000FFF8, Type=typing.List[uint]),
@@ -24154,7 +24154,7 @@
ESAState: 'DeviceEnergyManagement.Enums.ESAStateEnum' = None
absMinPower: 'int' = None
absMaxPower: 'int' = None
- powerAdjustmentCapability: 'typing.Union[None, Nullable, typing.List[DeviceEnergyManagement.Structs.PowerAdjustStruct]]' = None
+ powerAdjustmentCapability: 'typing.Union[None, Nullable, DeviceEnergyManagement.Structs.PowerAdjustCapabilityStruct]' = None
forecast: 'typing.Union[None, Nullable, DeviceEnergyManagement.Structs.ForecastStruct]' = None
optOutState: 'typing.Optional[DeviceEnergyManagement.Enums.OptOutStateEnum]' = None
generatedCommandList: 'typing.List[uint]' = None
@@ -24252,6 +24252,16 @@
# enum value. This specific should never be transmitted.
kUnknownEnumValue = 4,
+ class PowerAdjustReasonEnum(MatterIntEnum):
+ kNoAdjustment = 0x00
+ kLocalOptimizationAdjustment = 0x01
+ kGridOptimizationAdjustment = 0x02
+ # All received enum values that are not listed above will be mapped
+ # to kUnknownEnumValue. This is a helper enum value that should only
+ # be used by code to process how it handles receiving and unknown
+ # enum value. This specific should never be transmitted.
+ kUnknownEnumValue = 3,
+
class Bitmaps:
class Feature(IntFlag):
kPowerAdjustment = 0x1
@@ -24281,6 +24291,36 @@
currency: 'typing.Optional[uint]' = None
@dataclass
+ class PowerAdjustStruct(ClusterObject):
+ @ChipUtility.classproperty
+ def descriptor(cls) -> ClusterObjectDescriptor:
+ return ClusterObjectDescriptor(
+ Fields=[
+ ClusterObjectFieldDescriptor(Label="minPower", Tag=0, Type=int),
+ ClusterObjectFieldDescriptor(Label="maxPower", Tag=1, Type=int),
+ ClusterObjectFieldDescriptor(Label="minDuration", Tag=2, Type=uint),
+ ClusterObjectFieldDescriptor(Label="maxDuration", Tag=3, Type=uint),
+ ])
+
+ minPower: 'int' = 0
+ maxPower: 'int' = 0
+ minDuration: 'uint' = 0
+ maxDuration: 'uint' = 0
+
+ @dataclass
+ class PowerAdjustCapabilityStruct(ClusterObject):
+ @ChipUtility.classproperty
+ def descriptor(cls) -> ClusterObjectDescriptor:
+ return ClusterObjectDescriptor(
+ Fields=[
+ ClusterObjectFieldDescriptor(Label="powerAdjustCapability", Tag=0, Type=typing.Union[Nullable, typing.List[DeviceEnergyManagement.Structs.PowerAdjustStruct]]),
+ ClusterObjectFieldDescriptor(Label="cause", Tag=1, Type=DeviceEnergyManagement.Enums.PowerAdjustReasonEnum),
+ ])
+
+ powerAdjustCapability: 'typing.Union[Nullable, typing.List[DeviceEnergyManagement.Structs.PowerAdjustStruct]]' = NullValue
+ cause: 'DeviceEnergyManagement.Enums.PowerAdjustReasonEnum' = 0
+
+ @dataclass
class SlotStruct(ClusterObject):
@ChipUtility.classproperty
def descriptor(cls) -> ClusterObjectDescriptor:
@@ -24291,7 +24331,7 @@
ClusterObjectFieldDescriptor(Label="defaultDuration", Tag=2, Type=uint),
ClusterObjectFieldDescriptor(Label="elapsedSlotTime", Tag=3, Type=uint),
ClusterObjectFieldDescriptor(Label="remainingSlotTime", Tag=4, Type=uint),
- ClusterObjectFieldDescriptor(Label="slotIsPauseable", Tag=5, Type=typing.Optional[bool]),
+ ClusterObjectFieldDescriptor(Label="slotIsPausable", Tag=5, Type=typing.Optional[bool]),
ClusterObjectFieldDescriptor(Label="minPauseDuration", Tag=6, Type=typing.Optional[uint]),
ClusterObjectFieldDescriptor(Label="maxPauseDuration", Tag=7, Type=typing.Optional[uint]),
ClusterObjectFieldDescriptor(Label="manufacturerESAState", Tag=8, Type=typing.Optional[uint]),
@@ -24311,7 +24351,7 @@
defaultDuration: 'uint' = 0
elapsedSlotTime: 'uint' = 0
remainingSlotTime: 'uint' = 0
- slotIsPauseable: 'typing.Optional[bool]' = None
+ slotIsPausable: 'typing.Optional[bool]' = None
minPauseDuration: 'typing.Optional[uint]' = None
maxPauseDuration: 'typing.Optional[uint]' = None
manufacturerESAState: 'typing.Optional[uint]' = None
@@ -24331,24 +24371,24 @@
def descriptor(cls) -> ClusterObjectDescriptor:
return ClusterObjectDescriptor(
Fields=[
- ClusterObjectFieldDescriptor(Label="forecastId", Tag=0, Type=uint),
+ ClusterObjectFieldDescriptor(Label="forecastID", Tag=0, Type=uint),
ClusterObjectFieldDescriptor(Label="activeSlotNumber", Tag=1, Type=typing.Union[Nullable, uint]),
ClusterObjectFieldDescriptor(Label="startTime", Tag=2, Type=uint),
ClusterObjectFieldDescriptor(Label="endTime", Tag=3, Type=uint),
ClusterObjectFieldDescriptor(Label="earliestStartTime", Tag=4, Type=typing.Union[None, Nullable, uint]),
ClusterObjectFieldDescriptor(Label="latestEndTime", Tag=5, Type=typing.Optional[uint]),
- ClusterObjectFieldDescriptor(Label="isPauseable", Tag=6, Type=bool),
+ ClusterObjectFieldDescriptor(Label="isPausable", Tag=6, Type=bool),
ClusterObjectFieldDescriptor(Label="slots", Tag=7, Type=typing.List[DeviceEnergyManagement.Structs.SlotStruct]),
ClusterObjectFieldDescriptor(Label="forecastUpdateReason", Tag=8, Type=DeviceEnergyManagement.Enums.ForecastUpdateReasonEnum),
])
- forecastId: 'uint' = 0
+ forecastID: 'uint' = 0
activeSlotNumber: 'typing.Union[Nullable, uint]' = NullValue
startTime: 'uint' = 0
endTime: 'uint' = 0
earliestStartTime: 'typing.Union[None, Nullable, uint]' = None
latestEndTime: 'typing.Optional[uint]' = None
- isPauseable: 'bool' = False
+ isPausable: 'bool' = False
slots: 'typing.List[DeviceEnergyManagement.Structs.SlotStruct]' = field(default_factory=lambda: [])
forecastUpdateReason: 'DeviceEnergyManagement.Enums.ForecastUpdateReasonEnum' = 0
@@ -24372,35 +24412,18 @@
loadControl: 'typing.Optional[int]' = None
@dataclass
- class PowerAdjustStruct(ClusterObject):
- @ChipUtility.classproperty
- def descriptor(cls) -> ClusterObjectDescriptor:
- return ClusterObjectDescriptor(
- Fields=[
- ClusterObjectFieldDescriptor(Label="minPower", Tag=0, Type=int),
- ClusterObjectFieldDescriptor(Label="maxPower", Tag=1, Type=int),
- ClusterObjectFieldDescriptor(Label="minDuration", Tag=2, Type=uint),
- ClusterObjectFieldDescriptor(Label="maxDuration", Tag=3, Type=uint),
- ])
-
- minPower: 'int' = 0
- maxPower: 'int' = 0
- minDuration: 'uint' = 0
- maxDuration: 'uint' = 0
-
- @dataclass
class SlotAdjustmentStruct(ClusterObject):
@ChipUtility.classproperty
def descriptor(cls) -> ClusterObjectDescriptor:
return ClusterObjectDescriptor(
Fields=[
ClusterObjectFieldDescriptor(Label="slotIndex", Tag=0, Type=uint),
- ClusterObjectFieldDescriptor(Label="nominalPower", Tag=1, Type=int),
+ ClusterObjectFieldDescriptor(Label="nominalPower", Tag=1, Type=typing.Optional[int]),
ClusterObjectFieldDescriptor(Label="duration", Tag=2, Type=uint),
])
slotIndex: 'uint' = 0
- nominalPower: 'int' = 0
+ nominalPower: 'typing.Optional[int]' = None
duration: 'uint' = 0
class Commands:
@@ -24497,12 +24520,12 @@
def descriptor(cls) -> ClusterObjectDescriptor:
return ClusterObjectDescriptor(
Fields=[
- ClusterObjectFieldDescriptor(Label="forecastId", Tag=0, Type=uint),
+ ClusterObjectFieldDescriptor(Label="forecastID", Tag=0, Type=uint),
ClusterObjectFieldDescriptor(Label="slotAdjustments", Tag=1, Type=typing.List[DeviceEnergyManagement.Structs.SlotAdjustmentStruct]),
ClusterObjectFieldDescriptor(Label="cause", Tag=2, Type=DeviceEnergyManagement.Enums.AdjustmentCauseEnum),
])
- forecastId: 'uint' = 0
+ forecastID: 'uint' = 0
slotAdjustments: 'typing.List[DeviceEnergyManagement.Structs.SlotAdjustmentStruct]' = field(default_factory=lambda: [])
cause: 'DeviceEnergyManagement.Enums.AdjustmentCauseEnum' = 0
@@ -24630,9 +24653,9 @@
@ChipUtility.classproperty
def attribute_type(cls) -> ClusterObjectFieldDescriptor:
- return ClusterObjectFieldDescriptor(Type=typing.Union[None, Nullable, typing.List[DeviceEnergyManagement.Structs.PowerAdjustStruct]])
+ return ClusterObjectFieldDescriptor(Type=typing.Union[None, Nullable, DeviceEnergyManagement.Structs.PowerAdjustCapabilityStruct])
- value: 'typing.Union[None, Nullable, typing.List[DeviceEnergyManagement.Structs.PowerAdjustStruct]]' = None
+ value: 'typing.Union[None, Nullable, DeviceEnergyManagement.Structs.PowerAdjustCapabilityStruct]' = None
@dataclass
class Forecast(ClusterAttributeDescriptor):
diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm
index 2b43b28..fdc2820 100644
--- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm
+++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm
@@ -8904,30 +8904,36 @@
if (*aError != CHIP_NO_ERROR) {
return nil;
}
- NSArray * _Nullable value;
+ MTRDeviceEnergyManagementClusterPowerAdjustCapabilityStruct * _Nullable value;
if (cppValue.IsNull()) {
value = nil;
} else {
- { // Scope for our temporary variables
- auto * array_1 = [NSMutableArray new];
- auto iter_1 = cppValue.Value().begin();
- while (iter_1.Next()) {
- auto & entry_1 = iter_1.GetValue();
- MTRDeviceEnergyManagementClusterPowerAdjustStruct * newElement_1;
- newElement_1 = [MTRDeviceEnergyManagementClusterPowerAdjustStruct new];
- newElement_1.minPower = [NSNumber numberWithLongLong:entry_1.minPower];
- newElement_1.maxPower = [NSNumber numberWithLongLong:entry_1.maxPower];
- newElement_1.minDuration = [NSNumber numberWithUnsignedInt:entry_1.minDuration];
- newElement_1.maxDuration = [NSNumber numberWithUnsignedInt:entry_1.maxDuration];
- [array_1 addObject:newElement_1];
+ value = [MTRDeviceEnergyManagementClusterPowerAdjustCapabilityStruct new];
+ if (cppValue.Value().powerAdjustCapability.IsNull()) {
+ value.powerAdjustCapability = nil;
+ } else {
+ { // Scope for our temporary variables
+ auto * array_3 = [NSMutableArray new];
+ auto iter_3 = cppValue.Value().powerAdjustCapability.Value().begin();
+ while (iter_3.Next()) {
+ auto & entry_3 = iter_3.GetValue();
+ MTRDeviceEnergyManagementClusterPowerAdjustStruct * newElement_3;
+ newElement_3 = [MTRDeviceEnergyManagementClusterPowerAdjustStruct new];
+ newElement_3.minPower = [NSNumber numberWithLongLong:entry_3.minPower];
+ newElement_3.maxPower = [NSNumber numberWithLongLong:entry_3.maxPower];
+ newElement_3.minDuration = [NSNumber numberWithUnsignedInt:entry_3.minDuration];
+ newElement_3.maxDuration = [NSNumber numberWithUnsignedInt:entry_3.maxDuration];
+ [array_3 addObject:newElement_3];
+ }
+ CHIP_ERROR err = iter_3.GetStatus();
+ if (err != CHIP_NO_ERROR) {
+ *aError = err;
+ return nil;
+ }
+ value.powerAdjustCapability = array_3;
}
- CHIP_ERROR err = iter_1.GetStatus();
- if (err != CHIP_NO_ERROR) {
- *aError = err;
- return nil;
- }
- value = array_1;
}
+ value.cause = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.Value().cause)];
}
return value;
}
@@ -8943,7 +8949,7 @@
value = nil;
} else {
value = [MTRDeviceEnergyManagementClusterForecastStruct new];
- value.forecastId = [NSNumber numberWithUnsignedShort:cppValue.Value().forecastId];
+ value.forecastID = [NSNumber numberWithUnsignedInt:cppValue.Value().forecastID];
if (cppValue.Value().activeSlotNumber.IsNull()) {
value.activeSlotNumber = nil;
} else {
@@ -8965,7 +8971,7 @@
} else {
value.latestEndTime = nil;
}
- value.isPauseable = [NSNumber numberWithBool:cppValue.Value().isPauseable];
+ value.isPausable = [NSNumber numberWithBool:cppValue.Value().isPausable];
{ // Scope for our temporary variables
auto * array_2 = [NSMutableArray new];
auto iter_2 = cppValue.Value().slots.begin();
@@ -8978,10 +8984,10 @@
newElement_2.defaultDuration = [NSNumber numberWithUnsignedInt:entry_2.defaultDuration];
newElement_2.elapsedSlotTime = [NSNumber numberWithUnsignedInt:entry_2.elapsedSlotTime];
newElement_2.remainingSlotTime = [NSNumber numberWithUnsignedInt:entry_2.remainingSlotTime];
- if (entry_2.slotIsPauseable.HasValue()) {
- newElement_2.slotIsPauseable = [NSNumber numberWithBool:entry_2.slotIsPauseable.Value()];
+ if (entry_2.slotIsPausable.HasValue()) {
+ newElement_2.slotIsPausable = [NSNumber numberWithBool:entry_2.slotIsPausable.Value()];
} else {
- newElement_2.slotIsPauseable = nil;
+ newElement_2.slotIsPausable = nil;
}
if (entry_2.minPauseDuration.HasValue()) {
newElement_2.minPauseDuration = [NSNumber numberWithUnsignedInt:entry_2.minPauseDuration.Value()];
diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h
index ecb6ad2..35f0a1d 100644
--- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h
+++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h
@@ -7827,11 +7827,11 @@
reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE;
+ (void)readAttributeAbsMaxPowerWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE;
-- (void)readAttributePowerAdjustmentCapabilityWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE;
+- (void)readAttributePowerAdjustmentCapabilityWithCompletion:(void (^)(MTRDeviceEnergyManagementClusterPowerAdjustCapabilityStruct * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE;
- (void)subscribeAttributePowerAdjustmentCapabilityWithParams:(MTRSubscribeParams *)params
subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished
- reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE;
-+ (void)readAttributePowerAdjustmentCapabilityWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE;
+ reportHandler:(void (^)(MTRDeviceEnergyManagementClusterPowerAdjustCapabilityStruct * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE;
++ (void)readAttributePowerAdjustmentCapabilityWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(MTRDeviceEnergyManagementClusterPowerAdjustCapabilityStruct * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE;
- (void)readAttributeForecastWithCompletion:(void (^)(MTRDeviceEnergyManagementClusterForecastStruct * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE;
- (void)subscribeAttributeForecastWithParams:(MTRSubscribeParams *)params
@@ -18263,6 +18263,12 @@
MTRDeviceEnergyManagementOptOutStateOptOut MTR_PROVISIONALLY_AVAILABLE = 0x03,
} MTR_PROVISIONALLY_AVAILABLE;
+typedef NS_ENUM(uint8_t, MTRDeviceEnergyManagementPowerAdjustReason) {
+ MTRDeviceEnergyManagementPowerAdjustReasonNoAdjustment MTR_PROVISIONALLY_AVAILABLE = 0x00,
+ MTRDeviceEnergyManagementPowerAdjustReasonLocalOptimizationAdjustment MTR_PROVISIONALLY_AVAILABLE = 0x01,
+ MTRDeviceEnergyManagementPowerAdjustReasonGridOptimizationAdjustment MTR_PROVISIONALLY_AVAILABLE = 0x02,
+} MTR_PROVISIONALLY_AVAILABLE;
+
typedef NS_OPTIONS(uint32_t, MTRDeviceEnergyManagementFeature) {
MTRDeviceEnergyManagementFeaturePowerAdjustment MTR_PROVISIONALLY_AVAILABLE = 0x1,
MTRDeviceEnergyManagementFeaturePowerForecastReporting MTR_PROVISIONALLY_AVAILABLE = 0x2,
diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm
index 4cf69c6..f5ad47a 100644
--- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm
+++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm
@@ -52502,7 +52502,7 @@
completion:completion];
}
-- (void)readAttributePowerAdjustmentCapabilityWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion
+- (void)readAttributePowerAdjustmentCapabilityWithCompletion:(void (^)(MTRDeviceEnergyManagementClusterPowerAdjustCapabilityStruct * _Nullable value, NSError * _Nullable error))completion
{
using TypeInfo = DeviceEnergyManagement::Attributes::PowerAdjustmentCapability::TypeInfo;
[self.device _readKnownAttributeWithEndpointID:self.endpointID
@@ -52515,7 +52515,7 @@
- (void)subscribeAttributePowerAdjustmentCapabilityWithParams:(MTRSubscribeParams * _Nonnull)params
subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished
- reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler
+ reportHandler:(void (^)(MTRDeviceEnergyManagementClusterPowerAdjustCapabilityStruct * _Nullable value, NSError * _Nullable error))reportHandler
{
using TypeInfo = DeviceEnergyManagement::Attributes::PowerAdjustmentCapability::TypeInfo;
[self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID
@@ -52527,7 +52527,7 @@
subscriptionEstablished:subscriptionEstablished];
}
-+ (void)readAttributePowerAdjustmentCapabilityWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion
++ (void)readAttributePowerAdjustmentCapabilityWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(MTRDeviceEnergyManagementClusterPowerAdjustCapabilityStruct * _Nullable value, NSError * _Nullable error))completion
{
using TypeInfo = DeviceEnergyManagement::Attributes::PowerAdjustmentCapability::TypeInfo;
[clusterStateCacheContainer
diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h
index 18ad1d6..6ec4cfb 100644
--- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h
+++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h
@@ -5739,7 +5739,7 @@
MTR_PROVISIONALLY_AVAILABLE
@interface MTRDeviceEnergyManagementClusterModifyForecastRequestParams : NSObject <NSCopying>
-@property (nonatomic, copy) NSNumber * _Nonnull forecastId MTR_PROVISIONALLY_AVAILABLE;
+@property (nonatomic, copy) NSNumber * _Nonnull forecastID MTR_PROVISIONALLY_AVAILABLE;
@property (nonatomic, copy) NSArray * _Nonnull slotAdjustments MTR_PROVISIONALLY_AVAILABLE;
diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm
index 6b5e97c..ffe9c41 100644
--- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm
+++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm
@@ -16113,7 +16113,7 @@
{
if (self = [super init]) {
- _forecastId = @(0);
+ _forecastID = @(0);
_slotAdjustments = [NSArray array];
@@ -16128,7 +16128,7 @@
{
auto other = [[MTRDeviceEnergyManagementClusterModifyForecastRequestParams alloc] init];
- other.forecastId = self.forecastId;
+ other.forecastID = self.forecastID;
other.slotAdjustments = self.slotAdjustments;
other.cause = self.cause;
other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs;
@@ -16139,7 +16139,7 @@
- (NSString *)description
{
- NSString * descriptionString = [NSString stringWithFormat:@"<%@: forecastId:%@; slotAdjustments:%@; cause:%@; >", NSStringFromClass([self class]), _forecastId, _slotAdjustments, _cause];
+ NSString * descriptionString = [NSString stringWithFormat:@"<%@: forecastID:%@; slotAdjustments:%@; cause:%@; >", NSStringFromClass([self class]), _forecastID, _slotAdjustments, _cause];
return descriptionString;
}
@@ -16152,7 +16152,7 @@
chip::app::Clusters::DeviceEnergyManagement::Commands::ModifyForecastRequest::Type encodableStruct;
ListFreer listFreer;
{
- encodableStruct.forecastId = self.forecastId.unsignedIntValue;
+ encodableStruct.forecastID = self.forecastID.unsignedIntValue;
}
{
{
@@ -16171,7 +16171,10 @@
}
auto element_0 = (MTRDeviceEnergyManagementClusterSlotAdjustmentStruct *) self.slotAdjustments[i_0];
listHolder_0->mList[i_0].slotIndex = element_0.slotIndex.unsignedCharValue;
- listHolder_0->mList[i_0].nominalPower = element_0.nominalPower.longLongValue;
+ if (element_0.nominalPower != nil) {
+ auto & definedValue_2 = listHolder_0->mList[i_0].nominalPower.Emplace();
+ definedValue_2 = element_0.nominalPower.longLongValue;
+ }
listHolder_0->mList[i_0].duration = element_0.duration.unsignedIntValue;
}
encodableStruct.slotAdjustments = ListType_0(listHolder_0->mList, self.slotAdjustments.count);
diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h
index e4d9eb0..5729c81 100644
--- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h
+++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h
@@ -1286,13 +1286,27 @@
@end
MTR_PROVISIONALLY_AVAILABLE
+@interface MTRDeviceEnergyManagementClusterPowerAdjustStruct : NSObject <NSCopying>
+@property (nonatomic, copy) NSNumber * _Nonnull minPower MTR_PROVISIONALLY_AVAILABLE;
+@property (nonatomic, copy) NSNumber * _Nonnull maxPower MTR_PROVISIONALLY_AVAILABLE;
+@property (nonatomic, copy) NSNumber * _Nonnull minDuration MTR_PROVISIONALLY_AVAILABLE;
+@property (nonatomic, copy) NSNumber * _Nonnull maxDuration MTR_PROVISIONALLY_AVAILABLE;
+@end
+
+MTR_PROVISIONALLY_AVAILABLE
+@interface MTRDeviceEnergyManagementClusterPowerAdjustCapabilityStruct : NSObject <NSCopying>
+@property (nonatomic, copy) NSArray * _Nullable powerAdjustCapability MTR_PROVISIONALLY_AVAILABLE;
+@property (nonatomic, copy) NSNumber * _Nonnull cause MTR_PROVISIONALLY_AVAILABLE;
+@end
+
+MTR_PROVISIONALLY_AVAILABLE
@interface MTRDeviceEnergyManagementClusterSlotStruct : NSObject <NSCopying>
@property (nonatomic, copy) NSNumber * _Nonnull minDuration MTR_PROVISIONALLY_AVAILABLE;
@property (nonatomic, copy) NSNumber * _Nonnull maxDuration MTR_PROVISIONALLY_AVAILABLE;
@property (nonatomic, copy) NSNumber * _Nonnull defaultDuration MTR_PROVISIONALLY_AVAILABLE;
@property (nonatomic, copy) NSNumber * _Nonnull elapsedSlotTime MTR_PROVISIONALLY_AVAILABLE;
@property (nonatomic, copy) NSNumber * _Nonnull remainingSlotTime MTR_PROVISIONALLY_AVAILABLE;
-@property (nonatomic, copy) NSNumber * _Nullable slotIsPauseable MTR_PROVISIONALLY_AVAILABLE;
+@property (nonatomic, copy) NSNumber * _Nullable slotIsPausable MTR_PROVISIONALLY_AVAILABLE;
@property (nonatomic, copy) NSNumber * _Nullable minPauseDuration MTR_PROVISIONALLY_AVAILABLE;
@property (nonatomic, copy) NSNumber * _Nullable maxPauseDuration MTR_PROVISIONALLY_AVAILABLE;
@property (nonatomic, copy) NSNumber * _Nullable manufacturerESAState MTR_PROVISIONALLY_AVAILABLE;
@@ -1309,13 +1323,13 @@
MTR_PROVISIONALLY_AVAILABLE
@interface MTRDeviceEnergyManagementClusterForecastStruct : NSObject <NSCopying>
-@property (nonatomic, copy) NSNumber * _Nonnull forecastId MTR_PROVISIONALLY_AVAILABLE;
+@property (nonatomic, copy) NSNumber * _Nonnull forecastID MTR_PROVISIONALLY_AVAILABLE;
@property (nonatomic, copy) NSNumber * _Nullable activeSlotNumber MTR_PROVISIONALLY_AVAILABLE;
@property (nonatomic, copy) NSNumber * _Nonnull startTime MTR_PROVISIONALLY_AVAILABLE;
@property (nonatomic, copy) NSNumber * _Nonnull endTime MTR_PROVISIONALLY_AVAILABLE;
@property (nonatomic, copy) NSNumber * _Nullable earliestStartTime MTR_PROVISIONALLY_AVAILABLE;
@property (nonatomic, copy) NSNumber * _Nullable latestEndTime MTR_PROVISIONALLY_AVAILABLE;
-@property (nonatomic, copy) NSNumber * _Nonnull isPauseable MTR_PROVISIONALLY_AVAILABLE;
+@property (nonatomic, copy) NSNumber * _Nonnull isPausable MTR_PROVISIONALLY_AVAILABLE;
@property (nonatomic, copy) NSArray * _Nonnull slots MTR_PROVISIONALLY_AVAILABLE;
@property (nonatomic, copy) NSNumber * _Nonnull forecastUpdateReason MTR_PROVISIONALLY_AVAILABLE;
@end
@@ -1330,17 +1344,9 @@
@end
MTR_PROVISIONALLY_AVAILABLE
-@interface MTRDeviceEnergyManagementClusterPowerAdjustStruct : NSObject <NSCopying>
-@property (nonatomic, copy) NSNumber * _Nonnull minPower MTR_PROVISIONALLY_AVAILABLE;
-@property (nonatomic, copy) NSNumber * _Nonnull maxPower MTR_PROVISIONALLY_AVAILABLE;
-@property (nonatomic, copy) NSNumber * _Nonnull minDuration MTR_PROVISIONALLY_AVAILABLE;
-@property (nonatomic, copy) NSNumber * _Nonnull maxDuration MTR_PROVISIONALLY_AVAILABLE;
-@end
-
-MTR_PROVISIONALLY_AVAILABLE
@interface MTRDeviceEnergyManagementClusterSlotAdjustmentStruct : NSObject <NSCopying>
@property (nonatomic, copy) NSNumber * _Nonnull slotIndex MTR_PROVISIONALLY_AVAILABLE;
-@property (nonatomic, copy) NSNumber * _Nonnull nominalPower MTR_PROVISIONALLY_AVAILABLE;
+@property (nonatomic, copy) NSNumber * _Nullable nominalPower MTR_PROVISIONALLY_AVAILABLE;
@property (nonatomic, copy) NSNumber * _Nonnull duration MTR_PROVISIONALLY_AVAILABLE;
@end
diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm
index 30c3531..6f9a82e 100644
--- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm
+++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm
@@ -5251,6 +5251,72 @@
@end
+@implementation MTRDeviceEnergyManagementClusterPowerAdjustStruct
+- (instancetype)init
+{
+ if (self = [super init]) {
+
+ _minPower = @(0);
+
+ _maxPower = @(0);
+
+ _minDuration = @(0);
+
+ _maxDuration = @(0);
+ }
+ return self;
+}
+
+- (id)copyWithZone:(NSZone * _Nullable)zone
+{
+ auto other = [[MTRDeviceEnergyManagementClusterPowerAdjustStruct alloc] init];
+
+ other.minPower = self.minPower;
+ other.maxPower = self.maxPower;
+ other.minDuration = self.minDuration;
+ other.maxDuration = self.maxDuration;
+
+ return other;
+}
+
+- (NSString *)description
+{
+ NSString * descriptionString = [NSString stringWithFormat:@"<%@: minPower:%@; maxPower:%@; minDuration:%@; maxDuration:%@; >", NSStringFromClass([self class]), _minPower, _maxPower, _minDuration, _maxDuration];
+ return descriptionString;
+}
+
+@end
+
+@implementation MTRDeviceEnergyManagementClusterPowerAdjustCapabilityStruct
+- (instancetype)init
+{
+ if (self = [super init]) {
+
+ _powerAdjustCapability = nil;
+
+ _cause = @(0);
+ }
+ return self;
+}
+
+- (id)copyWithZone:(NSZone * _Nullable)zone
+{
+ auto other = [[MTRDeviceEnergyManagementClusterPowerAdjustCapabilityStruct alloc] init];
+
+ other.powerAdjustCapability = self.powerAdjustCapability;
+ other.cause = self.cause;
+
+ return other;
+}
+
+- (NSString *)description
+{
+ NSString * descriptionString = [NSString stringWithFormat:@"<%@: powerAdjustCapability:%@; cause:%@; >", NSStringFromClass([self class]), _powerAdjustCapability, _cause];
+ return descriptionString;
+}
+
+@end
+
@implementation MTRDeviceEnergyManagementClusterSlotStruct
- (instancetype)init
{
@@ -5266,7 +5332,7 @@
_remainingSlotTime = @(0);
- _slotIsPauseable = nil;
+ _slotIsPausable = nil;
_minPauseDuration = nil;
@@ -5304,7 +5370,7 @@
other.defaultDuration = self.defaultDuration;
other.elapsedSlotTime = self.elapsedSlotTime;
other.remainingSlotTime = self.remainingSlotTime;
- other.slotIsPauseable = self.slotIsPauseable;
+ other.slotIsPausable = self.slotIsPausable;
other.minPauseDuration = self.minPauseDuration;
other.maxPauseDuration = self.maxPauseDuration;
other.manufacturerESAState = self.manufacturerESAState;
@@ -5323,7 +5389,7 @@
- (NSString *)description
{
- NSString * descriptionString = [NSString stringWithFormat:@"<%@: minDuration:%@; maxDuration:%@; defaultDuration:%@; elapsedSlotTime:%@; remainingSlotTime:%@; slotIsPauseable:%@; minPauseDuration:%@; maxPauseDuration:%@; manufacturerESAState:%@; nominalPower:%@; minPower:%@; maxPower:%@; nominalEnergy:%@; costs:%@; minPowerAdjustment:%@; maxPowerAdjustment:%@; minDurationAdjustment:%@; maxDurationAdjustment:%@; >", NSStringFromClass([self class]), _minDuration, _maxDuration, _defaultDuration, _elapsedSlotTime, _remainingSlotTime, _slotIsPauseable, _minPauseDuration, _maxPauseDuration, _manufacturerESAState, _nominalPower, _minPower, _maxPower, _nominalEnergy, _costs, _minPowerAdjustment, _maxPowerAdjustment, _minDurationAdjustment, _maxDurationAdjustment];
+ NSString * descriptionString = [NSString stringWithFormat:@"<%@: minDuration:%@; maxDuration:%@; defaultDuration:%@; elapsedSlotTime:%@; remainingSlotTime:%@; slotIsPausable:%@; minPauseDuration:%@; maxPauseDuration:%@; manufacturerESAState:%@; nominalPower:%@; minPower:%@; maxPower:%@; nominalEnergy:%@; costs:%@; minPowerAdjustment:%@; maxPowerAdjustment:%@; minDurationAdjustment:%@; maxDurationAdjustment:%@; >", NSStringFromClass([self class]), _minDuration, _maxDuration, _defaultDuration, _elapsedSlotTime, _remainingSlotTime, _slotIsPausable, _minPauseDuration, _maxPauseDuration, _manufacturerESAState, _nominalPower, _minPower, _maxPower, _nominalEnergy, _costs, _minPowerAdjustment, _maxPowerAdjustment, _minDurationAdjustment, _maxDurationAdjustment];
return descriptionString;
}
@@ -5334,7 +5400,7 @@
{
if (self = [super init]) {
- _forecastId = @(0);
+ _forecastID = @(0);
_activeSlotNumber = nil;
@@ -5346,7 +5412,7 @@
_latestEndTime = nil;
- _isPauseable = @(0);
+ _isPausable = @(0);
_slots = [NSArray array];
@@ -5359,13 +5425,13 @@
{
auto other = [[MTRDeviceEnergyManagementClusterForecastStruct alloc] init];
- other.forecastId = self.forecastId;
+ other.forecastID = self.forecastID;
other.activeSlotNumber = self.activeSlotNumber;
other.startTime = self.startTime;
other.endTime = self.endTime;
other.earliestStartTime = self.earliestStartTime;
other.latestEndTime = self.latestEndTime;
- other.isPauseable = self.isPauseable;
+ other.isPausable = self.isPausable;
other.slots = self.slots;
other.forecastUpdateReason = self.forecastUpdateReason;
@@ -5374,7 +5440,7 @@
- (NSString *)description
{
- NSString * descriptionString = [NSString stringWithFormat:@"<%@: forecastId:%@; activeSlotNumber:%@; startTime:%@; endTime:%@; earliestStartTime:%@; latestEndTime:%@; isPauseable:%@; slots:%@; forecastUpdateReason:%@; >", NSStringFromClass([self class]), _forecastId, _activeSlotNumber, _startTime, _endTime, _earliestStartTime, _latestEndTime, _isPauseable, _slots, _forecastUpdateReason];
+ NSString * descriptionString = [NSString stringWithFormat:@"<%@: forecastID:%@; activeSlotNumber:%@; startTime:%@; endTime:%@; earliestStartTime:%@; latestEndTime:%@; isPausable:%@; slots:%@; forecastUpdateReason:%@; >", NSStringFromClass([self class]), _forecastID, _activeSlotNumber, _startTime, _endTime, _earliestStartTime, _latestEndTime, _isPausable, _slots, _forecastUpdateReason];
return descriptionString;
}
@@ -5419,42 +5485,6 @@
@end
-@implementation MTRDeviceEnergyManagementClusterPowerAdjustStruct
-- (instancetype)init
-{
- if (self = [super init]) {
-
- _minPower = @(0);
-
- _maxPower = @(0);
-
- _minDuration = @(0);
-
- _maxDuration = @(0);
- }
- return self;
-}
-
-- (id)copyWithZone:(NSZone * _Nullable)zone
-{
- auto other = [[MTRDeviceEnergyManagementClusterPowerAdjustStruct alloc] init];
-
- other.minPower = self.minPower;
- other.maxPower = self.maxPower;
- other.minDuration = self.minDuration;
- other.maxDuration = self.maxDuration;
-
- return other;
-}
-
-- (NSString *)description
-{
- NSString * descriptionString = [NSString stringWithFormat:@"<%@: minPower:%@; maxPower:%@; minDuration:%@; maxDuration:%@; >", NSStringFromClass([self class]), _minPower, _maxPower, _minDuration, _maxDuration];
- return descriptionString;
-}
-
-@end
-
@implementation MTRDeviceEnergyManagementClusterSlotAdjustmentStruct
- (instancetype)init
{
@@ -5462,7 +5492,7 @@
_slotIndex = @(0);
- _nominalPower = @(0);
+ _nominalPower = nil;
_duration = @(0);
}
diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h b/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h
index ca25c08..4ff889f 100644
--- a/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h
+++ b/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h
@@ -1767,6 +1767,19 @@
return EnumType::kUnknownEnumValue;
}
}
+static auto __attribute__((unused)) EnsureKnownEnumValue(DeviceEnergyManagement::PowerAdjustReasonEnum val)
+{
+ using EnumType = DeviceEnergyManagement::PowerAdjustReasonEnum;
+ switch (val)
+ {
+ case EnumType::kNoAdjustment:
+ case EnumType::kLocalOptimizationAdjustment:
+ case EnumType::kGridOptimizationAdjustment:
+ return val;
+ default:
+ return EnumType::kUnknownEnumValue;
+ }
+}
static auto __attribute__((unused)) EnsureKnownEnumValue(EnergyEvse::EnergyTransferStoppedReasonEnum val)
{
diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h
index 4e1e1a1..7c669e1 100644
--- a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h
+++ b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h
@@ -2571,6 +2571,19 @@
kUnknownEnumValue = 4,
};
+// Enum for PowerAdjustReasonEnum
+enum class PowerAdjustReasonEnum : uint8_t
+{
+ kNoAdjustment = 0x00,
+ kLocalOptimizationAdjustment = 0x01,
+ kGridOptimizationAdjustment = 0x02,
+ // All received enum values that are not listed above will be mapped
+ // to kUnknownEnumValue. This is a helper enum value that should only
+ // be used by code to process how it handles receiving and unknown
+ // enum value. This specific should never be transmitted.
+ kUnknownEnumValue = 3,
+};
+
// Bitmap for Feature
enum class Feature : uint32_t
{
diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp
index c882585..2f12fdc 100644
--- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp
+++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp
@@ -15598,6 +15598,98 @@
} // namespace CostStruct
+namespace PowerAdjustStruct {
+CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
+{
+ DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
+ encoder.Encode(to_underlying(Fields::kMinPower), minPower);
+ encoder.Encode(to_underlying(Fields::kMaxPower), maxPower);
+ encoder.Encode(to_underlying(Fields::kMinDuration), minDuration);
+ encoder.Encode(to_underlying(Fields::kMaxDuration), maxDuration);
+ return encoder.Finalize();
+}
+
+CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
+{
+ detail::StructDecodeIterator __iterator(reader);
+ while (true)
+ {
+ auto __element = __iterator.Next();
+ if (std::holds_alternative<CHIP_ERROR>(__element))
+ {
+ return std::get<CHIP_ERROR>(__element);
+ }
+
+ CHIP_ERROR err = CHIP_NO_ERROR;
+ const uint8_t __context_tag = std::get<uint8_t>(__element);
+
+ if (__context_tag == to_underlying(Fields::kMinPower))
+ {
+ err = DataModel::Decode(reader, minPower);
+ }
+ else if (__context_tag == to_underlying(Fields::kMaxPower))
+ {
+ err = DataModel::Decode(reader, maxPower);
+ }
+ else if (__context_tag == to_underlying(Fields::kMinDuration))
+ {
+ err = DataModel::Decode(reader, minDuration);
+ }
+ else if (__context_tag == to_underlying(Fields::kMaxDuration))
+ {
+ err = DataModel::Decode(reader, maxDuration);
+ }
+ else
+ {
+ }
+
+ ReturnErrorOnFailure(err);
+ }
+}
+
+} // namespace PowerAdjustStruct
+
+namespace PowerAdjustCapabilityStruct {
+CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
+{
+ DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
+ encoder.Encode(to_underlying(Fields::kPowerAdjustCapability), powerAdjustCapability);
+ encoder.Encode(to_underlying(Fields::kCause), cause);
+ return encoder.Finalize();
+}
+
+CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
+{
+ detail::StructDecodeIterator __iterator(reader);
+ while (true)
+ {
+ auto __element = __iterator.Next();
+ if (std::holds_alternative<CHIP_ERROR>(__element))
+ {
+ return std::get<CHIP_ERROR>(__element);
+ }
+
+ CHIP_ERROR err = CHIP_NO_ERROR;
+ const uint8_t __context_tag = std::get<uint8_t>(__element);
+
+ if (__context_tag == to_underlying(Fields::kPowerAdjustCapability))
+ {
+ err = DataModel::Decode(reader, powerAdjustCapability);
+ }
+ else if (__context_tag == to_underlying(Fields::kCause))
+ {
+ err = DataModel::Decode(reader, cause);
+ }
+ else
+ {
+ }
+
+ ReturnErrorOnFailure(err);
+ }
+}
+
+} // namespace PowerAdjustCapabilityStruct
+
namespace SlotStruct {
CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
@@ -15607,7 +15699,7 @@
encoder.Encode(to_underlying(Fields::kDefaultDuration), defaultDuration);
encoder.Encode(to_underlying(Fields::kElapsedSlotTime), elapsedSlotTime);
encoder.Encode(to_underlying(Fields::kRemainingSlotTime), remainingSlotTime);
- encoder.Encode(to_underlying(Fields::kSlotIsPauseable), slotIsPauseable);
+ encoder.Encode(to_underlying(Fields::kSlotIsPausable), slotIsPausable);
encoder.Encode(to_underlying(Fields::kMinPauseDuration), minPauseDuration);
encoder.Encode(to_underlying(Fields::kMaxPauseDuration), maxPauseDuration);
encoder.Encode(to_underlying(Fields::kManufacturerESAState), manufacturerESAState);
@@ -15657,9 +15749,9 @@
{
err = DataModel::Decode(reader, remainingSlotTime);
}
- else if (__context_tag == to_underlying(Fields::kSlotIsPauseable))
+ else if (__context_tag == to_underlying(Fields::kSlotIsPausable))
{
- err = DataModel::Decode(reader, slotIsPauseable);
+ err = DataModel::Decode(reader, slotIsPausable);
}
else if (__context_tag == to_underlying(Fields::kMinPauseDuration))
{
@@ -15723,13 +15815,13 @@
CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
- encoder.Encode(to_underlying(Fields::kForecastId), forecastId);
+ encoder.Encode(to_underlying(Fields::kForecastID), forecastID);
encoder.Encode(to_underlying(Fields::kActiveSlotNumber), activeSlotNumber);
encoder.Encode(to_underlying(Fields::kStartTime), startTime);
encoder.Encode(to_underlying(Fields::kEndTime), endTime);
encoder.Encode(to_underlying(Fields::kEarliestStartTime), earliestStartTime);
encoder.Encode(to_underlying(Fields::kLatestEndTime), latestEndTime);
- encoder.Encode(to_underlying(Fields::kIsPauseable), isPauseable);
+ encoder.Encode(to_underlying(Fields::kIsPausable), isPausable);
encoder.Encode(to_underlying(Fields::kSlots), slots);
encoder.Encode(to_underlying(Fields::kForecastUpdateReason), forecastUpdateReason);
return encoder.Finalize();
@@ -15749,9 +15841,9 @@
CHIP_ERROR err = CHIP_NO_ERROR;
const uint8_t __context_tag = std::get<uint8_t>(__element);
- if (__context_tag == to_underlying(Fields::kForecastId))
+ if (__context_tag == to_underlying(Fields::kForecastID))
{
- err = DataModel::Decode(reader, forecastId);
+ err = DataModel::Decode(reader, forecastID);
}
else if (__context_tag == to_underlying(Fields::kActiveSlotNumber))
{
@@ -15773,9 +15865,9 @@
{
err = DataModel::Decode(reader, latestEndTime);
}
- else if (__context_tag == to_underlying(Fields::kIsPauseable))
+ else if (__context_tag == to_underlying(Fields::kIsPausable))
{
- err = DataModel::Decode(reader, isPauseable);
+ err = DataModel::Decode(reader, isPausable);
}
else if (__context_tag == to_underlying(Fields::kSlots))
{
@@ -15851,57 +15943,6 @@
} // namespace ConstraintsStruct
-namespace PowerAdjustStruct {
-CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
-{
- DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
- encoder.Encode(to_underlying(Fields::kMinPower), minPower);
- encoder.Encode(to_underlying(Fields::kMaxPower), maxPower);
- encoder.Encode(to_underlying(Fields::kMinDuration), minDuration);
- encoder.Encode(to_underlying(Fields::kMaxDuration), maxDuration);
- return encoder.Finalize();
-}
-
-CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
-{
- detail::StructDecodeIterator __iterator(reader);
- while (true)
- {
- auto __element = __iterator.Next();
- if (std::holds_alternative<CHIP_ERROR>(__element))
- {
- return std::get<CHIP_ERROR>(__element);
- }
-
- CHIP_ERROR err = CHIP_NO_ERROR;
- const uint8_t __context_tag = std::get<uint8_t>(__element);
-
- if (__context_tag == to_underlying(Fields::kMinPower))
- {
- err = DataModel::Decode(reader, minPower);
- }
- else if (__context_tag == to_underlying(Fields::kMaxPower))
- {
- err = DataModel::Decode(reader, maxPower);
- }
- else if (__context_tag == to_underlying(Fields::kMinDuration))
- {
- err = DataModel::Decode(reader, minDuration);
- }
- else if (__context_tag == to_underlying(Fields::kMaxDuration))
- {
- err = DataModel::Decode(reader, maxDuration);
- }
- else
- {
- }
-
- ReturnErrorOnFailure(err);
- }
-}
-
-} // namespace PowerAdjustStruct
-
namespace SlotAdjustmentStruct {
CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
@@ -16116,7 +16157,7 @@
CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
- encoder.Encode(to_underlying(Fields::kForecastId), forecastId);
+ encoder.Encode(to_underlying(Fields::kForecastID), forecastID);
encoder.Encode(to_underlying(Fields::kSlotAdjustments), slotAdjustments);
encoder.Encode(to_underlying(Fields::kCause), cause);
return encoder.Finalize();
@@ -16136,9 +16177,9 @@
CHIP_ERROR err = CHIP_NO_ERROR;
const uint8_t __context_tag = std::get<uint8_t>(__element);
- if (__context_tag == to_underlying(Fields::kForecastId))
+ if (__context_tag == to_underlying(Fields::kForecastID))
{
- err = DataModel::Decode(reader, forecastId);
+ err = DataModel::Decode(reader, forecastID);
}
else if (__context_tag == to_underlying(Fields::kSlotAdjustments))
{
diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h
index e92bee9..75d2d9e 100644
--- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h
+++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h
@@ -21861,6 +21861,63 @@
using DecodableType = Type;
} // namespace CostStruct
+namespace PowerAdjustStruct {
+enum class Fields : uint8_t
+{
+ kMinPower = 0,
+ kMaxPower = 1,
+ kMinDuration = 2,
+ kMaxDuration = 3,
+};
+
+struct Type
+{
+public:
+ int64_t minPower = static_cast<int64_t>(0);
+ int64_t maxPower = static_cast<int64_t>(0);
+ uint32_t minDuration = static_cast<uint32_t>(0);
+ uint32_t maxDuration = static_cast<uint32_t>(0);
+
+ CHIP_ERROR Decode(TLV::TLVReader & reader);
+
+ static constexpr bool kIsFabricScoped = false;
+
+ CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const;
+};
+
+using DecodableType = Type;
+
+} // namespace PowerAdjustStruct
+namespace PowerAdjustCapabilityStruct {
+enum class Fields : uint8_t
+{
+ kPowerAdjustCapability = 0,
+ kCause = 1,
+};
+
+struct Type
+{
+public:
+ DataModel::Nullable<DataModel::List<const Structs::PowerAdjustStruct::Type>> powerAdjustCapability;
+ PowerAdjustReasonEnum cause = static_cast<PowerAdjustReasonEnum>(0);
+
+ static constexpr bool kIsFabricScoped = false;
+
+ CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const;
+};
+
+struct DecodableType
+{
+public:
+ DataModel::Nullable<DataModel::DecodableList<Structs::PowerAdjustStruct::DecodableType>> powerAdjustCapability;
+ PowerAdjustReasonEnum cause = static_cast<PowerAdjustReasonEnum>(0);
+
+ CHIP_ERROR Decode(TLV::TLVReader & reader);
+
+ static constexpr bool kIsFabricScoped = false;
+};
+
+} // namespace PowerAdjustCapabilityStruct
namespace SlotStruct {
enum class Fields : uint8_t
{
@@ -21869,7 +21926,7 @@
kDefaultDuration = 2,
kElapsedSlotTime = 3,
kRemainingSlotTime = 4,
- kSlotIsPauseable = 5,
+ kSlotIsPausable = 5,
kMinPauseDuration = 6,
kMaxPauseDuration = 7,
kManufacturerESAState = 8,
@@ -21892,7 +21949,7 @@
uint32_t defaultDuration = static_cast<uint32_t>(0);
uint32_t elapsedSlotTime = static_cast<uint32_t>(0);
uint32_t remainingSlotTime = static_cast<uint32_t>(0);
- Optional<bool> slotIsPauseable;
+ Optional<bool> slotIsPausable;
Optional<uint32_t> minPauseDuration;
Optional<uint32_t> maxPauseDuration;
Optional<uint16_t> manufacturerESAState;
@@ -21919,7 +21976,7 @@
uint32_t defaultDuration = static_cast<uint32_t>(0);
uint32_t elapsedSlotTime = static_cast<uint32_t>(0);
uint32_t remainingSlotTime = static_cast<uint32_t>(0);
- Optional<bool> slotIsPauseable;
+ Optional<bool> slotIsPausable;
Optional<uint32_t> minPauseDuration;
Optional<uint32_t> maxPauseDuration;
Optional<uint16_t> manufacturerESAState;
@@ -21942,13 +21999,13 @@
namespace ForecastStruct {
enum class Fields : uint8_t
{
- kForecastId = 0,
+ kForecastID = 0,
kActiveSlotNumber = 1,
kStartTime = 2,
kEndTime = 3,
kEarliestStartTime = 4,
kLatestEndTime = 5,
- kIsPauseable = 6,
+ kIsPausable = 6,
kSlots = 7,
kForecastUpdateReason = 8,
};
@@ -21956,13 +22013,13 @@
struct Type
{
public:
- uint16_t forecastId = static_cast<uint16_t>(0);
+ uint32_t forecastID = static_cast<uint32_t>(0);
DataModel::Nullable<uint16_t> activeSlotNumber;
uint32_t startTime = static_cast<uint32_t>(0);
uint32_t endTime = static_cast<uint32_t>(0);
Optional<DataModel::Nullable<uint32_t>> earliestStartTime;
Optional<uint32_t> latestEndTime;
- bool isPauseable = static_cast<bool>(0);
+ bool isPausable = static_cast<bool>(0);
DataModel::List<const Structs::SlotStruct::Type> slots;
ForecastUpdateReasonEnum forecastUpdateReason = static_cast<ForecastUpdateReasonEnum>(0);
@@ -21974,13 +22031,13 @@
struct DecodableType
{
public:
- uint16_t forecastId = static_cast<uint16_t>(0);
+ uint32_t forecastID = static_cast<uint32_t>(0);
DataModel::Nullable<uint16_t> activeSlotNumber;
uint32_t startTime = static_cast<uint32_t>(0);
uint32_t endTime = static_cast<uint32_t>(0);
Optional<DataModel::Nullable<uint32_t>> earliestStartTime;
Optional<uint32_t> latestEndTime;
- bool isPauseable = static_cast<bool>(0);
+ bool isPausable = static_cast<bool>(0);
DataModel::DecodableList<Structs::SlotStruct::DecodableType> slots;
ForecastUpdateReasonEnum forecastUpdateReason = static_cast<ForecastUpdateReasonEnum>(0);
@@ -22019,33 +22076,6 @@
using DecodableType = Type;
} // namespace ConstraintsStruct
-namespace PowerAdjustStruct {
-enum class Fields : uint8_t
-{
- kMinPower = 0,
- kMaxPower = 1,
- kMinDuration = 2,
- kMaxDuration = 3,
-};
-
-struct Type
-{
-public:
- int64_t minPower = static_cast<int64_t>(0);
- int64_t maxPower = static_cast<int64_t>(0);
- uint32_t minDuration = static_cast<uint32_t>(0);
- uint32_t maxDuration = static_cast<uint32_t>(0);
-
- CHIP_ERROR Decode(TLV::TLVReader & reader);
-
- static constexpr bool kIsFabricScoped = false;
-
- CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const;
-};
-
-using DecodableType = Type;
-
-} // namespace PowerAdjustStruct
namespace SlotAdjustmentStruct {
enum class Fields : uint8_t
{
@@ -22057,9 +22087,9 @@
struct Type
{
public:
- uint8_t slotIndex = static_cast<uint8_t>(0);
- int64_t nominalPower = static_cast<int64_t>(0);
- uint32_t duration = static_cast<uint32_t>(0);
+ uint8_t slotIndex = static_cast<uint8_t>(0);
+ Optional<int64_t> nominalPower;
+ uint32_t duration = static_cast<uint32_t>(0);
CHIP_ERROR Decode(TLV::TLVReader & reader);
@@ -22286,7 +22316,7 @@
namespace ModifyForecastRequest {
enum class Fields : uint8_t
{
- kForecastId = 0,
+ kForecastID = 0,
kSlotAdjustments = 1,
kCause = 2,
};
@@ -22298,7 +22328,7 @@
static constexpr CommandId GetCommandId() { return Commands::ModifyForecastRequest::Id; }
static constexpr ClusterId GetClusterId() { return Clusters::DeviceEnergyManagement::Id; }
- uint32_t forecastId = static_cast<uint32_t>(0);
+ uint32_t forecastID = static_cast<uint32_t>(0);
DataModel::List<const Structs::SlotAdjustmentStruct::Type> slotAdjustments;
AdjustmentCauseEnum cause = static_cast<AdjustmentCauseEnum>(0);
@@ -22315,7 +22345,7 @@
static constexpr CommandId GetCommandId() { return Commands::ModifyForecastRequest::Id; }
static constexpr ClusterId GetClusterId() { return Clusters::DeviceEnergyManagement::Id; }
- uint32_t forecastId = static_cast<uint32_t>(0);
+ uint32_t forecastID = static_cast<uint32_t>(0);
DataModel::DecodableList<Structs::SlotAdjustmentStruct::DecodableType> slotAdjustments;
AdjustmentCauseEnum cause = static_cast<AdjustmentCauseEnum>(0);
CHIP_ERROR Decode(TLV::TLVReader & reader);
@@ -22451,12 +22481,12 @@
namespace PowerAdjustmentCapability {
struct TypeInfo
{
- using Type = chip::app::DataModel::Nullable<
- chip::app::DataModel::List<const chip::app::Clusters::DeviceEnergyManagement::Structs::PowerAdjustStruct::Type>>;
- using DecodableType = chip::app::DataModel::Nullable<chip::app::DataModel::DecodableList<
- chip::app::Clusters::DeviceEnergyManagement::Structs::PowerAdjustStruct::DecodableType>>;
- using DecodableArgType = const chip::app::DataModel::Nullable<chip::app::DataModel::DecodableList<
- chip::app::Clusters::DeviceEnergyManagement::Structs::PowerAdjustStruct::DecodableType>> &;
+ using Type =
+ chip::app::DataModel::Nullable<chip::app::Clusters::DeviceEnergyManagement::Structs::PowerAdjustCapabilityStruct::Type>;
+ using DecodableType = chip::app::DataModel::Nullable<
+ chip::app::Clusters::DeviceEnergyManagement::Structs::PowerAdjustCapabilityStruct::DecodableType>;
+ using DecodableArgType = const chip::app::DataModel::Nullable<
+ chip::app::Clusters::DeviceEnergyManagement::Structs::PowerAdjustCapabilityStruct::DecodableType> &;
static constexpr ClusterId GetClusterId() { return Clusters::DeviceEnergyManagement::Id; }
static constexpr AttributeId GetAttributeId() { return Attributes::PowerAdjustmentCapability::Id; }
diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h
index dae89fd..a160e9d 100644
--- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h
+++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h
@@ -7151,7 +7151,7 @@
DeviceEnergyManagementModifyForecastRequest(CredentialIssuerCommands * credsIssuerConfig) :
ClusterCommand("modify-forecast-request", credsIssuerConfig), mComplex_SlotAdjustments(&mRequest.slotAdjustments)
{
- AddArgument("ForecastId", 0, UINT32_MAX, &mRequest.forecastId);
+ AddArgument("ForecastID", 0, UINT32_MAX, &mRequest.forecastID);
AddArgument("SlotAdjustments", &mComplex_SlotAdjustments);
AddArgument("Cause", 0, UINT8_MAX, &mRequest.cause);
ClusterCommand::AddArguments();
@@ -20979,7 +20979,7 @@
make_unique<WriteAttribute<int64_t>>(Id, "abs-max-power", INT64_MIN, INT64_MAX, Attributes::AbsMaxPower::Id,
WriteCommandType::kForceWrite, credsIssuerConfig), //
make_unique<WriteAttributeAsComplex<chip::app::DataModel::Nullable<
- chip::app::DataModel::List<const chip::app::Clusters::DeviceEnergyManagement::Structs::PowerAdjustStruct::Type>>>>(
+ chip::app::Clusters::DeviceEnergyManagement::Structs::PowerAdjustCapabilityStruct::Type>>>(
Id, "power-adjustment-capability", Attributes::PowerAdjustmentCapability::Id, WriteCommandType::kForceWrite,
credsIssuerConfig), //
make_unique<WriteAttributeAsComplex<
diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp
index 661735e..f0970c2 100644
--- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp
+++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp
@@ -3124,6 +3124,87 @@
}
CHIP_ERROR ComplexArgumentParser::Setup(const char * label,
+ chip::app::Clusters::DeviceEnergyManagement::Structs::PowerAdjustStruct::Type & request,
+ Json::Value & value)
+{
+ VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT);
+
+ // Copy to track which members we already processed.
+ Json::Value valueCopy(value);
+
+ ReturnErrorOnFailure(
+ ComplexArgumentParser::EnsureMemberExist("PowerAdjustStruct.minPower", "minPower", value.isMember("minPower")));
+ ReturnErrorOnFailure(
+ ComplexArgumentParser::EnsureMemberExist("PowerAdjustStruct.maxPower", "maxPower", value.isMember("maxPower")));
+ ReturnErrorOnFailure(
+ ComplexArgumentParser::EnsureMemberExist("PowerAdjustStruct.minDuration", "minDuration", value.isMember("minDuration")));
+ ReturnErrorOnFailure(
+ ComplexArgumentParser::EnsureMemberExist("PowerAdjustStruct.maxDuration", "maxDuration", value.isMember("maxDuration")));
+
+ char labelWithMember[kMaxLabelLength];
+ snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "minPower");
+ ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.minPower, value["minPower"]));
+ valueCopy.removeMember("minPower");
+
+ snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "maxPower");
+ ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.maxPower, value["maxPower"]));
+ valueCopy.removeMember("maxPower");
+
+ snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "minDuration");
+ ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.minDuration, value["minDuration"]));
+ valueCopy.removeMember("minDuration");
+
+ snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "maxDuration");
+ ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.maxDuration, value["maxDuration"]));
+ valueCopy.removeMember("maxDuration");
+
+ return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy);
+}
+
+void ComplexArgumentParser::Finalize(chip::app::Clusters::DeviceEnergyManagement::Structs::PowerAdjustStruct::Type & request)
+{
+ ComplexArgumentParser::Finalize(request.minPower);
+ ComplexArgumentParser::Finalize(request.maxPower);
+ ComplexArgumentParser::Finalize(request.minDuration);
+ ComplexArgumentParser::Finalize(request.maxDuration);
+}
+
+CHIP_ERROR
+ComplexArgumentParser::Setup(const char * label,
+ chip::app::Clusters::DeviceEnergyManagement::Structs::PowerAdjustCapabilityStruct::Type & request,
+ Json::Value & value)
+{
+ VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT);
+
+ // Copy to track which members we already processed.
+ Json::Value valueCopy(value);
+
+ ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist(
+ "PowerAdjustCapabilityStruct.powerAdjustCapability", "powerAdjustCapability", value.isMember("powerAdjustCapability")));
+ ReturnErrorOnFailure(
+ ComplexArgumentParser::EnsureMemberExist("PowerAdjustCapabilityStruct.cause", "cause", value.isMember("cause")));
+
+ char labelWithMember[kMaxLabelLength];
+ snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "powerAdjustCapability");
+ ReturnErrorOnFailure(
+ ComplexArgumentParser::Setup(labelWithMember, request.powerAdjustCapability, value["powerAdjustCapability"]));
+ valueCopy.removeMember("powerAdjustCapability");
+
+ snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "cause");
+ ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.cause, value["cause"]));
+ valueCopy.removeMember("cause");
+
+ return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy);
+}
+
+void ComplexArgumentParser::Finalize(
+ chip::app::Clusters::DeviceEnergyManagement::Structs::PowerAdjustCapabilityStruct::Type & request)
+{
+ ComplexArgumentParser::Finalize(request.powerAdjustCapability);
+ ComplexArgumentParser::Finalize(request.cause);
+}
+
+CHIP_ERROR ComplexArgumentParser::Setup(const char * label,
chip::app::Clusters::DeviceEnergyManagement::Structs::SlotStruct::Type & request,
Json::Value & value)
{
@@ -3164,12 +3245,12 @@
ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.remainingSlotTime, value["remainingSlotTime"]));
valueCopy.removeMember("remainingSlotTime");
- if (value.isMember("slotIsPauseable"))
+ if (value.isMember("slotIsPausable"))
{
- snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "slotIsPauseable");
- ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.slotIsPauseable, value["slotIsPauseable"]));
+ snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "slotIsPausable");
+ ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.slotIsPausable, value["slotIsPausable"]));
}
- valueCopy.removeMember("slotIsPauseable");
+ valueCopy.removeMember("slotIsPausable");
if (value.isMember("minPauseDuration"))
{
@@ -3270,7 +3351,7 @@
ComplexArgumentParser::Finalize(request.defaultDuration);
ComplexArgumentParser::Finalize(request.elapsedSlotTime);
ComplexArgumentParser::Finalize(request.remainingSlotTime);
- ComplexArgumentParser::Finalize(request.slotIsPauseable);
+ ComplexArgumentParser::Finalize(request.slotIsPausable);
ComplexArgumentParser::Finalize(request.minPauseDuration);
ComplexArgumentParser::Finalize(request.maxPauseDuration);
ComplexArgumentParser::Finalize(request.manufacturerESAState);
@@ -3295,22 +3376,22 @@
Json::Value valueCopy(value);
ReturnErrorOnFailure(
- ComplexArgumentParser::EnsureMemberExist("ForecastStruct.forecastId", "forecastId", value.isMember("forecastId")));
+ ComplexArgumentParser::EnsureMemberExist("ForecastStruct.forecastID", "forecastID", value.isMember("forecastID")));
ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ForecastStruct.activeSlotNumber", "activeSlotNumber",
value.isMember("activeSlotNumber")));
ReturnErrorOnFailure(
ComplexArgumentParser::EnsureMemberExist("ForecastStruct.startTime", "startTime", value.isMember("startTime")));
ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ForecastStruct.endTime", "endTime", value.isMember("endTime")));
ReturnErrorOnFailure(
- ComplexArgumentParser::EnsureMemberExist("ForecastStruct.isPauseable", "isPauseable", value.isMember("isPauseable")));
+ ComplexArgumentParser::EnsureMemberExist("ForecastStruct.isPausable", "isPausable", value.isMember("isPausable")));
ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ForecastStruct.slots", "slots", value.isMember("slots")));
ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ForecastStruct.forecastUpdateReason", "forecastUpdateReason",
value.isMember("forecastUpdateReason")));
char labelWithMember[kMaxLabelLength];
- snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "forecastId");
- ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.forecastId, value["forecastId"]));
- valueCopy.removeMember("forecastId");
+ snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "forecastID");
+ ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.forecastID, value["forecastID"]));
+ valueCopy.removeMember("forecastID");
snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "activeSlotNumber");
ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.activeSlotNumber, value["activeSlotNumber"]));
@@ -3338,9 +3419,9 @@
}
valueCopy.removeMember("latestEndTime");
- snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "isPauseable");
- ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.isPauseable, value["isPauseable"]));
- valueCopy.removeMember("isPauseable");
+ snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "isPausable");
+ ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.isPausable, value["isPausable"]));
+ valueCopy.removeMember("isPausable");
snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "slots");
ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.slots, value["slots"]));
@@ -3356,13 +3437,13 @@
void ComplexArgumentParser::Finalize(chip::app::Clusters::DeviceEnergyManagement::Structs::ForecastStruct::Type & request)
{
- ComplexArgumentParser::Finalize(request.forecastId);
+ ComplexArgumentParser::Finalize(request.forecastID);
ComplexArgumentParser::Finalize(request.activeSlotNumber);
ComplexArgumentParser::Finalize(request.startTime);
ComplexArgumentParser::Finalize(request.endTime);
ComplexArgumentParser::Finalize(request.earliestStartTime);
ComplexArgumentParser::Finalize(request.latestEndTime);
- ComplexArgumentParser::Finalize(request.isPauseable);
+ ComplexArgumentParser::Finalize(request.isPausable);
ComplexArgumentParser::Finalize(request.slots);
ComplexArgumentParser::Finalize(request.forecastUpdateReason);
}
@@ -3424,52 +3505,6 @@
}
CHIP_ERROR ComplexArgumentParser::Setup(const char * label,
- chip::app::Clusters::DeviceEnergyManagement::Structs::PowerAdjustStruct::Type & request,
- Json::Value & value)
-{
- VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT);
-
- // Copy to track which members we already processed.
- Json::Value valueCopy(value);
-
- ReturnErrorOnFailure(
- ComplexArgumentParser::EnsureMemberExist("PowerAdjustStruct.minPower", "minPower", value.isMember("minPower")));
- ReturnErrorOnFailure(
- ComplexArgumentParser::EnsureMemberExist("PowerAdjustStruct.maxPower", "maxPower", value.isMember("maxPower")));
- ReturnErrorOnFailure(
- ComplexArgumentParser::EnsureMemberExist("PowerAdjustStruct.minDuration", "minDuration", value.isMember("minDuration")));
- ReturnErrorOnFailure(
- ComplexArgumentParser::EnsureMemberExist("PowerAdjustStruct.maxDuration", "maxDuration", value.isMember("maxDuration")));
-
- char labelWithMember[kMaxLabelLength];
- snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "minPower");
- ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.minPower, value["minPower"]));
- valueCopy.removeMember("minPower");
-
- snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "maxPower");
- ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.maxPower, value["maxPower"]));
- valueCopy.removeMember("maxPower");
-
- snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "minDuration");
- ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.minDuration, value["minDuration"]));
- valueCopy.removeMember("minDuration");
-
- snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "maxDuration");
- ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.maxDuration, value["maxDuration"]));
- valueCopy.removeMember("maxDuration");
-
- return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy);
-}
-
-void ComplexArgumentParser::Finalize(chip::app::Clusters::DeviceEnergyManagement::Structs::PowerAdjustStruct::Type & request)
-{
- ComplexArgumentParser::Finalize(request.minPower);
- ComplexArgumentParser::Finalize(request.maxPower);
- ComplexArgumentParser::Finalize(request.minDuration);
- ComplexArgumentParser::Finalize(request.maxDuration);
-}
-
-CHIP_ERROR ComplexArgumentParser::Setup(const char * label,
chip::app::Clusters::DeviceEnergyManagement::Structs::SlotAdjustmentStruct::Type & request,
Json::Value & value)
{
@@ -3480,8 +3515,6 @@
ReturnErrorOnFailure(
ComplexArgumentParser::EnsureMemberExist("SlotAdjustmentStruct.slotIndex", "slotIndex", value.isMember("slotIndex")));
- ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("SlotAdjustmentStruct.nominalPower", "nominalPower",
- value.isMember("nominalPower")));
ReturnErrorOnFailure(
ComplexArgumentParser::EnsureMemberExist("SlotAdjustmentStruct.duration", "duration", value.isMember("duration")));
@@ -3490,8 +3523,11 @@
ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.slotIndex, value["slotIndex"]));
valueCopy.removeMember("slotIndex");
- snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "nominalPower");
- ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.nominalPower, value["nominalPower"]));
+ if (value.isMember("nominalPower"))
+ {
+ snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "nominalPower");
+ ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.nominalPower, value["nominalPower"]));
+ }
valueCopy.removeMember("nominalPower");
snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "duration");
diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h
index 7263b23..074f8c5 100644
--- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h
+++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h
@@ -373,6 +373,17 @@
static void Finalize(chip::app::Clusters::DeviceEnergyManagement::Structs::CostStruct::Type & request);
+static CHIP_ERROR Setup(const char * label, chip::app::Clusters::DeviceEnergyManagement::Structs::PowerAdjustStruct::Type & request,
+ Json::Value & value);
+
+static void Finalize(chip::app::Clusters::DeviceEnergyManagement::Structs::PowerAdjustStruct::Type & request);
+
+static CHIP_ERROR Setup(const char * label,
+ chip::app::Clusters::DeviceEnergyManagement::Structs::PowerAdjustCapabilityStruct::Type & request,
+ Json::Value & value);
+
+static void Finalize(chip::app::Clusters::DeviceEnergyManagement::Structs::PowerAdjustCapabilityStruct::Type & request);
+
static CHIP_ERROR Setup(const char * label, chip::app::Clusters::DeviceEnergyManagement::Structs::SlotStruct::Type & request,
Json::Value & value);
@@ -388,11 +399,6 @@
static void Finalize(chip::app::Clusters::DeviceEnergyManagement::Structs::ConstraintsStruct::Type & request);
-static CHIP_ERROR Setup(const char * label, chip::app::Clusters::DeviceEnergyManagement::Structs::PowerAdjustStruct::Type & request,
- Json::Value & value);
-
-static void Finalize(chip::app::Clusters::DeviceEnergyManagement::Structs::PowerAdjustStruct::Type & request);
-
static CHIP_ERROR Setup(const char * label,
chip::app::Clusters::DeviceEnergyManagement::Structs::SlotAdjustmentStruct::Type & request,
Json::Value & value);
diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp
index fc73123..1845cb7 100644
--- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp
+++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp
@@ -2761,6 +2761,74 @@
return CHIP_NO_ERROR;
}
+CHIP_ERROR
+DataModelLogger::LogValue(const char * label, size_t indent,
+ const chip::app::Clusters::DeviceEnergyManagement::Structs::PowerAdjustStruct::DecodableType & value)
+{
+ DataModelLogger::LogString(label, indent, "{");
+ {
+ CHIP_ERROR err = LogValue("MinPower", indent + 1, value.minPower);
+ if (err != CHIP_NO_ERROR)
+ {
+ DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'MinPower'");
+ return err;
+ }
+ }
+ {
+ CHIP_ERROR err = LogValue("MaxPower", indent + 1, value.maxPower);
+ if (err != CHIP_NO_ERROR)
+ {
+ DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'MaxPower'");
+ return err;
+ }
+ }
+ {
+ CHIP_ERROR err = LogValue("MinDuration", indent + 1, value.minDuration);
+ if (err != CHIP_NO_ERROR)
+ {
+ DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'MinDuration'");
+ return err;
+ }
+ }
+ {
+ CHIP_ERROR err = LogValue("MaxDuration", indent + 1, value.maxDuration);
+ if (err != CHIP_NO_ERROR)
+ {
+ DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'MaxDuration'");
+ return err;
+ }
+ }
+ DataModelLogger::LogString(indent, "}");
+
+ return CHIP_NO_ERROR;
+}
+
+CHIP_ERROR DataModelLogger::LogValue(
+ const char * label, size_t indent,
+ const chip::app::Clusters::DeviceEnergyManagement::Structs::PowerAdjustCapabilityStruct::DecodableType & value)
+{
+ DataModelLogger::LogString(label, indent, "{");
+ {
+ CHIP_ERROR err = LogValue("PowerAdjustCapability", indent + 1, value.powerAdjustCapability);
+ if (err != CHIP_NO_ERROR)
+ {
+ DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'PowerAdjustCapability'");
+ return err;
+ }
+ }
+ {
+ CHIP_ERROR err = LogValue("Cause", indent + 1, value.cause);
+ if (err != CHIP_NO_ERROR)
+ {
+ DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Cause'");
+ return err;
+ }
+ }
+ DataModelLogger::LogString(indent, "}");
+
+ return CHIP_NO_ERROR;
+}
+
CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent,
const chip::app::Clusters::DeviceEnergyManagement::Structs::SlotStruct::DecodableType & value)
{
@@ -2806,10 +2874,10 @@
}
}
{
- CHIP_ERROR err = LogValue("SlotIsPauseable", indent + 1, value.slotIsPauseable);
+ CHIP_ERROR err = LogValue("SlotIsPausable", indent + 1, value.slotIsPausable);
if (err != CHIP_NO_ERROR)
{
- DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'SlotIsPauseable'");
+ DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'SlotIsPausable'");
return err;
}
}
@@ -2920,10 +2988,10 @@
{
DataModelLogger::LogString(label, indent, "{");
{
- CHIP_ERROR err = LogValue("ForecastId", indent + 1, value.forecastId);
+ CHIP_ERROR err = LogValue("ForecastID", indent + 1, value.forecastID);
if (err != CHIP_NO_ERROR)
{
- DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'ForecastId'");
+ DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'ForecastID'");
return err;
}
}
@@ -2968,10 +3036,10 @@
}
}
{
- CHIP_ERROR err = LogValue("IsPauseable", indent + 1, value.isPauseable);
+ CHIP_ERROR err = LogValue("IsPausable", indent + 1, value.isPausable);
if (err != CHIP_NO_ERROR)
{
- DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'IsPauseable'");
+ DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'IsPausable'");
return err;
}
}
@@ -3048,48 +3116,6 @@
CHIP_ERROR
DataModelLogger::LogValue(const char * label, size_t indent,
- const chip::app::Clusters::DeviceEnergyManagement::Structs::PowerAdjustStruct::DecodableType & value)
-{
- DataModelLogger::LogString(label, indent, "{");
- {
- CHIP_ERROR err = LogValue("MinPower", indent + 1, value.minPower);
- if (err != CHIP_NO_ERROR)
- {
- DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'MinPower'");
- return err;
- }
- }
- {
- CHIP_ERROR err = LogValue("MaxPower", indent + 1, value.maxPower);
- if (err != CHIP_NO_ERROR)
- {
- DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'MaxPower'");
- return err;
- }
- }
- {
- CHIP_ERROR err = LogValue("MinDuration", indent + 1, value.minDuration);
- if (err != CHIP_NO_ERROR)
- {
- DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'MinDuration'");
- return err;
- }
- }
- {
- CHIP_ERROR err = LogValue("MaxDuration", indent + 1, value.maxDuration);
- if (err != CHIP_NO_ERROR)
- {
- DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'MaxDuration'");
- return err;
- }
- }
- DataModelLogger::LogString(indent, "}");
-
- return CHIP_NO_ERROR;
-}
-
-CHIP_ERROR
-DataModelLogger::LogValue(const char * label, size_t indent,
const chip::app::Clusters::DeviceEnergyManagement::Structs::SlotAdjustmentStruct::DecodableType & value)
{
DataModelLogger::LogString(label, indent, "{");
@@ -12880,8 +12906,8 @@
return DataModelLogger::LogValue("AbsMaxPower", 1, value);
}
case DeviceEnergyManagement::Attributes::PowerAdjustmentCapability::Id: {
- chip::app::DataModel::Nullable<chip::app::DataModel::DecodableList<
- chip::app::Clusters::DeviceEnergyManagement::Structs::PowerAdjustStruct::DecodableType>>
+ chip::app::DataModel::Nullable<
+ chip::app::Clusters::DeviceEnergyManagement::Structs::PowerAdjustCapabilityStruct::DecodableType>
value;
ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value));
return DataModelLogger::LogValue("PowerAdjustmentCapability", 1, value);
diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h
index 1c78ce9..0e3ede9 100644
--- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h
+++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h
@@ -237,6 +237,13 @@
const chip::app::Clusters::DeviceEnergyManagement::Structs::CostStruct::DecodableType & value);
static CHIP_ERROR LogValue(const char * label, size_t indent,
+ const chip::app::Clusters::DeviceEnergyManagement::Structs::PowerAdjustStruct::DecodableType & value);
+
+static CHIP_ERROR
+LogValue(const char * label, size_t indent,
+ const chip::app::Clusters::DeviceEnergyManagement::Structs::PowerAdjustCapabilityStruct::DecodableType & value);
+
+static CHIP_ERROR LogValue(const char * label, size_t indent,
const chip::app::Clusters::DeviceEnergyManagement::Structs::SlotStruct::DecodableType & value);
static CHIP_ERROR LogValue(const char * label, size_t indent,
@@ -246,9 +253,6 @@
const chip::app::Clusters::DeviceEnergyManagement::Structs::ConstraintsStruct::DecodableType & value);
static CHIP_ERROR LogValue(const char * label, size_t indent,
- const chip::app::Clusters::DeviceEnergyManagement::Structs::PowerAdjustStruct::DecodableType & value);
-
-static CHIP_ERROR LogValue(const char * label, size_t indent,
const chip::app::Clusters::DeviceEnergyManagement::Structs::SlotAdjustmentStruct::DecodableType & value);
static CHIP_ERROR LogValue(const char * label, size_t indent,
diff --git a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h
index 2a886f9..58147bd 100644
--- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h
+++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h
@@ -81846,7 +81846,7 @@
, mComplex_SlotAdjustments(&mRequest.slotAdjustments)
{
#if MTR_ENABLE_PROVISIONAL
- AddArgument("ForecastId", 0, UINT32_MAX, &mRequest.forecastId);
+ AddArgument("ForecastID", 0, UINT32_MAX, &mRequest.forecastID);
#endif // MTR_ENABLE_PROVISIONAL
#if MTR_ENABLE_PROVISIONAL
AddArgument("SlotAdjustments", &mComplex_SlotAdjustments);
@@ -81869,7 +81869,7 @@
__auto_type * params = [[MTRDeviceEnergyManagementClusterModifyForecastRequestParams alloc] init];
params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil;
#if MTR_ENABLE_PROVISIONAL
- params.forecastId = [NSNumber numberWithUnsignedInt:mRequest.forecastId];
+ params.forecastID = [NSNumber numberWithUnsignedInt:mRequest.forecastID];
#endif // MTR_ENABLE_PROVISIONAL
#if MTR_ENABLE_PROVISIONAL
{ // Scope for our temporary variables
@@ -81878,7 +81878,11 @@
MTRDeviceEnergyManagementClusterSlotAdjustmentStruct * newElement_0;
newElement_0 = [MTRDeviceEnergyManagementClusterSlotAdjustmentStruct new];
newElement_0.slotIndex = [NSNumber numberWithUnsignedChar:entry_0.slotIndex];
- newElement_0.nominalPower = [NSNumber numberWithLongLong:entry_0.nominalPower];
+ if (entry_0.nominalPower.HasValue()) {
+ newElement_0.nominalPower = [NSNumber numberWithLongLong:entry_0.nominalPower.Value()];
+ } else {
+ newElement_0.nominalPower = nil;
+ }
newElement_0.duration = [NSNumber numberWithUnsignedInt:entry_0.duration];
[array_0 addObject:newElement_0];
}
@@ -82496,7 +82500,7 @@
dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL);
__auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue];
- [cluster readAttributePowerAdjustmentCapabilityWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) {
+ [cluster readAttributePowerAdjustmentCapabilityWithCompletion:^(MTRDeviceEnergyManagementClusterPowerAdjustCapabilityStruct * _Nullable value, NSError * _Nullable error) {
NSLog(@"DeviceEnergyManagement.PowerAdjustmentCapability response %@", [value description]);
if (error == nil) {
RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value);
@@ -82541,7 +82545,7 @@
}
[cluster subscribeAttributePowerAdjustmentCapabilityWithParams:params
subscriptionEstablished:^() { mSubscriptionEstablished = YES; }
- reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) {
+ reportHandler:^(MTRDeviceEnergyManagementClusterPowerAdjustCapabilityStruct * _Nullable value, NSError * _Nullable error) {
NSLog(@"DeviceEnergyManagement.PowerAdjustmentCapability response %@", [value description]);
if (error == nil) {
RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value);