diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml
index 8ef506bf2d6362..dcbd3d9e0453e7 100644
--- a/.github/workflows/tests.yaml
+++ b/.github/workflows/tests.yaml
@@ -114,6 +114,7 @@ jobs:
src/app/zap-templates/zcl/data-model/chip/content-control-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/descriptor-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/device-energy-management-cluster.xml \
+ src/app/zap-templates/zcl/data-model/chip/device-energy-management-mode-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/diagnostic-logs-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/dishwasher-alarm-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/dishwasher-mode-cluster.xml \
@@ -121,6 +122,7 @@ jobs:
src/app/zap-templates/zcl/data-model/chip/microwave-oven-control-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/door-lock-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml \
+ src/app/zap-templates/zcl/data-model/chip/energy-evse-mode-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/ethernet-network-diagnostics-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/fan-control-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/fault-injection-cluster.xml \
diff --git a/data_model/clusters/Mode_DeviceEnergyManagement.xml b/data_model/clusters/Mode_DeviceEnergyManagement.xml
new file mode 100644
index 00000000000000..7f6075e2f599e7
--- /dev/null
+++ b/data_model/clusters/Mode_DeviceEnergyManagement.xml
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/data_model/clusters/Mode_EVSE.xml b/data_model/clusters/Mode_EVSE.xml
index d52139252d014d..7f3c28896432e5 100644
--- a/data_model/clusters/Mode_EVSE.xml
+++ b/data_model/clusters/Mode_EVSE.xml
@@ -1,6 +1,7 @@
-
+
-
-
-
-
-
+-->
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/clusters.md b/docs/clusters.md
index 70f657fd8779ad..510dce18b0d3e6 100644
--- a/docs/clusters.md
+++ b/docs/clusters.md
@@ -82,6 +82,8 @@ Generally regenerate using one of:
| 152 | 0x98 | DeviceEnergyManagement |
| 153 | 0x99 | EnergyEvse |
| 155 | 0x9B | EnergyPreference |
+| 157 | 0x9D | EnergyEvseMode |
+| 159 | 0x9F | DeviceEnergyManagementMode |
| 257 | 0x101 | DoorLock |
| 258 | 0x102 | WindowCovering |
| 259 | 0x103 | BarrierControl |
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 04dbb94c3e0d8f..f23636aaca5479 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
@@ -4376,6 +4376,107 @@ provisional cluster EnergyEvse = 153 {
timed command ClearTargets(): DefaultSuccess = 7;
}
+/** Attributes and commands for selecting a mode from a list of supported options. */
+provisional cluster EnergyEvseMode = 157 {
+ revision 1;
+
+ enum ModeTag : enum16 {
+ kManual = 16384;
+ kTimeOfUse = 16385;
+ kSolarCharging = 16386;
+ }
+
+ bitmap Feature : bitmap32 {
+ kOnOff = 0x1;
+ }
+
+ struct ModeTagStruct {
+ optional vendor_id mfgCode = 0;
+ enum16 value = 1;
+ }
+
+ struct ModeOptionStruct {
+ char_string<64> label = 0;
+ int8u mode = 1;
+ ModeTagStruct modeTags[] = 2;
+ }
+
+ readonly attribute ModeOptionStruct supportedModes[] = 0;
+ readonly attribute int8u currentMode = 1;
+ attribute optional nullable int8u startUpMode = 2;
+ attribute optional nullable int8u onMode = 3;
+ readonly attribute command_id generatedCommandList[] = 65528;
+ readonly attribute command_id acceptedCommandList[] = 65529;
+ readonly attribute event_id eventList[] = 65530;
+ readonly attribute attrib_id attributeList[] = 65531;
+ readonly attribute bitmap32 featureMap = 65532;
+ readonly attribute int16u clusterRevision = 65533;
+
+ request struct ChangeToModeRequest {
+ int8u newMode = 0;
+ }
+
+ response struct ChangeToModeResponse = 1 {
+ enum8 status = 0;
+ optional char_string<64> statusText = 1;
+ }
+
+ /** This command is used to change device modes.
+ On receipt of this command the device SHALL respond with a ChangeToModeResponse command. */
+ command ChangeToMode(ChangeToModeRequest): ChangeToModeResponse = 0;
+}
+
+/** Attributes and commands for selecting a mode from a list of supported options. */
+provisional cluster DeviceEnergyManagementMode = 159 {
+ revision 1;
+
+ enum ModeTag : enum16 {
+ kNoOptimization = 16384;
+ kDeviceOptimization = 16385;
+ kLocalOptimization = 16386;
+ kGridOptimization = 16387;
+ }
+
+ bitmap Feature : bitmap32 {
+ kOnOff = 0x1;
+ }
+
+ struct ModeTagStruct {
+ optional vendor_id mfgCode = 0;
+ enum16 value = 1;
+ }
+
+ struct ModeOptionStruct {
+ char_string<64> label = 0;
+ int8u mode = 1;
+ ModeTagStruct modeTags[] = 2;
+ }
+
+ readonly attribute ModeOptionStruct supportedModes[] = 0;
+ readonly attribute int8u currentMode = 1;
+ attribute optional nullable int8u startUpMode = 2;
+ attribute optional nullable int8u onMode = 3;
+ readonly attribute command_id generatedCommandList[] = 65528;
+ readonly attribute command_id acceptedCommandList[] = 65529;
+ readonly attribute event_id eventList[] = 65530;
+ readonly attribute attrib_id attributeList[] = 65531;
+ readonly attribute bitmap32 featureMap = 65532;
+ readonly attribute int16u clusterRevision = 65533;
+
+ request struct ChangeToModeRequest {
+ int8u newMode = 0;
+ }
+
+ response struct ChangeToModeResponse = 1 {
+ enum8 status = 0;
+ optional char_string<64> statusText = 1;
+ }
+
+ /** This command is used to change device modes.
+ On receipt of this command the device SHALL respond with a ChangeToModeResponse command. */
+ command ChangeToMode(ChangeToModeRequest): ChangeToModeResponse = 0;
+}
+
/** Provides an interface for controlling and adjusting automatic window coverings. */
cluster WindowCovering = 258 {
revision 5;
@@ -8105,6 +8206,34 @@ endpoint 1 {
handle command ClearTargets;
}
+ server cluster EnergyEvseMode {
+ callback attribute supportedModes;
+ callback attribute currentMode;
+ callback attribute generatedCommandList;
+ callback attribute acceptedCommandList;
+ callback attribute eventList;
+ callback attribute attributeList;
+ callback attribute featureMap;
+ ram attribute clusterRevision default = 1;
+
+ handle command ChangeToMode;
+ handle command ChangeToModeResponse;
+ }
+
+ server cluster DeviceEnergyManagementMode {
+ callback attribute supportedModes;
+ callback attribute currentMode;
+ callback attribute generatedCommandList;
+ callback attribute acceptedCommandList;
+ callback attribute eventList;
+ callback attribute attributeList;
+ callback attribute featureMap;
+ ram attribute clusterRevision default = 1;
+
+ handle command ChangeToMode;
+ handle command ChangeToModeResponse;
+ }
+
server cluster WindowCovering {
ram attribute type default = 0x08;
ram attribute physicalClosedLimitLift default = 0xFFFF;
diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap
index 4beb963e3cef2c..b544d00c165e13 100644
--- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap
+++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap
@@ -13751,6 +13751,320 @@
}
]
},
+ {
+ "name": "Energy EVSE Mode",
+ "code": 157,
+ "mfgCode": null,
+ "define": "ENERGY_EVSE_MODE_CLUSTER",
+ "side": "server",
+ "enabled": 1,
+ "apiMaturity": "provisional",
+ "commands": [
+ {
+ "name": "ChangeToMode",
+ "code": 0,
+ "mfgCode": null,
+ "source": "client",
+ "isIncoming": 1,
+ "isEnabled": 1
+ },
+ {
+ "name": "ChangeToModeResponse",
+ "code": 1,
+ "mfgCode": null,
+ "source": "server",
+ "isIncoming": 0,
+ "isEnabled": 1
+ }
+ ],
+ "attributes": [
+ {
+ "name": "SupportedModes",
+ "code": 0,
+ "mfgCode": null,
+ "side": "server",
+ "type": "array",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": "",
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "CurrentMode",
+ "code": 1,
+ "mfgCode": null,
+ "side": "server",
+ "type": "int8u",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": "",
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "GeneratedCommandList",
+ "code": 65528,
+ "mfgCode": null,
+ "side": "server",
+ "type": "array",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": "",
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "AcceptedCommandList",
+ "code": 65529,
+ "mfgCode": null,
+ "side": "server",
+ "type": "array",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": "",
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "EventList",
+ "code": 65530,
+ "mfgCode": null,
+ "side": "server",
+ "type": "array",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": "",
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "AttributeList",
+ "code": 65531,
+ "mfgCode": null,
+ "side": "server",
+ "type": "array",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": "",
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "FeatureMap",
+ "code": 65532,
+ "mfgCode": null,
+ "side": "server",
+ "type": "bitmap32",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": "0",
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "ClusterRevision",
+ "code": 65533,
+ "mfgCode": null,
+ "side": "server",
+ "type": "int16u",
+ "included": 1,
+ "storageOption": "RAM",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": "1",
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ }
+ ]
+ },
+ {
+ "name": "Device Energy Management Mode",
+ "code": 159,
+ "mfgCode": null,
+ "define": "DEVICE_ENERGY_MANAGEMENT_MODE_CLUSTER",
+ "side": "server",
+ "enabled": 1,
+ "apiMaturity": "provisional",
+ "commands": [
+ {
+ "name": "ChangeToMode",
+ "code": 0,
+ "mfgCode": null,
+ "source": "client",
+ "isIncoming": 1,
+ "isEnabled": 1
+ },
+ {
+ "name": "ChangeToModeResponse",
+ "code": 1,
+ "mfgCode": null,
+ "source": "server",
+ "isIncoming": 0,
+ "isEnabled": 1
+ }
+ ],
+ "attributes": [
+ {
+ "name": "SupportedModes",
+ "code": 0,
+ "mfgCode": null,
+ "side": "server",
+ "type": "array",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": "",
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "CurrentMode",
+ "code": 1,
+ "mfgCode": null,
+ "side": "server",
+ "type": "int8u",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": "",
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "GeneratedCommandList",
+ "code": 65528,
+ "mfgCode": null,
+ "side": "server",
+ "type": "array",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": "",
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "AcceptedCommandList",
+ "code": 65529,
+ "mfgCode": null,
+ "side": "server",
+ "type": "array",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": "",
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "EventList",
+ "code": 65530,
+ "mfgCode": null,
+ "side": "server",
+ "type": "array",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": "",
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "AttributeList",
+ "code": 65531,
+ "mfgCode": null,
+ "side": "server",
+ "type": "array",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": "",
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "FeatureMap",
+ "code": 65532,
+ "mfgCode": null,
+ "side": "server",
+ "type": "bitmap32",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": "0",
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "ClusterRevision",
+ "code": 65533,
+ "mfgCode": null,
+ "side": "server",
+ "type": "int16u",
+ "included": 1,
+ "storageOption": "RAM",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": "1",
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ }
+ ]
+ },
{
"name": "Window Covering",
"code": 258,
diff --git a/examples/all-clusters-app/linux/BUILD.gn b/examples/all-clusters-app/linux/BUILD.gn
index 44f258069c7063..960d3aadbc9ed7 100644
--- a/examples/all-clusters-app/linux/BUILD.gn
+++ b/examples/all-clusters-app/linux/BUILD.gn
@@ -49,6 +49,8 @@ source_set("chip-all-clusters-common") {
"${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp",
+ "${chip_root}/examples/energy-management-app/energy-management-common/src/device-energy-management-mode.cpp",
+ "${chip_root}/examples/energy-management-app/energy-management-common/src/energy-evse-mode.cpp",
"AllClustersCommandDelegate.cpp",
"AppOptions.cpp",
"ValveControlDelegate.cpp",
diff --git a/examples/all-clusters-app/linux/main-common.cpp b/examples/all-clusters-app/linux/main-common.cpp
index e408c36ff417fa..a3dd33c5e79de0 100644
--- a/examples/all-clusters-app/linux/main-common.cpp
+++ b/examples/all-clusters-app/linux/main-common.cpp
@@ -20,7 +20,9 @@
#include "ValveControlDelegate.h"
#include "WindowCoveringManager.h"
#include "air-quality-instance.h"
+#include "device-energy-management-modes.h"
#include "dishwasher-mode.h"
+#include "energy-evse-modes.h"
#include "include/tv-callbacks.h"
#include "laundry-dryer-controls-delegate-impl.h"
#include "laundry-washer-controls-delegate-impl.h"
@@ -251,6 +253,9 @@ void ApplicationShutdown()
Clusters::OvenMode::Shutdown();
Clusters::OvenCavityOperationalState::Shutdown();
+ Clusters::DeviceEnergyManagementMode::Shutdown();
+ Clusters::EnergyEvseMode::Shutdown();
+
if (sChipNamedPipeCommands.Stop() != CHIP_NO_ERROR)
{
ChipLogError(NotSpecified, "Failed to stop CHIP NamedPipeCommands");
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 56e288bc712b9b..d779ebbebdd1ba 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
@@ -1288,6 +1288,107 @@ provisional cluster EnergyEvse = 153 {
timed command ClearTargets(): DefaultSuccess = 7;
}
+/** Attributes and commands for selecting a mode from a list of supported options. */
+provisional cluster EnergyEvseMode = 157 {
+ revision 1;
+
+ enum ModeTag : enum16 {
+ kManual = 16384;
+ kTimeOfUse = 16385;
+ kSolarCharging = 16386;
+ }
+
+ bitmap Feature : bitmap32 {
+ kOnOff = 0x1;
+ }
+
+ struct ModeTagStruct {
+ optional vendor_id mfgCode = 0;
+ enum16 value = 1;
+ }
+
+ struct ModeOptionStruct {
+ char_string<64> label = 0;
+ int8u mode = 1;
+ ModeTagStruct modeTags[] = 2;
+ }
+
+ readonly attribute ModeOptionStruct supportedModes[] = 0;
+ readonly attribute int8u currentMode = 1;
+ attribute optional nullable int8u startUpMode = 2;
+ attribute optional nullable int8u onMode = 3;
+ readonly attribute command_id generatedCommandList[] = 65528;
+ readonly attribute command_id acceptedCommandList[] = 65529;
+ readonly attribute event_id eventList[] = 65530;
+ readonly attribute attrib_id attributeList[] = 65531;
+ readonly attribute bitmap32 featureMap = 65532;
+ readonly attribute int16u clusterRevision = 65533;
+
+ request struct ChangeToModeRequest {
+ int8u newMode = 0;
+ }
+
+ response struct ChangeToModeResponse = 1 {
+ enum8 status = 0;
+ optional char_string<64> statusText = 1;
+ }
+
+ /** This command is used to change device modes.
+ On receipt of this command the device SHALL respond with a ChangeToModeResponse command. */
+ command ChangeToMode(ChangeToModeRequest): ChangeToModeResponse = 0;
+}
+
+/** Attributes and commands for selecting a mode from a list of supported options. */
+provisional cluster DeviceEnergyManagementMode = 159 {
+ revision 1;
+
+ enum ModeTag : enum16 {
+ kNoOptimization = 16384;
+ kDeviceOptimization = 16385;
+ kLocalOptimization = 16386;
+ kGridOptimization = 16387;
+ }
+
+ bitmap Feature : bitmap32 {
+ kOnOff = 0x1;
+ }
+
+ struct ModeTagStruct {
+ optional vendor_id mfgCode = 0;
+ enum16 value = 1;
+ }
+
+ struct ModeOptionStruct {
+ char_string<64> label = 0;
+ int8u mode = 1;
+ ModeTagStruct modeTags[] = 2;
+ }
+
+ readonly attribute ModeOptionStruct supportedModes[] = 0;
+ readonly attribute int8u currentMode = 1;
+ attribute optional nullable int8u startUpMode = 2;
+ attribute optional nullable int8u onMode = 3;
+ readonly attribute command_id generatedCommandList[] = 65528;
+ readonly attribute command_id acceptedCommandList[] = 65529;
+ readonly attribute event_id eventList[] = 65530;
+ readonly attribute attrib_id attributeList[] = 65531;
+ readonly attribute bitmap32 featureMap = 65532;
+ readonly attribute int16u clusterRevision = 65533;
+
+ request struct ChangeToModeRequest {
+ int8u newMode = 0;
+ }
+
+ response struct ChangeToModeResponse = 1 {
+ enum8 status = 0;
+ optional char_string<64> statusText = 1;
+ }
+
+ /** This command is used to change device modes.
+ On receipt of this command the device SHALL respond with a ChangeToModeResponse command. */
+ command ChangeToMode(ChangeToModeRequest): ChangeToModeResponse = 0;
+}
+
endpoint 0 {
device type ma_rootdevice = 22, version 1;
@@ -1573,6 +1674,34 @@ endpoint 1 {
handle command GetTargets;
handle command ClearTargets;
}
+
+ server cluster EnergyEvseMode {
+ callback attribute supportedModes;
+ callback attribute currentMode;
+ callback attribute generatedCommandList;
+ callback attribute acceptedCommandList;
+ callback attribute eventList;
+ callback attribute attributeList;
+ callback attribute featureMap;
+ ram attribute clusterRevision default = 1;
+
+ handle command ChangeToMode;
+ handle command ChangeToModeResponse;
+ }
+
+ server cluster DeviceEnergyManagementMode {
+ callback attribute supportedModes;
+ callback attribute currentMode;
+ callback attribute generatedCommandList;
+ callback attribute acceptedCommandList;
+ callback attribute eventList;
+ callback attribute attributeList;
+ callback attribute featureMap;
+ ram attribute clusterRevision default = 1;
+
+ handle command ChangeToMode;
+ handle command ChangeToModeResponse;
+ }
}
diff --git a/examples/energy-management-app/energy-management-common/energy-management-app.zap b/examples/energy-management-app/energy-management-common/energy-management-app.zap
index 59bfa1efb8a6c0..c23f65bffa1297 100644
--- a/examples/energy-management-app/energy-management-common/energy-management-app.zap
+++ b/examples/energy-management-app/energy-management-common/energy-management-app.zap
@@ -3432,6 +3432,320 @@
"included": 1
}
]
+ },
+ {
+ "name": "Energy EVSE Mode",
+ "code": 157,
+ "mfgCode": null,
+ "define": "ENERGY_EVSE_MODE_CLUSTER",
+ "side": "server",
+ "enabled": 1,
+ "apiMaturity": "provisional",
+ "commands": [
+ {
+ "name": "ChangeToMode",
+ "code": 0,
+ "mfgCode": null,
+ "source": "client",
+ "isIncoming": 1,
+ "isEnabled": 1
+ },
+ {
+ "name": "ChangeToModeResponse",
+ "code": 1,
+ "mfgCode": null,
+ "source": "server",
+ "isIncoming": 0,
+ "isEnabled": 1
+ }
+ ],
+ "attributes": [
+ {
+ "name": "SupportedModes",
+ "code": 0,
+ "mfgCode": null,
+ "side": "server",
+ "type": "array",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": "",
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "CurrentMode",
+ "code": 1,
+ "mfgCode": null,
+ "side": "server",
+ "type": "int8u",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": "",
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "GeneratedCommandList",
+ "code": 65528,
+ "mfgCode": null,
+ "side": "server",
+ "type": "array",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": "",
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "AcceptedCommandList",
+ "code": 65529,
+ "mfgCode": null,
+ "side": "server",
+ "type": "array",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": "",
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "EventList",
+ "code": 65530,
+ "mfgCode": null,
+ "side": "server",
+ "type": "array",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": "",
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "AttributeList",
+ "code": 65531,
+ "mfgCode": null,
+ "side": "server",
+ "type": "array",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": "",
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "FeatureMap",
+ "code": 65532,
+ "mfgCode": null,
+ "side": "server",
+ "type": "bitmap32",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": "0",
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "ClusterRevision",
+ "code": 65533,
+ "mfgCode": null,
+ "side": "server",
+ "type": "int16u",
+ "included": 1,
+ "storageOption": "RAM",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": "1",
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ }
+ ]
+ },
+ {
+ "name": "Device Energy Management Mode",
+ "code": 159,
+ "mfgCode": null,
+ "define": "DEVICE_ENERGY_MANAGEMENT_MODE_CLUSTER",
+ "side": "server",
+ "enabled": 1,
+ "apiMaturity": "provisional",
+ "commands": [
+ {
+ "name": "ChangeToMode",
+ "code": 0,
+ "mfgCode": null,
+ "source": "client",
+ "isIncoming": 1,
+ "isEnabled": 1
+ },
+ {
+ "name": "ChangeToModeResponse",
+ "code": 1,
+ "mfgCode": null,
+ "source": "server",
+ "isIncoming": 0,
+ "isEnabled": 1
+ }
+ ],
+ "attributes": [
+ {
+ "name": "SupportedModes",
+ "code": 0,
+ "mfgCode": null,
+ "side": "server",
+ "type": "array",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": "",
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "CurrentMode",
+ "code": 1,
+ "mfgCode": null,
+ "side": "server",
+ "type": "int8u",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": "",
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "GeneratedCommandList",
+ "code": 65528,
+ "mfgCode": null,
+ "side": "server",
+ "type": "array",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": "",
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "AcceptedCommandList",
+ "code": 65529,
+ "mfgCode": null,
+ "side": "server",
+ "type": "array",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": "",
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "EventList",
+ "code": 65530,
+ "mfgCode": null,
+ "side": "server",
+ "type": "array",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": "",
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "AttributeList",
+ "code": 65531,
+ "mfgCode": null,
+ "side": "server",
+ "type": "array",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": "",
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "FeatureMap",
+ "code": 65532,
+ "mfgCode": null,
+ "side": "server",
+ "type": "bitmap32",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": "0",
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "ClusterRevision",
+ "code": 65533,
+ "mfgCode": null,
+ "side": "server",
+ "type": "int16u",
+ "included": 1,
+ "storageOption": "RAM",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": "1",
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ }
+ ]
}
]
}
diff --git a/examples/energy-management-app/energy-management-common/include/device-energy-management-modes.h b/examples/energy-management-app/energy-management-common/include/device-energy-management-modes.h
new file mode 100644
index 00000000000000..75d1a66fcb0f37
--- /dev/null
+++ b/examples/energy-management-app/energy-management-common/include/device-energy-management-modes.h
@@ -0,0 +1,95 @@
+/*
+ *
+ * Copyright (c) 2024 Project CHIP Authors
+ * All rights reserved.
+ *
+ * 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
+#include
+#include
+#include
+#include
+
+namespace chip {
+namespace app {
+namespace Clusters {
+
+namespace DeviceEnergyManagementMode {
+
+constexpr uint8_t kModeNoOptimization = 0;
+constexpr uint8_t kModeDeviceOnlyOptimization = 1;
+constexpr uint8_t kModeDeviceAndLocalOptimization = 2;
+constexpr uint8_t kModeDeviceAndGridOptimization = 3;
+constexpr uint8_t kModeAllOptimization = 4;
+
+/// This is an application level delegate to handle DeviceEnergyManagement modes.
+class DeviceEnergyManagementModeDelegate : public ModeBase::Delegate
+{
+private:
+ using ModeTagStructType = detail::Structs::ModeTagStruct::Type;
+ ModeTagStructType ModeTagsNoOptimization[1] = { { .value = to_underlying(ModeTag::kNoOptimization) } };
+ ModeTagStructType ModeTagsDeviceOnlyOptimization[1] = { { .value = to_underlying(ModeTag::kDeviceOptimization) } };
+ ModeTagStructType ModeTagsDeviceAndLocalOptimization[2] = { { .value = to_underlying(ModeTag::kLocalOptimization) },
+ { .value = to_underlying(ModeTag::kDeviceOptimization) } };
+ ModeTagStructType ModeTagsDeviceAndGridOptimization[2] = { { .value = to_underlying(ModeTag::kDeviceOptimization) },
+ { .value = to_underlying(ModeTag::kGridOptimization) } };
+ ModeTagStructType ModeTagsAllOptimization[3] = { { .value = to_underlying(ModeTag::kLocalOptimization) },
+ { .value = to_underlying(ModeTag::kDeviceOptimization) },
+ { .value = to_underlying(ModeTag::kGridOptimization) } };
+
+ const detail::Structs::ModeOptionStruct::Type kModeOptions[5] = {
+ detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("No energy management (forecast only)"),
+ .mode = kModeNoOptimization,
+ .modeTags = DataModel::List(ModeTagsNoOptimization) },
+ detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Device optimizes (no local or grid control)"),
+ .mode = kModeDeviceOnlyOptimization,
+ .modeTags =
+ DataModel::List(ModeTagsDeviceOnlyOptimization) },
+ detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Optimized within building"),
+ .mode = kModeDeviceAndLocalOptimization,
+ .modeTags =
+ DataModel::List(ModeTagsDeviceAndLocalOptimization) },
+ detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Optimized for grid"),
+ .mode = kModeDeviceAndGridOptimization,
+ .modeTags =
+ DataModel::List(ModeTagsDeviceAndGridOptimization) },
+ detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Optimized for grid and building"),
+ .mode = kModeAllOptimization,
+ .modeTags = DataModel::List(ModeTagsAllOptimization) },
+
+ };
+
+ CHIP_ERROR Init() override;
+ void HandleChangeToMode(uint8_t mode, ModeBase::Commands::ChangeToModeResponse::Type & response) override;
+
+ CHIP_ERROR GetModeLabelByIndex(uint8_t modeIndex, MutableCharSpan & label) override;
+ CHIP_ERROR GetModeValueByIndex(uint8_t modeIndex, uint8_t & value) override;
+ CHIP_ERROR GetModeTagsByIndex(uint8_t modeIndex, DataModel::List & tags) override;
+
+public:
+ ~DeviceEnergyManagementModeDelegate() override = default;
+};
+
+ModeBase::Instance * Instance();
+
+void Shutdown();
+
+} // namespace DeviceEnergyManagementMode
+
+} // namespace Clusters
+} // namespace app
+} // namespace chip
diff --git a/examples/energy-management-app/energy-management-common/include/energy-evse-modes.h b/examples/energy-management-app/energy-management-common/include/energy-evse-modes.h
new file mode 100644
index 00000000000000..97189b0069fa81
--- /dev/null
+++ b/examples/energy-management-app/energy-management-common/include/energy-evse-modes.h
@@ -0,0 +1,87 @@
+/*
+ *
+ * Copyright (c) 2024 Project CHIP Authors
+ * All rights reserved.
+ *
+ * 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
+#include
+#include
+#include
+#include
+
+namespace chip {
+namespace app {
+namespace Clusters {
+
+namespace EnergyEvseMode {
+
+constexpr uint8_t kModeManual = 0;
+constexpr uint8_t kModeTimeOfUse = 1;
+constexpr uint8_t kModeSolarCharging = 2;
+constexpr uint8_t kModeTimeOfUseAndSolarCharging = 3;
+
+/// This is an application level delegate to handle EnergyEvse modes.
+class EnergyEvseModeDelegate : public ModeBase::Delegate
+{
+private:
+ using ModeTagStructType = detail::Structs::ModeTagStruct::Type;
+ ModeTagStructType ModeTagsManual[1] = { { .value = to_underlying(ModeTag::kManual) } };
+ ModeTagStructType ModeTagsTimeOfUse[1] = { { .value = to_underlying(ModeTag::kTimeOfUse) } };
+ ModeTagStructType ModeTagsSolarCharging[1] = { { .value = to_underlying(ModeTag::kSolarCharging) } };
+ ModeTagStructType ModeTagsTimeOfUseAndSolarCharging[2] = {
+ { .value = to_underlying(ModeTag::kTimeOfUse) },
+ { .value = to_underlying(ModeTag::kSolarCharging) },
+ };
+
+ const detail::Structs::ModeOptionStruct::Type kModeOptions[4] = {
+ detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Manual"),
+ .mode = kModeManual,
+ .modeTags = DataModel::List(ModeTagsManual) },
+ detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Auto-scheduled"),
+ .mode = kModeTimeOfUse,
+ .modeTags = DataModel::List(ModeTagsTimeOfUse) },
+ detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Solar"),
+ .mode = kModeSolarCharging,
+ .modeTags = DataModel::List(ModeTagsSolarCharging) },
+ detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Auto-scheduled with Solar charging"),
+ .mode = kModeTimeOfUseAndSolarCharging,
+ .modeTags =
+ DataModel::List(ModeTagsTimeOfUseAndSolarCharging) },
+
+ };
+
+ CHIP_ERROR Init() override;
+ void HandleChangeToMode(uint8_t mode, ModeBase::Commands::ChangeToModeResponse::Type & response) override;
+
+ CHIP_ERROR GetModeLabelByIndex(uint8_t modeIndex, MutableCharSpan & label) override;
+ CHIP_ERROR GetModeValueByIndex(uint8_t modeIndex, uint8_t & value) override;
+ CHIP_ERROR GetModeTagsByIndex(uint8_t modeIndex, DataModel::List & tags) override;
+
+public:
+ ~EnergyEvseModeDelegate() override = default;
+};
+
+ModeBase::Instance * Instance();
+
+void Shutdown();
+
+} // namespace EnergyEvseMode
+
+} // namespace Clusters
+} // namespace app
+} // namespace chip
diff --git a/examples/energy-management-app/energy-management-common/src/device-energy-management-mode.cpp b/examples/energy-management-app/energy-management-common/src/device-energy-management-mode.cpp
new file mode 100644
index 00000000000000..9f79f78ee653d5
--- /dev/null
+++ b/examples/energy-management-app/energy-management-common/src/device-energy-management-mode.cpp
@@ -0,0 +1,100 @@
+/*
+ *
+ * Copyright (c) 2024 Project CHIP Authors
+ * All rights reserved.
+ *
+ * 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.
+ */
+
+#include
+#include
+
+using namespace chip::app::Clusters;
+using namespace chip::app::Clusters::DeviceEnergyManagementMode;
+using chip::Protocols::InteractionModel::Status;
+template
+using List = chip::app::DataModel::List;
+using ModeTagStructType = chip::app::Clusters::detail::Structs::ModeTagStruct::Type;
+
+static std::unique_ptr gDeviceEnergyManagementModeDelegate;
+static std::unique_ptr gDeviceEnergyManagementModeInstance;
+
+CHIP_ERROR DeviceEnergyManagementModeDelegate::Init()
+{
+ return CHIP_NO_ERROR;
+}
+
+void DeviceEnergyManagementModeDelegate::HandleChangeToMode(uint8_t NewMode,
+ ModeBase::Commands::ChangeToModeResponse::Type & response)
+{
+ response.status = to_underlying(ModeBase::StatusCode::kSuccess);
+}
+
+CHIP_ERROR DeviceEnergyManagementModeDelegate::GetModeLabelByIndex(uint8_t modeIndex, chip::MutableCharSpan & label)
+{
+ if (modeIndex >= ArraySize(kModeOptions))
+ {
+ return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
+ }
+ return chip::CopyCharSpanToMutableCharSpan(kModeOptions[modeIndex].label, label);
+}
+
+CHIP_ERROR DeviceEnergyManagementModeDelegate::GetModeValueByIndex(uint8_t modeIndex, uint8_t & value)
+{
+ if (modeIndex >= ArraySize(kModeOptions))
+ {
+ return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
+ }
+ value = kModeOptions[modeIndex].mode;
+ return CHIP_NO_ERROR;
+}
+
+CHIP_ERROR DeviceEnergyManagementModeDelegate::GetModeTagsByIndex(uint8_t modeIndex, List & tags)
+{
+ if (modeIndex >= ArraySize(kModeOptions))
+ {
+ return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
+ }
+
+ if (tags.size() < kModeOptions[modeIndex].modeTags.size())
+ {
+ return CHIP_ERROR_INVALID_ARGUMENT;
+ }
+
+ std::copy(kModeOptions[modeIndex].modeTags.begin(), kModeOptions[modeIndex].modeTags.end(), tags.begin());
+ tags.reduce_size(kModeOptions[modeIndex].modeTags.size());
+
+ return CHIP_NO_ERROR;
+}
+
+ModeBase::Instance * DeviceEnergyManagementMode::Instance()
+{
+ return gDeviceEnergyManagementModeInstance.get();
+}
+
+void DeviceEnergyManagementMode::Shutdown()
+{
+ gDeviceEnergyManagementModeInstance.reset();
+ gDeviceEnergyManagementModeDelegate.reset();
+}
+
+void emberAfDeviceEnergyManagementModeClusterInitCallback(chip::EndpointId endpointId)
+{
+ VerifyOrDie(endpointId == 1); // this cluster is only enabled for endpoint 1.
+ VerifyOrDie(!gDeviceEnergyManagementModeDelegate && !gDeviceEnergyManagementModeInstance);
+ gDeviceEnergyManagementModeDelegate = std::make_unique();
+ gDeviceEnergyManagementModeInstance =
+ std::make_unique(gDeviceEnergyManagementModeDelegate.get(), 0x1, DeviceEnergyManagementMode::Id,
+ chip::to_underlying(DeviceEnergyManagementMode::Feature::kOnOff));
+ gDeviceEnergyManagementModeInstance->Init();
+}
diff --git a/examples/energy-management-app/energy-management-common/src/energy-evse-mode.cpp b/examples/energy-management-app/energy-management-common/src/energy-evse-mode.cpp
new file mode 100644
index 00000000000000..0d413682d20f84
--- /dev/null
+++ b/examples/energy-management-app/energy-management-common/src/energy-evse-mode.cpp
@@ -0,0 +1,97 @@
+/*
+ *
+ * Copyright (c) 2024 Project CHIP Authors
+ * All rights reserved.
+ *
+ * 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.
+ */
+
+#include
+#include
+
+using namespace chip::app::Clusters;
+using namespace chip::app::Clusters::EnergyEvseMode;
+using chip::Protocols::InteractionModel::Status;
+template
+using List = chip::app::DataModel::List;
+using ModeTagStructType = chip::app::Clusters::detail::Structs::ModeTagStruct::Type;
+
+static std::unique_ptr gEnergyEvseModeDelegate;
+static std::unique_ptr gEnergyEvseModeInstance;
+
+CHIP_ERROR EnergyEvseModeDelegate::Init()
+{
+ return CHIP_NO_ERROR;
+}
+
+void EnergyEvseModeDelegate::HandleChangeToMode(uint8_t NewMode, ModeBase::Commands::ChangeToModeResponse::Type & response)
+{
+ response.status = to_underlying(ModeBase::StatusCode::kSuccess);
+}
+
+CHIP_ERROR EnergyEvseModeDelegate::GetModeLabelByIndex(uint8_t modeIndex, chip::MutableCharSpan & label)
+{
+ if (modeIndex >= ArraySize(kModeOptions))
+ {
+ return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
+ }
+ return chip::CopyCharSpanToMutableCharSpan(kModeOptions[modeIndex].label, label);
+}
+
+CHIP_ERROR EnergyEvseModeDelegate::GetModeValueByIndex(uint8_t modeIndex, uint8_t & value)
+{
+ if (modeIndex >= ArraySize(kModeOptions))
+ {
+ return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
+ }
+ value = kModeOptions[modeIndex].mode;
+ return CHIP_NO_ERROR;
+}
+
+CHIP_ERROR EnergyEvseModeDelegate::GetModeTagsByIndex(uint8_t modeIndex, List & tags)
+{
+ if (modeIndex >= ArraySize(kModeOptions))
+ {
+ return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
+ }
+
+ if (tags.size() < kModeOptions[modeIndex].modeTags.size())
+ {
+ return CHIP_ERROR_INVALID_ARGUMENT;
+ }
+
+ std::copy(kModeOptions[modeIndex].modeTags.begin(), kModeOptions[modeIndex].modeTags.end(), tags.begin());
+ tags.reduce_size(kModeOptions[modeIndex].modeTags.size());
+
+ return CHIP_NO_ERROR;
+}
+
+ModeBase::Instance * EnergyEvseMode::Instance()
+{
+ return gEnergyEvseModeInstance.get();
+}
+
+void EnergyEvseMode::Shutdown()
+{
+ gEnergyEvseModeInstance.reset();
+ gEnergyEvseModeDelegate.reset();
+}
+
+void emberAfEnergyEvseModeClusterInitCallback(chip::EndpointId endpointId)
+{
+ VerifyOrDie(!gEnergyEvseModeDelegate && !gEnergyEvseModeInstance);
+ gEnergyEvseModeDelegate = std::make_unique();
+ gEnergyEvseModeInstance = std::make_unique(gEnergyEvseModeDelegate.get(), 0x1, EnergyEvseMode::Id,
+ chip::to_underlying(EnergyEvseMode::Feature::kOnOff));
+ gEnergyEvseModeInstance->Init();
+}
diff --git a/examples/energy-management-app/linux/BUILD.gn b/examples/energy-management-app/linux/BUILD.gn
index 8fb53878129c60..7504d51c242c98 100644
--- a/examples/energy-management-app/linux/BUILD.gn
+++ b/examples/energy-management-app/linux/BUILD.gn
@@ -42,6 +42,8 @@ executable("chip-energy-management-app") {
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp",
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyManagementManager.cpp",
+ "${chip_root}/examples/energy-management-app/energy-management-common/src/device-energy-management-mode.cpp",
+ "${chip_root}/examples/energy-management-app/energy-management-common/src/energy-evse-mode.cpp",
"include/CHIPProjectAppConfig.h",
"main.cpp",
]
diff --git a/examples/energy-management-app/linux/main.cpp b/examples/energy-management-app/linux/main.cpp
index df544484975f4f..61fdec251b7d6d 100644
--- a/examples/energy-management-app/linux/main.cpp
+++ b/examples/energy-management-app/linux/main.cpp
@@ -21,6 +21,8 @@
#include
#include
#include
+#include
+#include
#include
#include
@@ -268,6 +270,9 @@ void ApplicationShutdown()
EVSEManufacturerShutdown(); /* Free the EVSEManufacturer */
EnergyEvseShutdown(); /* Free the EnergyEvse */
DeviceEnergyManagementShutdown(); /* Free the DEM */
+
+ Clusters::DeviceEnergyManagementMode::Shutdown();
+ Clusters::EnergyEvseMode::Shutdown();
}
int main(int argc, char * argv[])
diff --git a/scripts/rules.matterlint b/scripts/rules.matterlint
index e6b386e84704e3..438d62e9bd883c 100644
--- a/scripts/rules.matterlint
+++ b/scripts/rules.matterlint
@@ -25,6 +25,7 @@ load "../src/app/zap-templates/zcl/data-model/chip/content-app-observer-cluster.
load "../src/app/zap-templates/zcl/data-model/chip/content-control-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/descriptor-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/device-energy-management-cluster.xml";
+load "../src/app/zap-templates/zcl/data-model/chip/device-energy-management-mode-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/diagnostic-logs-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/dishwasher-alarm-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/dishwasher-mode-cluster.xml";
@@ -32,6 +33,7 @@ load "../src/app/zap-templates/zcl/data-model/chip/microwave-oven-mode-cluster.x
load "../src/app/zap-templates/zcl/data-model/chip/microwave-oven-control-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/door-lock-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml";
+load "../src/app/zap-templates/zcl/data-model/chip/energy-evse-mode-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/ethernet-network-diagnostics-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/fan-control-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/fixed-label-cluster.xml";
diff --git a/src/app/common/templates/config-data.yaml b/src/app/common/templates/config-data.yaml
index 2ee03c124bb769..26f4356f517f10 100644
--- a/src/app/common/templates/config-data.yaml
+++ b/src/app/common/templates/config-data.yaml
@@ -12,6 +12,8 @@ EnumsNotUsedAsTypeInXML:
- "RvcCleanMode::StatusCode"
- "RvcOperationalState::OperationalStateEnum"
- "RvcOperationalState::ErrorStateEnum"
+ - "EnergyEvseMode::ModeTag"
+ - "DeviceEnergyManagementMode::ModeTag"
CommandHandlerInterfaceOnlyClusters:
# List of clusters that are implemented entirely with
@@ -33,7 +35,9 @@ CommandHandlerInterfaceOnlyClusters:
- Sample MEI
- Microwave Oven Control
- Energy EVSE
+ - Energy EVSE Mode
- Device Energy Management
+ - Device Energy Management Mode
# We need a more configurable way of deciding which clusters have which init functions....
# See https://github.com/project-chip/connectedhomeip/issues/4369
diff --git a/src/app/util/util.cpp b/src/app/util/util.cpp
index 329de98697c376..e66ce70d7cdf9b 100644
--- a/src/app/util/util.cpp
+++ b/src/app/util/util.cpp
@@ -161,6 +161,8 @@ void MatterOvenModePluginServerInitCallback() {}
void MatterOvenCavityOperationalStatePluginServerInitCallback() {}
void MatterDishwasherAlarmPluginServerInitCallback() {}
void MatterMicrowaveOvenModePluginServerInitCallback() {}
+void MatterDeviceEnergyManagementModePluginServerInitCallback() {}
+void MatterEnergyEvseModePluginServerInitCallback() {}
// ****************************************
// Print out information about each cluster
// ****************************************
diff --git a/src/app/zap-templates/zcl/data-model/all.xml b/src/app/zap-templates/zcl/data-model/all.xml
index f2ed0cc9919c03..a17f6b026ed266 100644
--- a/src/app/zap-templates/zcl/data-model/all.xml
+++ b/src/app/zap-templates/zcl/data-model/all.xml
@@ -22,6 +22,7 @@
+
@@ -30,6 +31,7 @@
+
diff --git a/src/app/zap-templates/zcl/data-model/chip/device-energy-management-mode-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/device-energy-management-mode-cluster.xml
new file mode 100644
index 00000000000000..b41555e2fe03cd
--- /dev/null
+++ b/src/app/zap-templates/zcl/data-model/chip/device-energy-management-mode-cluster.xml
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ General
+ Device Energy Management Mode
+ 0x009F
+ DEVICE_ENERGY_MANAGEMENT_MODE_CLUSTER
+ true
+ true
+ Attributes and commands for selecting a mode from a list of supported options.
+
+
+ SupportedModes
+ CurrentMode
+ StartUpMode
+ OnMode
+
+
+
+
+ This command is used to change device modes.
+ On receipt of this command the device SHALL respond with a ChangeToModeResponse command.
+
+
+
+
+
+
+ This command is sent by the device on receipt of the ChangeToModeWithStatus command.
+
+
+
+
+
+
diff --git a/src/app/zap-templates/zcl/data-model/chip/energy-evse-mode-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/energy-evse-mode-cluster.xml
new file mode 100644
index 00000000000000..4418502ae5e389
--- /dev/null
+++ b/src/app/zap-templates/zcl/data-model/chip/energy-evse-mode-cluster.xml
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ General
+ Energy EVSE Mode
+ 0x009D
+ ENERGY_EVSE_MODE_CLUSTER
+ true
+ true
+ Attributes and commands for selecting a mode from a list of supported options.
+
+
+ SupportedModes
+ CurrentMode
+ StartUpMode
+ OnMode
+
+
+
+
+ This command is used to change device modes.
+ On receipt of this command the device SHALL respond with a ChangeToModeResponse command.
+
+
+
+
+
+
+ This command is sent by the device on receipt of the ChangeToModeWithStatus command.
+
+
+
+
+
+
diff --git a/src/app/zap-templates/zcl/data-model/chip/mode-base-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/mode-base-cluster.xml
index 2bf3905b7f34c5..bcf6e2b4e72555 100644
--- a/src/app/zap-templates/zcl/data-model/chip/mode-base-cluster.xml
+++ b/src/app/zap-templates/zcl/data-model/chip/mode-base-cluster.xml
@@ -24,26 +24,30 @@ This is because zap does not currently support generating code for clusters that
-->
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
@@ -84,13 +88,15 @@ This is because zap does not currently support generating code for clusters that
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
diff --git a/src/app/zap-templates/zcl/zcl-with-test-extensions.json b/src/app/zap-templates/zcl/zcl-with-test-extensions.json
index 7cf25d5e4c4795..70e59b08f29231 100644
--- a/src/app/zap-templates/zcl/zcl-with-test-extensions.json
+++ b/src/app/zap-templates/zcl/zcl-with-test-extensions.json
@@ -38,6 +38,7 @@
"content-control-cluster.xml",
"descriptor-cluster.xml",
"device-energy-management-cluster.xml",
+ "device-energy-management-mode-cluster.xml",
"diagnostic-logs-cluster.xml",
"dishwasher-alarm-cluster.xml",
"dishwasher-mode-cluster.xml",
@@ -49,6 +50,7 @@
"electrical-energy-measurement-cluster.xml",
"electrical-measurement-cluster.xml",
"energy-evse-cluster.xml",
+ "energy-evse-mode-cluster.xml",
"ethernet-network-diagnostics-cluster.xml",
"fan-control-cluster.xml",
"fault-injection-cluster.xml",
@@ -189,6 +191,11 @@
"OptOutState",
"FeatureMap"
],
+ "Device Energy Management Mode": [
+ "SupportedModes",
+ "CurrentMode",
+ "FeatureMap"
+ ],
"Energy EVSE": [
"State",
"SupplyState",
@@ -215,6 +222,7 @@
"SessionEnergyDischarged",
"FeatureMap"
],
+ "Energy EVSE Mode": ["SupportedModes", "CurrentMode", "FeatureMap"],
"Ethernet Network Diagnostics": [
"PHYRate",
"FullDuplex",
diff --git a/src/app/zap-templates/zcl/zcl.json b/src/app/zap-templates/zcl/zcl.json
index addb14b89f25ba..fa9f79f79147b0 100644
--- a/src/app/zap-templates/zcl/zcl.json
+++ b/src/app/zap-templates/zcl/zcl.json
@@ -37,6 +37,7 @@
"content-control-cluster.xml",
"descriptor-cluster.xml",
"device-energy-management-cluster.xml",
+ "device-energy-management-mode-cluster.xml",
"diagnostic-logs-cluster.xml",
"dishwasher-alarm-cluster.xml",
"dishwasher-mode-cluster.xml",
@@ -46,6 +47,7 @@
"drlc-cluster.xml",
"electrical-measurement-cluster.xml",
"energy-evse-cluster.xml",
+ "energy-evse-mode-cluster.xml",
"energy-preference-cluster.xml",
"ethernet-network-diagnostics-cluster.xml",
"fan-control-cluster.xml",
@@ -187,6 +189,11 @@
"OptOutState",
"FeatureMap"
],
+ "Device Energy Management Mode": [
+ "SupportedModes",
+ "CurrentMode",
+ "FeatureMap"
+ ],
"Energy EVSE": [
"State",
"SupplyState",
@@ -213,6 +220,7 @@
"SessionEnergyDischarged",
"FeatureMap"
],
+ "Energy EVSE Mode": ["SupportedModes", "CurrentMode", "FeatureMap"],
"Ethernet Network Diagnostics": [
"PHYRate",
"FullDuplex",
diff --git a/src/app/zap_cluster_list.json b/src/app/zap_cluster_list.json
index 4d38466edb17aa..44442c18a486a3 100644
--- a/src/app/zap_cluster_list.json
+++ b/src/app/zap_cluster_list.json
@@ -29,6 +29,7 @@
"CONTENT_APP_OBSERVER_CLUSTER": [],
"DESCRIPTOR_CLUSTER": [],
"DEVICE_ENERGY_MANAGEMENT_CLUSTER": [],
+ "DEVICE_ENERGY_MANAGEMENT_MODE_CLUSTER": [],
"DEVICE_TEMP_CLUSTER": [],
"DIAGNOSTIC_LOGS_CLUSTER": [],
"DISHWASHER_ALARM_CLUSTER": [],
@@ -38,6 +39,7 @@
"ELECTRICAL_ENERGY_MEASUREMENT_CLUSTER": [],
"ELECTRICAL_MEASUREMENT_CLUSTER": [],
"ENERGY_EVSE_CLUSTER": [],
+ "ENERGY_EVSE_MODE_CLUSTER": [],
"ETHERNET_NETWORK_DIAGNOSTICS_CLUSTER": [],
"ENERGY_PREFERENCE_CLUSTER": [],
"FAN_CONTROL_CLUSTER": [],
@@ -168,6 +170,7 @@
"CONTENT_APP_OBSERVER_CLUSTER": ["content-app-observer"],
"DESCRIPTOR_CLUSTER": ["descriptor"],
"DEVICE_ENERGY_MANAGEMENT_CLUSTER": ["device-energy-management-server"],
+ "DEVICE_ENERGY_MANAGEMENT_MODE_CLUSTER": ["mode-base-server"],
"DEVICE_TEMP_CLUSTER": [],
"DIAGNOSTIC_LOGS_CLUSTER": ["diagnostic-logs-server"],
"DISHWASHER_ALARM_CLUSTER": ["dishwasher-alarm-server"],
@@ -179,6 +182,7 @@
],
"ELECTRICAL_MEASUREMENT_CLUSTER": [],
"ENERGY_EVSE_CLUSTER": ["energy-evse-server"],
+ "ENERGY_EVSE_MODE_CLUSTER": ["mode-base-server"],
"ETHERNET_NETWORK_DIAGNOSTICS_CLUSTER": [
"ethernet-network-diagnostics-server"
],
diff --git a/src/controller/data_model/BUILD.gn b/src/controller/data_model/BUILD.gn
index b073e456b4c975..8b55ecd991bb31 100644
--- a/src/controller/data_model/BUILD.gn
+++ b/src/controller/data_model/BUILD.gn
@@ -124,10 +124,14 @@ if (current_os == "android" || matter_enable_java_compilation) {
"jni/ElectricalMeasurementClient-ReadImpl.cpp",
"jni/DeviceEnergyManagementClient-InvokeSubscribeImpl.cpp",
"jni/DeviceEnergyManagementClient-ReadImpl.cpp",
+ "jni/DeviceEnergyManagementModeClient-InvokeSubscribeImpl.cpp",
+ "jni/DeviceEnergyManagementModeClient-ReadImpl.cpp",
"jni/EthernetNetworkDiagnosticsClient-InvokeSubscribeImpl.cpp",
"jni/EthernetNetworkDiagnosticsClient-ReadImpl.cpp",
"jni/EnergyEvseClient-InvokeSubscribeImpl.cpp",
"jni/EnergyEvseClient-ReadImpl.cpp",
+ "jni/EnergyEvseModeClient-InvokeSubscribeImpl.cpp",
+ "jni/EnergyEvseModeClient-ReadImpl.cpp",
"jni/FanControlClient-InvokeSubscribeImpl.cpp",
"jni/FanControlClient-ReadImpl.cpp",
"jni/FaultInjectionClient-InvokeSubscribeImpl.cpp",
diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter
index 7548fe605424c3..57f13ac5d61d71 100644
--- a/src/controller/data_model/controller-clusters.matter
+++ b/src/controller/data_model/controller-clusters.matter
@@ -4841,6 +4841,107 @@ cluster EnergyPreference = 155 {
readonly attribute int16u clusterRevision = 65533;
}
+/** Attributes and commands for selecting a mode from a list of supported options. */
+provisional cluster EnergyEvseMode = 157 {
+ revision 1;
+
+ enum ModeTag : enum16 {
+ kManual = 16384;
+ kTimeOfUse = 16385;
+ kSolarCharging = 16386;
+ }
+
+ bitmap Feature : bitmap32 {
+ kOnOff = 0x1;
+ }
+
+ struct ModeTagStruct {
+ optional vendor_id mfgCode = 0;
+ enum16 value = 1;
+ }
+
+ struct ModeOptionStruct {
+ char_string<64> label = 0;
+ int8u mode = 1;
+ ModeTagStruct modeTags[] = 2;
+ }
+
+ readonly attribute ModeOptionStruct supportedModes[] = 0;
+ readonly attribute int8u currentMode = 1;
+ attribute optional nullable int8u startUpMode = 2;
+ attribute optional nullable int8u onMode = 3;
+ readonly attribute command_id generatedCommandList[] = 65528;
+ readonly attribute command_id acceptedCommandList[] = 65529;
+ readonly attribute event_id eventList[] = 65530;
+ readonly attribute attrib_id attributeList[] = 65531;
+ readonly attribute bitmap32 featureMap = 65532;
+ readonly attribute int16u clusterRevision = 65533;
+
+ request struct ChangeToModeRequest {
+ int8u newMode = 0;
+ }
+
+ response struct ChangeToModeResponse = 1 {
+ enum8 status = 0;
+ optional char_string<64> statusText = 1;
+ }
+
+ /** This command is used to change device modes.
+ On receipt of this command the device SHALL respond with a ChangeToModeResponse command. */
+ command ChangeToMode(ChangeToModeRequest): ChangeToModeResponse = 0;
+}
+
+/** Attributes and commands for selecting a mode from a list of supported options. */
+provisional cluster DeviceEnergyManagementMode = 159 {
+ revision 1;
+
+ enum ModeTag : enum16 {
+ kNoOptimization = 16384;
+ kDeviceOptimization = 16385;
+ kLocalOptimization = 16386;
+ kGridOptimization = 16387;
+ }
+
+ bitmap Feature : bitmap32 {
+ kOnOff = 0x1;
+ }
+
+ struct ModeTagStruct {
+ optional vendor_id mfgCode = 0;
+ enum16 value = 1;
+ }
+
+ struct ModeOptionStruct {
+ char_string<64> label = 0;
+ int8u mode = 1;
+ ModeTagStruct modeTags[] = 2;
+ }
+
+ readonly attribute ModeOptionStruct supportedModes[] = 0;
+ readonly attribute int8u currentMode = 1;
+ attribute optional nullable int8u startUpMode = 2;
+ attribute optional nullable int8u onMode = 3;
+ readonly attribute command_id generatedCommandList[] = 65528;
+ readonly attribute command_id acceptedCommandList[] = 65529;
+ readonly attribute event_id eventList[] = 65530;
+ readonly attribute attrib_id attributeList[] = 65531;
+ readonly attribute bitmap32 featureMap = 65532;
+ readonly attribute int16u clusterRevision = 65533;
+
+ request struct ChangeToModeRequest {
+ int8u newMode = 0;
+ }
+
+ response struct ChangeToModeResponse = 1 {
+ enum8 status = 0;
+ optional char_string<64> statusText = 1;
+ }
+
+ /** This command is used to change device modes.
+ On receipt of this command the device SHALL respond with a ChangeToModeResponse command. */
+ command ChangeToMode(ChangeToModeRequest): ChangeToModeResponse = 0;
+}
+
/** An interface to a generic way to secure a door */
cluster DoorLock = 257 {
revision 7;
diff --git a/src/controller/data_model/controller-clusters.zap b/src/controller/data_model/controller-clusters.zap
index 9622285bc30844..c9de3724e3c4ff 100644
--- a/src/controller/data_model/controller-clusters.zap
+++ b/src/controller/data_model/controller-clusters.zap
@@ -3228,6 +3228,128 @@
}
]
},
+ {
+ "name": "Energy EVSE Mode",
+ "code": 157,
+ "mfgCode": null,
+ "define": "ENERGY_EVSE_MODE_CLUSTER",
+ "side": "client",
+ "enabled": 1,
+ "apiMaturity": "provisional",
+ "commands": [
+ {
+ "name": "ChangeToMode",
+ "code": 0,
+ "mfgCode": null,
+ "source": "client",
+ "isIncoming": 0,
+ "isEnabled": 1
+ },
+ {
+ "name": "ChangeToModeResponse",
+ "code": 1,
+ "mfgCode": null,
+ "source": "server",
+ "isIncoming": 1,
+ "isEnabled": 1
+ }
+ ],
+ "attributes": [
+ {
+ "name": "FeatureMap",
+ "code": 65532,
+ "mfgCode": null,
+ "side": "client",
+ "type": "bitmap32",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": "0",
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "ClusterRevision",
+ "code": 65533,
+ "mfgCode": null,
+ "side": "client",
+ "type": "int16u",
+ "included": 1,
+ "storageOption": "RAM",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": "1",
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ }
+ ]
+ },
+ {
+ "name": "Device Energy Management Mode",
+ "code": 159,
+ "mfgCode": null,
+ "define": "DEVICE_ENERGY_MANAGEMENT_MODE_CLUSTER",
+ "side": "client",
+ "enabled": 1,
+ "apiMaturity": "provisional",
+ "commands": [
+ {
+ "name": "ChangeToMode",
+ "code": 0,
+ "mfgCode": null,
+ "source": "client",
+ "isIncoming": 0,
+ "isEnabled": 1
+ },
+ {
+ "name": "ChangeToModeResponse",
+ "code": 1,
+ "mfgCode": null,
+ "source": "server",
+ "isIncoming": 1,
+ "isEnabled": 1
+ }
+ ],
+ "attributes": [
+ {
+ "name": "FeatureMap",
+ "code": 65532,
+ "mfgCode": null,
+ "side": "client",
+ "type": "bitmap32",
+ "included": 1,
+ "storageOption": "External",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": "0",
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ },
+ {
+ "name": "ClusterRevision",
+ "code": 65533,
+ "mfgCode": null,
+ "side": "client",
+ "type": "int16u",
+ "included": 1,
+ "storageOption": "RAM",
+ "singleton": 0,
+ "bounded": 0,
+ "defaultValue": "1",
+ "reportable": 1,
+ "minInterval": 1,
+ "maxInterval": 65534,
+ "reportableChange": 0
+ }
+ ]
+ },
{
"name": "Door Lock",
"code": 257,
@@ -5500,5 +5622,6 @@
"endpointId": 1,
"networkId": 0
}
- ]
+ ],
+ "log": []
}
\ No newline at end of file
diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java
index 1e3f65f09fec06..2d4c452df3cf45 100644
--- a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java
+++ b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java
@@ -31380,6 +31380,730 @@ public void onSuccess(byte[] tlv) {
}
}
+ public static class EnergyEvseModeCluster extends BaseChipCluster {
+ public static final long CLUSTER_ID = 157L;
+
+ private static final long SUPPORTED_MODES_ATTRIBUTE_ID = 0L;
+ private static final long CURRENT_MODE_ATTRIBUTE_ID = 1L;
+ private static final long START_UP_MODE_ATTRIBUTE_ID = 2L;
+ private static final long ON_MODE_ATTRIBUTE_ID = 3L;
+ private static final long GENERATED_COMMAND_LIST_ATTRIBUTE_ID = 65528L;
+ private static final long ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID = 65529L;
+ private static final long EVENT_LIST_ATTRIBUTE_ID = 65530L;
+ private static final long ATTRIBUTE_LIST_ATTRIBUTE_ID = 65531L;
+ private static final long FEATURE_MAP_ATTRIBUTE_ID = 65532L;
+ private static final long CLUSTER_REVISION_ATTRIBUTE_ID = 65533L;
+
+ public EnergyEvseModeCluster(long devicePtr, int endpointId) {
+ super(devicePtr, endpointId, CLUSTER_ID);
+ }
+
+ @Override
+ @Deprecated
+ public long initWithDevice(long devicePtr, int endpointId) {
+ return 0L;
+ }
+
+ public void changeToMode(ChangeToModeResponseCallback callback, Integer newMode) {
+ changeToMode(callback, newMode, 0);
+ }
+
+ public void changeToMode(ChangeToModeResponseCallback callback, Integer newMode, int timedInvokeTimeoutMs) {
+ final long commandId = 0L;
+
+ ArrayList elements = new ArrayList<>();
+ final long newModeFieldID = 0L;
+ BaseTLVType newModetlvValue = new UIntType(newMode);
+ elements.add(new StructElement(newModeFieldID, newModetlvValue));
+
+ StructType value = new StructType(elements);
+ invoke(new InvokeCallbackImpl(callback) {
+ @Override
+ public void onResponse(StructType invokeStructValue) {
+ final long statusFieldID = 0L;
+ Integer status = null;
+ final long statusTextFieldID = 1L;
+ Optional statusText = Optional.empty();
+ for (StructElement element: invokeStructValue.value()) {
+ if (element.contextTagNum() == statusFieldID) {
+ if (element.value(BaseTLVType.class).type() == TLVType.UInt) {
+ UIntType castingValue = element.value(UIntType.class);
+ status = castingValue.value(Integer.class);
+ }
+ } else if (element.contextTagNum() == statusTextFieldID) {
+ if (element.value(BaseTLVType.class).type() == TLVType.String) {
+ StringType castingValue = element.value(StringType.class);
+ statusText = Optional.of(castingValue.value(String.class));
+ }
+ }
+ }
+ callback.onSuccess(status, statusText);
+ }}, commandId, value, timedInvokeTimeoutMs);
+ }
+
+ public interface ChangeToModeResponseCallback extends BaseClusterCallback {
+ void onSuccess(Integer status, Optional statusText);
+ }
+
+ public interface SupportedModesAttributeCallback extends BaseAttributeCallback {
+ void onSuccess(List value);
+ }
+
+ public interface StartUpModeAttributeCallback extends BaseAttributeCallback {
+ void onSuccess(@Nullable Integer value);
+ }
+
+ public interface OnModeAttributeCallback extends BaseAttributeCallback {
+ void onSuccess(@Nullable Integer value);
+ }
+
+ public interface GeneratedCommandListAttributeCallback extends BaseAttributeCallback {
+ void onSuccess(List value);
+ }
+
+ public interface AcceptedCommandListAttributeCallback extends BaseAttributeCallback {
+ void onSuccess(List value);
+ }
+
+ public interface EventListAttributeCallback extends BaseAttributeCallback {
+ void onSuccess(List value);
+ }
+
+ public interface AttributeListAttributeCallback extends BaseAttributeCallback {
+ void onSuccess(List value);
+ }
+
+ public void readSupportedModesAttribute(
+ SupportedModesAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SUPPORTED_MODES_ATTRIBUTE_ID);
+
+ readAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, SUPPORTED_MODES_ATTRIBUTE_ID, true);
+ }
+
+ public void subscribeSupportedModesAttribute(
+ SupportedModesAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SUPPORTED_MODES_ATTRIBUTE_ID);
+
+ subscribeAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ }
+ }, SUPPORTED_MODES_ATTRIBUTE_ID, minInterval, maxInterval);
+ }
+
+ public void readCurrentModeAttribute(
+ IntegerAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CURRENT_MODE_ATTRIBUTE_ID);
+
+ readAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, CURRENT_MODE_ATTRIBUTE_ID, true);
+ }
+
+ public void subscribeCurrentModeAttribute(
+ IntegerAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CURRENT_MODE_ATTRIBUTE_ID);
+
+ subscribeAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ }
+ }, CURRENT_MODE_ATTRIBUTE_ID, minInterval, maxInterval);
+ }
+
+ public void readStartUpModeAttribute(
+ StartUpModeAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, START_UP_MODE_ATTRIBUTE_ID);
+
+ readAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, START_UP_MODE_ATTRIBUTE_ID, true);
+ }
+
+ public void writeStartUpModeAttribute(DefaultClusterCallback callback, Integer value) {
+ writeStartUpModeAttribute(callback, value, 0);
+ }
+
+ public void writeStartUpModeAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) {
+ BaseTLVType tlvValue = value != null ? new UIntType(value) : new NullType();
+ writeAttribute(new WriteAttributesCallbackImpl(callback), START_UP_MODE_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs);
+ }
+
+ public void subscribeStartUpModeAttribute(
+ StartUpModeAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, START_UP_MODE_ATTRIBUTE_ID);
+
+ subscribeAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ }
+ }, START_UP_MODE_ATTRIBUTE_ID, minInterval, maxInterval);
+ }
+
+ public void readOnModeAttribute(
+ OnModeAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ON_MODE_ATTRIBUTE_ID);
+
+ readAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, ON_MODE_ATTRIBUTE_ID, true);
+ }
+
+ public void writeOnModeAttribute(DefaultClusterCallback callback, Integer value) {
+ writeOnModeAttribute(callback, value, 0);
+ }
+
+ public void writeOnModeAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) {
+ BaseTLVType tlvValue = value != null ? new UIntType(value) : new NullType();
+ writeAttribute(new WriteAttributesCallbackImpl(callback), ON_MODE_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs);
+ }
+
+ public void subscribeOnModeAttribute(
+ OnModeAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ON_MODE_ATTRIBUTE_ID);
+
+ subscribeAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ }
+ }, ON_MODE_ATTRIBUTE_ID, minInterval, maxInterval);
+ }
+
+ public void readGeneratedCommandListAttribute(
+ GeneratedCommandListAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GENERATED_COMMAND_LIST_ATTRIBUTE_ID);
+
+ readAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, true);
+ }
+
+ public void subscribeGeneratedCommandListAttribute(
+ GeneratedCommandListAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GENERATED_COMMAND_LIST_ATTRIBUTE_ID);
+
+ subscribeAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ }
+ }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval);
+ }
+
+ public void readAcceptedCommandListAttribute(
+ AcceptedCommandListAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID);
+
+ readAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, true);
+ }
+
+ public void subscribeAcceptedCommandListAttribute(
+ AcceptedCommandListAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID);
+
+ subscribeAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ }
+ }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval);
+ }
+
+ public void readEventListAttribute(
+ EventListAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, EVENT_LIST_ATTRIBUTE_ID);
+
+ readAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, EVENT_LIST_ATTRIBUTE_ID, true);
+ }
+
+ public void subscribeEventListAttribute(
+ EventListAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, EVENT_LIST_ATTRIBUTE_ID);
+
+ subscribeAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ }
+ }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval);
+ }
+
+ public void readAttributeListAttribute(
+ AttributeListAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ATTRIBUTE_LIST_ATTRIBUTE_ID);
+
+ readAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, ATTRIBUTE_LIST_ATTRIBUTE_ID, true);
+ }
+
+ public void subscribeAttributeListAttribute(
+ AttributeListAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ATTRIBUTE_LIST_ATTRIBUTE_ID);
+
+ subscribeAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ }
+ }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval);
+ }
+
+ public void readFeatureMapAttribute(
+ LongAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, FEATURE_MAP_ATTRIBUTE_ID);
+
+ readAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, FEATURE_MAP_ATTRIBUTE_ID, true);
+ }
+
+ public void subscribeFeatureMapAttribute(
+ LongAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, FEATURE_MAP_ATTRIBUTE_ID);
+
+ subscribeAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ }
+ }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval);
+ }
+
+ public void readClusterRevisionAttribute(
+ IntegerAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CLUSTER_REVISION_ATTRIBUTE_ID);
+
+ readAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, CLUSTER_REVISION_ATTRIBUTE_ID, true);
+ }
+
+ public void subscribeClusterRevisionAttribute(
+ IntegerAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CLUSTER_REVISION_ATTRIBUTE_ID);
+
+ subscribeAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ }
+ }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval);
+ }
+ }
+
+ public static class DeviceEnergyManagementModeCluster extends BaseChipCluster {
+ public static final long CLUSTER_ID = 159L;
+
+ private static final long SUPPORTED_MODES_ATTRIBUTE_ID = 0L;
+ private static final long CURRENT_MODE_ATTRIBUTE_ID = 1L;
+ private static final long START_UP_MODE_ATTRIBUTE_ID = 2L;
+ private static final long ON_MODE_ATTRIBUTE_ID = 3L;
+ private static final long GENERATED_COMMAND_LIST_ATTRIBUTE_ID = 65528L;
+ private static final long ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID = 65529L;
+ private static final long EVENT_LIST_ATTRIBUTE_ID = 65530L;
+ private static final long ATTRIBUTE_LIST_ATTRIBUTE_ID = 65531L;
+ private static final long FEATURE_MAP_ATTRIBUTE_ID = 65532L;
+ private static final long CLUSTER_REVISION_ATTRIBUTE_ID = 65533L;
+
+ public DeviceEnergyManagementModeCluster(long devicePtr, int endpointId) {
+ super(devicePtr, endpointId, CLUSTER_ID);
+ }
+
+ @Override
+ @Deprecated
+ public long initWithDevice(long devicePtr, int endpointId) {
+ return 0L;
+ }
+
+ public void changeToMode(ChangeToModeResponseCallback callback, Integer newMode) {
+ changeToMode(callback, newMode, 0);
+ }
+
+ public void changeToMode(ChangeToModeResponseCallback callback, Integer newMode, int timedInvokeTimeoutMs) {
+ final long commandId = 0L;
+
+ ArrayList elements = new ArrayList<>();
+ final long newModeFieldID = 0L;
+ BaseTLVType newModetlvValue = new UIntType(newMode);
+ elements.add(new StructElement(newModeFieldID, newModetlvValue));
+
+ StructType value = new StructType(elements);
+ invoke(new InvokeCallbackImpl(callback) {
+ @Override
+ public void onResponse(StructType invokeStructValue) {
+ final long statusFieldID = 0L;
+ Integer status = null;
+ final long statusTextFieldID = 1L;
+ Optional statusText = Optional.empty();
+ for (StructElement element: invokeStructValue.value()) {
+ if (element.contextTagNum() == statusFieldID) {
+ if (element.value(BaseTLVType.class).type() == TLVType.UInt) {
+ UIntType castingValue = element.value(UIntType.class);
+ status = castingValue.value(Integer.class);
+ }
+ } else if (element.contextTagNum() == statusTextFieldID) {
+ if (element.value(BaseTLVType.class).type() == TLVType.String) {
+ StringType castingValue = element.value(StringType.class);
+ statusText = Optional.of(castingValue.value(String.class));
+ }
+ }
+ }
+ callback.onSuccess(status, statusText);
+ }}, commandId, value, timedInvokeTimeoutMs);
+ }
+
+ public interface ChangeToModeResponseCallback extends BaseClusterCallback {
+ void onSuccess(Integer status, Optional statusText);
+ }
+
+ public interface SupportedModesAttributeCallback extends BaseAttributeCallback {
+ void onSuccess(List value);
+ }
+
+ public interface StartUpModeAttributeCallback extends BaseAttributeCallback {
+ void onSuccess(@Nullable Integer value);
+ }
+
+ public interface OnModeAttributeCallback extends BaseAttributeCallback {
+ void onSuccess(@Nullable Integer value);
+ }
+
+ public interface GeneratedCommandListAttributeCallback extends BaseAttributeCallback {
+ void onSuccess(List value);
+ }
+
+ public interface AcceptedCommandListAttributeCallback extends BaseAttributeCallback {
+ void onSuccess(List value);
+ }
+
+ public interface EventListAttributeCallback extends BaseAttributeCallback {
+ void onSuccess(List value);
+ }
+
+ public interface AttributeListAttributeCallback extends BaseAttributeCallback {
+ void onSuccess(List value);
+ }
+
+ public void readSupportedModesAttribute(
+ SupportedModesAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SUPPORTED_MODES_ATTRIBUTE_ID);
+
+ readAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, SUPPORTED_MODES_ATTRIBUTE_ID, true);
+ }
+
+ public void subscribeSupportedModesAttribute(
+ SupportedModesAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SUPPORTED_MODES_ATTRIBUTE_ID);
+
+ subscribeAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ }
+ }, SUPPORTED_MODES_ATTRIBUTE_ID, minInterval, maxInterval);
+ }
+
+ public void readCurrentModeAttribute(
+ IntegerAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CURRENT_MODE_ATTRIBUTE_ID);
+
+ readAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, CURRENT_MODE_ATTRIBUTE_ID, true);
+ }
+
+ public void subscribeCurrentModeAttribute(
+ IntegerAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CURRENT_MODE_ATTRIBUTE_ID);
+
+ subscribeAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ }
+ }, CURRENT_MODE_ATTRIBUTE_ID, minInterval, maxInterval);
+ }
+
+ public void readStartUpModeAttribute(
+ StartUpModeAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, START_UP_MODE_ATTRIBUTE_ID);
+
+ readAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, START_UP_MODE_ATTRIBUTE_ID, true);
+ }
+
+ public void writeStartUpModeAttribute(DefaultClusterCallback callback, Integer value) {
+ writeStartUpModeAttribute(callback, value, 0);
+ }
+
+ public void writeStartUpModeAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) {
+ BaseTLVType tlvValue = value != null ? new UIntType(value) : new NullType();
+ writeAttribute(new WriteAttributesCallbackImpl(callback), START_UP_MODE_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs);
+ }
+
+ public void subscribeStartUpModeAttribute(
+ StartUpModeAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, START_UP_MODE_ATTRIBUTE_ID);
+
+ subscribeAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ }
+ }, START_UP_MODE_ATTRIBUTE_ID, minInterval, maxInterval);
+ }
+
+ public void readOnModeAttribute(
+ OnModeAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ON_MODE_ATTRIBUTE_ID);
+
+ readAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, ON_MODE_ATTRIBUTE_ID, true);
+ }
+
+ public void writeOnModeAttribute(DefaultClusterCallback callback, Integer value) {
+ writeOnModeAttribute(callback, value, 0);
+ }
+
+ public void writeOnModeAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) {
+ BaseTLVType tlvValue = value != null ? new UIntType(value) : new NullType();
+ writeAttribute(new WriteAttributesCallbackImpl(callback), ON_MODE_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs);
+ }
+
+ public void subscribeOnModeAttribute(
+ OnModeAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ON_MODE_ATTRIBUTE_ID);
+
+ subscribeAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ }
+ }, ON_MODE_ATTRIBUTE_ID, minInterval, maxInterval);
+ }
+
+ public void readGeneratedCommandListAttribute(
+ GeneratedCommandListAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GENERATED_COMMAND_LIST_ATTRIBUTE_ID);
+
+ readAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, true);
+ }
+
+ public void subscribeGeneratedCommandListAttribute(
+ GeneratedCommandListAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GENERATED_COMMAND_LIST_ATTRIBUTE_ID);
+
+ subscribeAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ }
+ }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval);
+ }
+
+ public void readAcceptedCommandListAttribute(
+ AcceptedCommandListAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID);
+
+ readAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, true);
+ }
+
+ public void subscribeAcceptedCommandListAttribute(
+ AcceptedCommandListAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID);
+
+ subscribeAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ }
+ }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval);
+ }
+
+ public void readEventListAttribute(
+ EventListAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, EVENT_LIST_ATTRIBUTE_ID);
+
+ readAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, EVENT_LIST_ATTRIBUTE_ID, true);
+ }
+
+ public void subscribeEventListAttribute(
+ EventListAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, EVENT_LIST_ATTRIBUTE_ID);
+
+ subscribeAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ }
+ }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval);
+ }
+
+ public void readAttributeListAttribute(
+ AttributeListAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ATTRIBUTE_LIST_ATTRIBUTE_ID);
+
+ readAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, ATTRIBUTE_LIST_ATTRIBUTE_ID, true);
+ }
+
+ public void subscribeAttributeListAttribute(
+ AttributeListAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ATTRIBUTE_LIST_ATTRIBUTE_ID);
+
+ subscribeAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ }
+ }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval);
+ }
+
+ public void readFeatureMapAttribute(
+ LongAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, FEATURE_MAP_ATTRIBUTE_ID);
+
+ readAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, FEATURE_MAP_ATTRIBUTE_ID, true);
+ }
+
+ public void subscribeFeatureMapAttribute(
+ LongAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, FEATURE_MAP_ATTRIBUTE_ID);
+
+ subscribeAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ }
+ }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval);
+ }
+
+ public void readClusterRevisionAttribute(
+ IntegerAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CLUSTER_REVISION_ATTRIBUTE_ID);
+
+ readAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, CLUSTER_REVISION_ATTRIBUTE_ID, true);
+ }
+
+ public void subscribeClusterRevisionAttribute(
+ IntegerAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CLUSTER_REVISION_ATTRIBUTE_ID);
+
+ subscribeAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ }
+ }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval);
+ }
+ }
+
public static class DoorLockCluster extends BaseChipCluster {
public static final long CLUSTER_ID = 257L;
diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java
index 6aa20f9a2f796c..3dc2b0b9904ef8 100644
--- a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java
+++ b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java
@@ -7488,6 +7488,280 @@ public String toString() {
return output.toString();
}
}
+public static class EnergyEvseModeClusterModeTagStruct {
+ public Optional mfgCode;
+ public Integer value;
+ private static final long MFG_CODE_ID = 0L;
+ private static final long VALUE_ID = 1L;
+
+ public EnergyEvseModeClusterModeTagStruct(
+ Optional mfgCode,
+ Integer value
+ ) {
+ this.mfgCode = mfgCode;
+ this.value = value;
+ }
+
+ public StructType encodeTlv() {
+ ArrayList values = new ArrayList<>();
+ values.add(new StructElement(MFG_CODE_ID, mfgCode.map((nonOptionalmfgCode) -> new UIntType(nonOptionalmfgCode)).orElse(new EmptyType())));
+ values.add(new StructElement(VALUE_ID, new UIntType(value)));
+
+ return new StructType(values);
+ }
+
+ public static EnergyEvseModeClusterModeTagStruct decodeTlv(BaseTLVType tlvValue) {
+ if (tlvValue == null || tlvValue.type() != TLVType.Struct) {
+ return null;
+ }
+ Optional mfgCode = Optional.empty();
+ Integer value = null;
+ for (StructElement element: ((StructType)tlvValue).value()) {
+ if (element.contextTagNum() == MFG_CODE_ID) {
+ if (element.value(BaseTLVType.class).type() == TLVType.UInt) {
+ UIntType castingValue = element.value(UIntType.class);
+ mfgCode = Optional.of(castingValue.value(Integer.class));
+ }
+ } else if (element.contextTagNum() == VALUE_ID) {
+ if (element.value(BaseTLVType.class).type() == TLVType.UInt) {
+ UIntType castingValue = element.value(UIntType.class);
+ value = castingValue.value(Integer.class);
+ }
+ }
+ }
+ return new EnergyEvseModeClusterModeTagStruct(
+ mfgCode,
+ value
+ );
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder output = new StringBuilder();
+ output.append("EnergyEvseModeClusterModeTagStruct {\n");
+ output.append("\tmfgCode: ");
+ output.append(mfgCode);
+ output.append("\n");
+ output.append("\tvalue: ");
+ output.append(value);
+ output.append("\n");
+ output.append("}\n");
+ return output.toString();
+ }
+}
+public static class EnergyEvseModeClusterModeOptionStruct {
+ public String label;
+ public Integer mode;
+ public ArrayList modeTags;
+ private static final long LABEL_ID = 0L;
+ private static final long MODE_ID = 1L;
+ private static final long MODE_TAGS_ID = 2L;
+
+ public EnergyEvseModeClusterModeOptionStruct(
+ String label,
+ Integer mode,
+ ArrayList modeTags
+ ) {
+ this.label = label;
+ this.mode = mode;
+ this.modeTags = modeTags;
+ }
+
+ public StructType encodeTlv() {
+ ArrayList values = new ArrayList<>();
+ values.add(new StructElement(LABEL_ID, new StringType(label)));
+ values.add(new StructElement(MODE_ID, new UIntType(mode)));
+ values.add(new StructElement(MODE_TAGS_ID, ArrayType.generateArrayType(modeTags, (elementmodeTags) -> elementmodeTags.encodeTlv())));
+
+ return new StructType(values);
+ }
+
+ public static EnergyEvseModeClusterModeOptionStruct decodeTlv(BaseTLVType tlvValue) {
+ if (tlvValue == null || tlvValue.type() != TLVType.Struct) {
+ return null;
+ }
+ String label = null;
+ Integer mode = null;
+ ArrayList modeTags = null;
+ for (StructElement element: ((StructType)tlvValue).value()) {
+ if (element.contextTagNum() == LABEL_ID) {
+ if (element.value(BaseTLVType.class).type() == TLVType.String) {
+ StringType castingValue = element.value(StringType.class);
+ label = castingValue.value(String.class);
+ }
+ } else if (element.contextTagNum() == MODE_ID) {
+ if (element.value(BaseTLVType.class).type() == TLVType.UInt) {
+ UIntType castingValue = element.value(UIntType.class);
+ mode = castingValue.value(Integer.class);
+ }
+ } else if (element.contextTagNum() == MODE_TAGS_ID) {
+ if (element.value(BaseTLVType.class).type() == TLVType.Array) {
+ ArrayType castingValue = element.value(ArrayType.class);
+ modeTags = castingValue.map((elementcastingValue) -> ChipStructs.EnergyEvseModeClusterModeTagStruct.decodeTlv(elementcastingValue));
+ }
+ }
+ }
+ return new EnergyEvseModeClusterModeOptionStruct(
+ label,
+ mode,
+ modeTags
+ );
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder output = new StringBuilder();
+ output.append("EnergyEvseModeClusterModeOptionStruct {\n");
+ output.append("\tlabel: ");
+ output.append(label);
+ output.append("\n");
+ output.append("\tmode: ");
+ output.append(mode);
+ output.append("\n");
+ output.append("\tmodeTags: ");
+ output.append(modeTags);
+ output.append("\n");
+ output.append("}\n");
+ return output.toString();
+ }
+}
+public static class DeviceEnergyManagementModeClusterModeTagStruct {
+ public Optional mfgCode;
+ public Integer value;
+ private static final long MFG_CODE_ID = 0L;
+ private static final long VALUE_ID = 1L;
+
+ public DeviceEnergyManagementModeClusterModeTagStruct(
+ Optional mfgCode,
+ Integer value
+ ) {
+ this.mfgCode = mfgCode;
+ this.value = value;
+ }
+
+ public StructType encodeTlv() {
+ ArrayList values = new ArrayList<>();
+ values.add(new StructElement(MFG_CODE_ID, mfgCode.map((nonOptionalmfgCode) -> new UIntType(nonOptionalmfgCode)).orElse(new EmptyType())));
+ values.add(new StructElement(VALUE_ID, new UIntType(value)));
+
+ return new StructType(values);
+ }
+
+ public static DeviceEnergyManagementModeClusterModeTagStruct decodeTlv(BaseTLVType tlvValue) {
+ if (tlvValue == null || tlvValue.type() != TLVType.Struct) {
+ return null;
+ }
+ Optional mfgCode = Optional.empty();
+ Integer value = null;
+ for (StructElement element: ((StructType)tlvValue).value()) {
+ if (element.contextTagNum() == MFG_CODE_ID) {
+ if (element.value(BaseTLVType.class).type() == TLVType.UInt) {
+ UIntType castingValue = element.value(UIntType.class);
+ mfgCode = Optional.of(castingValue.value(Integer.class));
+ }
+ } else if (element.contextTagNum() == VALUE_ID) {
+ if (element.value(BaseTLVType.class).type() == TLVType.UInt) {
+ UIntType castingValue = element.value(UIntType.class);
+ value = castingValue.value(Integer.class);
+ }
+ }
+ }
+ return new DeviceEnergyManagementModeClusterModeTagStruct(
+ mfgCode,
+ value
+ );
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder output = new StringBuilder();
+ output.append("DeviceEnergyManagementModeClusterModeTagStruct {\n");
+ output.append("\tmfgCode: ");
+ output.append(mfgCode);
+ output.append("\n");
+ output.append("\tvalue: ");
+ output.append(value);
+ output.append("\n");
+ output.append("}\n");
+ return output.toString();
+ }
+}
+public static class DeviceEnergyManagementModeClusterModeOptionStruct {
+ public String label;
+ public Integer mode;
+ public ArrayList modeTags;
+ private static final long LABEL_ID = 0L;
+ private static final long MODE_ID = 1L;
+ private static final long MODE_TAGS_ID = 2L;
+
+ public DeviceEnergyManagementModeClusterModeOptionStruct(
+ String label,
+ Integer mode,
+ ArrayList modeTags
+ ) {
+ this.label = label;
+ this.mode = mode;
+ this.modeTags = modeTags;
+ }
+
+ public StructType encodeTlv() {
+ ArrayList values = new ArrayList<>();
+ values.add(new StructElement(LABEL_ID, new StringType(label)));
+ values.add(new StructElement(MODE_ID, new UIntType(mode)));
+ values.add(new StructElement(MODE_TAGS_ID, ArrayType.generateArrayType(modeTags, (elementmodeTags) -> elementmodeTags.encodeTlv())));
+
+ return new StructType(values);
+ }
+
+ public static DeviceEnergyManagementModeClusterModeOptionStruct decodeTlv(BaseTLVType tlvValue) {
+ if (tlvValue == null || tlvValue.type() != TLVType.Struct) {
+ return null;
+ }
+ String label = null;
+ Integer mode = null;
+ ArrayList modeTags = null;
+ for (StructElement element: ((StructType)tlvValue).value()) {
+ if (element.contextTagNum() == LABEL_ID) {
+ if (element.value(BaseTLVType.class).type() == TLVType.String) {
+ StringType castingValue = element.value(StringType.class);
+ label = castingValue.value(String.class);
+ }
+ } else if (element.contextTagNum() == MODE_ID) {
+ if (element.value(BaseTLVType.class).type() == TLVType.UInt) {
+ UIntType castingValue = element.value(UIntType.class);
+ mode = castingValue.value(Integer.class);
+ }
+ } else if (element.contextTagNum() == MODE_TAGS_ID) {
+ if (element.value(BaseTLVType.class).type() == TLVType.Array) {
+ ArrayType castingValue = element.value(ArrayType.class);
+ modeTags = castingValue.map((elementcastingValue) -> ChipStructs.DeviceEnergyManagementModeClusterModeTagStruct.decodeTlv(elementcastingValue));
+ }
+ }
+ }
+ return new DeviceEnergyManagementModeClusterModeOptionStruct(
+ label,
+ mode,
+ modeTags
+ );
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder output = new StringBuilder();
+ output.append("DeviceEnergyManagementModeClusterModeOptionStruct {\n");
+ output.append("\tlabel: ");
+ output.append(label);
+ output.append("\n");
+ output.append("\tmode: ");
+ output.append(mode);
+ output.append("\n");
+ output.append("\tmodeTags: ");
+ output.append(modeTags);
+ output.append("\n");
+ output.append("}\n");
+ return output.toString();
+ }
+}
public static class DoorLockClusterCredentialStruct {
public Integer credentialType;
public Integer credentialIndex;
diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java
index 608a378fc281c1..0190eafd7715e0 100644
--- a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java
+++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java
@@ -238,6 +238,12 @@ public static BaseCluster getCluster(long clusterId) {
if (clusterId == EnergyPreference.ID) {
return new EnergyPreference();
}
+ if (clusterId == EnergyEvseMode.ID) {
+ return new EnergyEvseMode();
+ }
+ if (clusterId == DeviceEnergyManagementMode.ID) {
+ return new DeviceEnergyManagementMode();
+ }
if (clusterId == DoorLock.ID) {
return new DoorLock();
}
@@ -9842,6 +9848,250 @@ public long getCommandID(String name) throws IllegalArgumentException {
return Command.valueOf(name).getID();
}
}
+ public static class EnergyEvseMode implements BaseCluster {
+ public static final long ID = 157L;
+ public long getID() {
+ return ID;
+ }
+
+ public enum Attribute {
+ SupportedModes(0L),
+ CurrentMode(1L),
+ StartUpMode(2L),
+ OnMode(3L),
+ GeneratedCommandList(65528L),
+ AcceptedCommandList(65529L),
+ EventList(65530L),
+ AttributeList(65531L),
+ FeatureMap(65532L),
+ ClusterRevision(65533L),;
+ private final long id;
+ Attribute(long id) {
+ this.id = id;
+ }
+
+ public long getID() {
+ return id;
+ }
+
+ public static Attribute value(long id) throws NoSuchFieldError {
+ for (Attribute attribute : Attribute.values()) {
+ if (attribute.getID() == id) {
+ return attribute;
+ }
+ }
+ throw new NoSuchFieldError();
+ }
+ }
+
+ public enum Event {;
+ private final long id;
+ Event(long id) {
+ this.id = id;
+ }
+
+ public long getID() {
+ return id;
+ }
+
+ public static Event value(long id) throws NoSuchFieldError {
+ for (Event event : Event.values()) {
+ if (event.getID() == id) {
+ return event;
+ }
+ }
+ throw new NoSuchFieldError();
+ }
+ }
+
+ public enum Command {
+ ChangeToMode(0L),;
+ private final long id;
+ Command(long id) {
+ this.id = id;
+ }
+
+ public long getID() {
+ return id;
+ }
+
+ public static Command value(long id) throws NoSuchFieldError {
+ for (Command command : Command.values()) {
+ if (command.getID() == id) {
+ return command;
+ }
+ }
+ throw new NoSuchFieldError();
+ }
+ }public enum ChangeToModeCommandField {NewMode(0),;
+ private final int id;
+ ChangeToModeCommandField(int id) {
+ this.id = id;
+ }
+
+ public int getID() {
+ return id;
+ }
+ public static ChangeToModeCommandField value(int id) throws NoSuchFieldError {
+ for (ChangeToModeCommandField field : ChangeToModeCommandField.values()) {
+ if (field.getID() == id) {
+ return field;
+ }
+ }
+ throw new NoSuchFieldError();
+ }
+ }@Override
+ public String getAttributeName(long id) throws NoSuchFieldError {
+ return Attribute.value(id).toString();
+ }
+
+ @Override
+ public String getEventName(long id) throws NoSuchFieldError {
+ return Event.value(id).toString();
+ }
+
+ @Override
+ public String getCommandName(long id) throws NoSuchFieldError {
+ return Command.value(id).toString();
+ }
+
+ @Override
+ public long getAttributeID(String name) throws IllegalArgumentException {
+ return Attribute.valueOf(name).getID();
+ }
+
+ @Override
+ public long getEventID(String name) throws IllegalArgumentException {
+ return Event.valueOf(name).getID();
+ }
+
+ @Override
+ public long getCommandID(String name) throws IllegalArgumentException {
+ return Command.valueOf(name).getID();
+ }
+ }
+ public static class DeviceEnergyManagementMode implements BaseCluster {
+ public static final long ID = 159L;
+ public long getID() {
+ return ID;
+ }
+
+ public enum Attribute {
+ SupportedModes(0L),
+ CurrentMode(1L),
+ StartUpMode(2L),
+ OnMode(3L),
+ GeneratedCommandList(65528L),
+ AcceptedCommandList(65529L),
+ EventList(65530L),
+ AttributeList(65531L),
+ FeatureMap(65532L),
+ ClusterRevision(65533L),;
+ private final long id;
+ Attribute(long id) {
+ this.id = id;
+ }
+
+ public long getID() {
+ return id;
+ }
+
+ public static Attribute value(long id) throws NoSuchFieldError {
+ for (Attribute attribute : Attribute.values()) {
+ if (attribute.getID() == id) {
+ return attribute;
+ }
+ }
+ throw new NoSuchFieldError();
+ }
+ }
+
+ public enum Event {;
+ private final long id;
+ Event(long id) {
+ this.id = id;
+ }
+
+ public long getID() {
+ return id;
+ }
+
+ public static Event value(long id) throws NoSuchFieldError {
+ for (Event event : Event.values()) {
+ if (event.getID() == id) {
+ return event;
+ }
+ }
+ throw new NoSuchFieldError();
+ }
+ }
+
+ public enum Command {
+ ChangeToMode(0L),;
+ private final long id;
+ Command(long id) {
+ this.id = id;
+ }
+
+ public long getID() {
+ return id;
+ }
+
+ public static Command value(long id) throws NoSuchFieldError {
+ for (Command command : Command.values()) {
+ if (command.getID() == id) {
+ return command;
+ }
+ }
+ throw new NoSuchFieldError();
+ }
+ }public enum ChangeToModeCommandField {NewMode(0),;
+ private final int id;
+ ChangeToModeCommandField(int id) {
+ this.id = id;
+ }
+
+ public int getID() {
+ return id;
+ }
+ public static ChangeToModeCommandField value(int id) throws NoSuchFieldError {
+ for (ChangeToModeCommandField field : ChangeToModeCommandField.values()) {
+ if (field.getID() == id) {
+ return field;
+ }
+ }
+ throw new NoSuchFieldError();
+ }
+ }@Override
+ public String getAttributeName(long id) throws NoSuchFieldError {
+ return Attribute.value(id).toString();
+ }
+
+ @Override
+ public String getEventName(long id) throws NoSuchFieldError {
+ return Event.value(id).toString();
+ }
+
+ @Override
+ public String getCommandName(long id) throws NoSuchFieldError {
+ return Command.value(id).toString();
+ }
+
+ @Override
+ public long getAttributeID(String name) throws IllegalArgumentException {
+ return Attribute.valueOf(name).getID();
+ }
+
+ @Override
+ public long getEventID(String name) throws IllegalArgumentException {
+ return Event.valueOf(name).getID();
+ }
+
+ @Override
+ public long getCommandID(String name) throws IllegalArgumentException {
+ return Command.valueOf(name).getID();
+ }
+ }
public static class DoorLock implements BaseCluster {
public static final long ID = 257L;
public long getID() {
diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java
index 342feb2ef08dc4..48e5914458dd4c 100644
--- a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java
+++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java
@@ -11061,6 +11061,348 @@ public void onError(Exception ex) {
}
+ public static class DelegatedEnergyEvseModeClusterChangeToModeResponseCallback implements ChipClusters.EnergyEvseModeCluster.ChangeToModeResponseCallback, DelegatedClusterCallback {
+ private ClusterCommandCallback callback;
+ @Override
+ public void setCallbackDelegate(ClusterCommandCallback callback) {
+ this.callback = callback;
+ }
+
+ @Override
+ public void onSuccess(Integer status, Optional statusText) {
+ Map responseValues = new LinkedHashMap<>();
+
+ CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "Integer");
+ responseValues.put(statusResponseValue, status);
+ CommandResponseInfo statusTextResponseValue = new CommandResponseInfo("statusText", "Optional");
+ responseValues.put(statusTextResponseValue, statusText);
+ callback.onSuccess(responseValues);
+ }
+
+ @Override
+ public void onError(Exception error) {
+ callback.onFailure(error);
+ }
+ }
+ public static class DelegatedEnergyEvseModeClusterSupportedModesAttributeCallback implements ChipClusters.EnergyEvseModeCluster.SupportedModesAttributeCallback, DelegatedClusterCallback {
+ private ClusterCommandCallback callback;
+ @Override
+ public void setCallbackDelegate(ClusterCommandCallback callback) {
+ this.callback = callback;
+ }
+
+ @Override
+ public void onSuccess(List valueList) {
+ Map responseValues = new LinkedHashMap<>();
+ CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List");
+ responseValues.put(commandResponseInfo, valueList);
+ callback.onSuccess(responseValues);
+ }
+
+ @Override
+ public void onError(Exception ex) {
+ callback.onFailure(ex);
+ }
+ }
+
+ public static class DelegatedEnergyEvseModeClusterStartUpModeAttributeCallback implements ChipClusters.EnergyEvseModeCluster.StartUpModeAttributeCallback, DelegatedClusterCallback {
+ private ClusterCommandCallback callback;
+ @Override
+ public void setCallbackDelegate(ClusterCommandCallback callback) {
+ this.callback = callback;
+ }
+
+ @Override
+ public void onSuccess(@Nullable Integer value) {
+ Map responseValues = new LinkedHashMap<>();
+ CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "Integer");
+ responseValues.put(commandResponseInfo, value);
+ callback.onSuccess(responseValues);
+ }
+
+ @Override
+ public void onError(Exception ex) {
+ callback.onFailure(ex);
+ }
+ }
+
+ public static class DelegatedEnergyEvseModeClusterOnModeAttributeCallback implements ChipClusters.EnergyEvseModeCluster.OnModeAttributeCallback, DelegatedClusterCallback {
+ private ClusterCommandCallback callback;
+ @Override
+ public void setCallbackDelegate(ClusterCommandCallback callback) {
+ this.callback = callback;
+ }
+
+ @Override
+ public void onSuccess(@Nullable Integer value) {
+ Map responseValues = new LinkedHashMap<>();
+ CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "Integer");
+ responseValues.put(commandResponseInfo, value);
+ callback.onSuccess(responseValues);
+ }
+
+ @Override
+ public void onError(Exception ex) {
+ callback.onFailure(ex);
+ }
+ }
+
+ public static class DelegatedEnergyEvseModeClusterGeneratedCommandListAttributeCallback implements ChipClusters.EnergyEvseModeCluster.GeneratedCommandListAttributeCallback, DelegatedClusterCallback {
+ private ClusterCommandCallback callback;
+ @Override
+ public void setCallbackDelegate(ClusterCommandCallback callback) {
+ this.callback = callback;
+ }
+
+ @Override
+ public void onSuccess(List valueList) {
+ Map responseValues = new LinkedHashMap<>();
+ CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List");
+ responseValues.put(commandResponseInfo, valueList);
+ callback.onSuccess(responseValues);
+ }
+
+ @Override
+ public void onError(Exception ex) {
+ callback.onFailure(ex);
+ }
+ }
+
+ public static class DelegatedEnergyEvseModeClusterAcceptedCommandListAttributeCallback implements ChipClusters.EnergyEvseModeCluster.AcceptedCommandListAttributeCallback, DelegatedClusterCallback {
+ private ClusterCommandCallback callback;
+ @Override
+ public void setCallbackDelegate(ClusterCommandCallback callback) {
+ this.callback = callback;
+ }
+
+ @Override
+ public void onSuccess(List valueList) {
+ Map responseValues = new LinkedHashMap<>();
+ CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List");
+ responseValues.put(commandResponseInfo, valueList);
+ callback.onSuccess(responseValues);
+ }
+
+ @Override
+ public void onError(Exception ex) {
+ callback.onFailure(ex);
+ }
+ }
+
+ public static class DelegatedEnergyEvseModeClusterEventListAttributeCallback implements ChipClusters.EnergyEvseModeCluster.EventListAttributeCallback, DelegatedClusterCallback {
+ private ClusterCommandCallback callback;
+ @Override
+ public void setCallbackDelegate(ClusterCommandCallback callback) {
+ this.callback = callback;
+ }
+
+ @Override
+ public void onSuccess(List valueList) {
+ Map responseValues = new LinkedHashMap<>();
+ CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List");
+ responseValues.put(commandResponseInfo, valueList);
+ callback.onSuccess(responseValues);
+ }
+
+ @Override
+ public void onError(Exception ex) {
+ callback.onFailure(ex);
+ }
+ }
+
+ public static class DelegatedEnergyEvseModeClusterAttributeListAttributeCallback implements ChipClusters.EnergyEvseModeCluster.AttributeListAttributeCallback, DelegatedClusterCallback {
+ private ClusterCommandCallback callback;
+ @Override
+ public void setCallbackDelegate(ClusterCommandCallback callback) {
+ this.callback = callback;
+ }
+
+ @Override
+ public void onSuccess(List valueList) {
+ Map responseValues = new LinkedHashMap<>();
+ CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List");
+ responseValues.put(commandResponseInfo, valueList);
+ callback.onSuccess(responseValues);
+ }
+
+ @Override
+ public void onError(Exception ex) {
+ callback.onFailure(ex);
+ }
+ }
+
+
+ public static class DelegatedDeviceEnergyManagementModeClusterChangeToModeResponseCallback implements ChipClusters.DeviceEnergyManagementModeCluster.ChangeToModeResponseCallback, DelegatedClusterCallback {
+ private ClusterCommandCallback callback;
+ @Override
+ public void setCallbackDelegate(ClusterCommandCallback callback) {
+ this.callback = callback;
+ }
+
+ @Override
+ public void onSuccess(Integer status, Optional statusText) {
+ Map responseValues = new LinkedHashMap<>();
+
+ CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "Integer");
+ responseValues.put(statusResponseValue, status);
+ CommandResponseInfo statusTextResponseValue = new CommandResponseInfo("statusText", "Optional");
+ responseValues.put(statusTextResponseValue, statusText);
+ callback.onSuccess(responseValues);
+ }
+
+ @Override
+ public void onError(Exception error) {
+ callback.onFailure(error);
+ }
+ }
+ public static class DelegatedDeviceEnergyManagementModeClusterSupportedModesAttributeCallback implements ChipClusters.DeviceEnergyManagementModeCluster.SupportedModesAttributeCallback, DelegatedClusterCallback {
+ private ClusterCommandCallback callback;
+ @Override
+ public void setCallbackDelegate(ClusterCommandCallback callback) {
+ this.callback = callback;
+ }
+
+ @Override
+ public void onSuccess(List valueList) {
+ Map responseValues = new LinkedHashMap<>();
+ CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List");
+ responseValues.put(commandResponseInfo, valueList);
+ callback.onSuccess(responseValues);
+ }
+
+ @Override
+ public void onError(Exception ex) {
+ callback.onFailure(ex);
+ }
+ }
+
+ public static class DelegatedDeviceEnergyManagementModeClusterStartUpModeAttributeCallback implements ChipClusters.DeviceEnergyManagementModeCluster.StartUpModeAttributeCallback, DelegatedClusterCallback {
+ private ClusterCommandCallback callback;
+ @Override
+ public void setCallbackDelegate(ClusterCommandCallback callback) {
+ this.callback = callback;
+ }
+
+ @Override
+ public void onSuccess(@Nullable Integer value) {
+ Map responseValues = new LinkedHashMap<>();
+ CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "Integer");
+ responseValues.put(commandResponseInfo, value);
+ callback.onSuccess(responseValues);
+ }
+
+ @Override
+ public void onError(Exception ex) {
+ callback.onFailure(ex);
+ }
+ }
+
+ public static class DelegatedDeviceEnergyManagementModeClusterOnModeAttributeCallback implements ChipClusters.DeviceEnergyManagementModeCluster.OnModeAttributeCallback, DelegatedClusterCallback {
+ private ClusterCommandCallback callback;
+ @Override
+ public void setCallbackDelegate(ClusterCommandCallback callback) {
+ this.callback = callback;
+ }
+
+ @Override
+ public void onSuccess(@Nullable Integer value) {
+ Map responseValues = new LinkedHashMap<>();
+ CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "Integer");
+ responseValues.put(commandResponseInfo, value);
+ callback.onSuccess(responseValues);
+ }
+
+ @Override
+ public void onError(Exception ex) {
+ callback.onFailure(ex);
+ }
+ }
+
+ public static class DelegatedDeviceEnergyManagementModeClusterGeneratedCommandListAttributeCallback implements ChipClusters.DeviceEnergyManagementModeCluster.GeneratedCommandListAttributeCallback, DelegatedClusterCallback {
+ private ClusterCommandCallback callback;
+ @Override
+ public void setCallbackDelegate(ClusterCommandCallback callback) {
+ this.callback = callback;
+ }
+
+ @Override
+ public void onSuccess(List valueList) {
+ Map responseValues = new LinkedHashMap<>();
+ CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List");
+ responseValues.put(commandResponseInfo, valueList);
+ callback.onSuccess(responseValues);
+ }
+
+ @Override
+ public void onError(Exception ex) {
+ callback.onFailure(ex);
+ }
+ }
+
+ public static class DelegatedDeviceEnergyManagementModeClusterAcceptedCommandListAttributeCallback implements ChipClusters.DeviceEnergyManagementModeCluster.AcceptedCommandListAttributeCallback, DelegatedClusterCallback {
+ private ClusterCommandCallback callback;
+ @Override
+ public void setCallbackDelegate(ClusterCommandCallback callback) {
+ this.callback = callback;
+ }
+
+ @Override
+ public void onSuccess(List valueList) {
+ Map responseValues = new LinkedHashMap<>();
+ CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List");
+ responseValues.put(commandResponseInfo, valueList);
+ callback.onSuccess(responseValues);
+ }
+
+ @Override
+ public void onError(Exception ex) {
+ callback.onFailure(ex);
+ }
+ }
+
+ public static class DelegatedDeviceEnergyManagementModeClusterEventListAttributeCallback implements ChipClusters.DeviceEnergyManagementModeCluster.EventListAttributeCallback, DelegatedClusterCallback {
+ private ClusterCommandCallback callback;
+ @Override
+ public void setCallbackDelegate(ClusterCommandCallback callback) {
+ this.callback = callback;
+ }
+
+ @Override
+ public void onSuccess(List valueList) {
+ Map responseValues = new LinkedHashMap<>();
+ CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List");
+ responseValues.put(commandResponseInfo, valueList);
+ callback.onSuccess(responseValues);
+ }
+
+ @Override
+ public void onError(Exception ex) {
+ callback.onFailure(ex);
+ }
+ }
+
+ public static class DelegatedDeviceEnergyManagementModeClusterAttributeListAttributeCallback implements ChipClusters.DeviceEnergyManagementModeCluster.AttributeListAttributeCallback, DelegatedClusterCallback {
+ private ClusterCommandCallback callback;
+ @Override
+ public void setCallbackDelegate(ClusterCommandCallback callback) {
+ this.callback = callback;
+ }
+
+ @Override
+ public void onSuccess(List valueList) {
+ Map responseValues = new LinkedHashMap<>();
+ CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List");
+ responseValues.put(commandResponseInfo, valueList);
+ callback.onSuccess(responseValues);
+ }
+
+ @Override
+ public void onError(Exception ex) {
+ callback.onFailure(ex);
+ }
+ }
+
+
public static class DelegatedDoorLockClusterGetWeekDayScheduleResponseCallback implements ChipClusters.DoorLockCluster.GetWeekDayScheduleResponseCallback, DelegatedClusterCallback {
private ClusterCommandCallback callback;
@Override
@@ -20056,6 +20398,14 @@ public Map initializeClusterMap() {
(ptr, endpointId) -> new ChipClusters.EnergyPreferenceCluster(ptr, endpointId), new HashMap<>());
clusterMap.put("energyPreference", energyPreferenceClusterInfo);
+ ClusterInfo energyEvseModeClusterInfo = new ClusterInfo(
+ (ptr, endpointId) -> new ChipClusters.EnergyEvseModeCluster(ptr, endpointId), new HashMap<>());
+ clusterMap.put("energyEvseMode", energyEvseModeClusterInfo);
+
+ ClusterInfo deviceEnergyManagementModeClusterInfo = new ClusterInfo(
+ (ptr, endpointId) -> new ChipClusters.DeviceEnergyManagementModeCluster(ptr, endpointId), new HashMap<>());
+ clusterMap.put("deviceEnergyManagementMode", deviceEnergyManagementModeClusterInfo);
+
ClusterInfo doorLockClusterInfo = new ClusterInfo(
(ptr, endpointId) -> new ChipClusters.DoorLockCluster(ptr, endpointId), new HashMap<>());
clusterMap.put("doorLock", doorLockClusterInfo);
@@ -20302,6 +20652,8 @@ public void combineCommand(Map destination, Map> getCommandMap() {
commandMap.put("energyPreference", energyPreferenceClusterInteractionInfoMap);
+ Map energyEvseModeClusterInteractionInfoMap = new LinkedHashMap<>();
+
+ Map energyEvseModechangeToModeCommandParams = new LinkedHashMap();
+
+ CommandParameterInfo energyEvseModechangeToModenewModeCommandParameterInfo = new CommandParameterInfo("newMode", Integer.class, Integer.class);
+ energyEvseModechangeToModeCommandParams.put("newMode",energyEvseModechangeToModenewModeCommandParameterInfo);
+ InteractionInfo energyEvseModechangeToModeInteractionInfo = new InteractionInfo(
+ (cluster, callback, commandArguments) -> {
+ ((ChipClusters.EnergyEvseModeCluster) cluster)
+ .changeToMode((ChipClusters.EnergyEvseModeCluster.ChangeToModeResponseCallback) callback
+ , (Integer)
+ commandArguments.get("newMode")
+
+ );
+ },
+ () -> new DelegatedEnergyEvseModeClusterChangeToModeResponseCallback(),
+ energyEvseModechangeToModeCommandParams
+ );
+ energyEvseModeClusterInteractionInfoMap.put("changeToMode", energyEvseModechangeToModeInteractionInfo);
+
+ commandMap.put("energyEvseMode", energyEvseModeClusterInteractionInfoMap);
+
+ Map deviceEnergyManagementModeClusterInteractionInfoMap = new LinkedHashMap<>();
+
+ Map deviceEnergyManagementModechangeToModeCommandParams = new LinkedHashMap();
+
+ CommandParameterInfo deviceEnergyManagementModechangeToModenewModeCommandParameterInfo = new CommandParameterInfo("newMode", Integer.class, Integer.class);
+ deviceEnergyManagementModechangeToModeCommandParams.put("newMode",deviceEnergyManagementModechangeToModenewModeCommandParameterInfo);
+ InteractionInfo deviceEnergyManagementModechangeToModeInteractionInfo = new InteractionInfo(
+ (cluster, callback, commandArguments) -> {
+ ((ChipClusters.DeviceEnergyManagementModeCluster) cluster)
+ .changeToMode((ChipClusters.DeviceEnergyManagementModeCluster.ChangeToModeResponseCallback) callback
+ , (Integer)
+ commandArguments.get("newMode")
+
+ );
+ },
+ () -> new DelegatedDeviceEnergyManagementModeClusterChangeToModeResponseCallback(),
+ deviceEnergyManagementModechangeToModeCommandParams
+ );
+ deviceEnergyManagementModeClusterInteractionInfoMap.put("changeToMode", deviceEnergyManagementModechangeToModeInteractionInfo);
+
+ commandMap.put("deviceEnergyManagementMode", deviceEnergyManagementModeClusterInteractionInfoMap);
+
Map doorLockClusterInteractionInfoMap = new LinkedHashMap<>();
Map doorLocklockDoorCommandParams = new LinkedHashMap();
diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java
index bbd205aaca8b22..88f1ca9cde66f8 100644
--- a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java
+++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java
@@ -9864,6 +9864,234 @@ private static Map readEnergyPreferenceInteractionInfo(
return result;
}
+ private static Map readEnergyEvseModeInteractionInfo() {
+ Map result = new LinkedHashMap<>();Map readEnergyEvseModeSupportedModesCommandParams = new LinkedHashMap();
+ InteractionInfo readEnergyEvseModeSupportedModesAttributeInteractionInfo = new InteractionInfo(
+ (cluster, callback, commandArguments) -> {
+ ((ChipClusters.EnergyEvseModeCluster) cluster).readSupportedModesAttribute(
+ (ChipClusters.EnergyEvseModeCluster.SupportedModesAttributeCallback) callback
+ );
+ },
+ () -> new ClusterInfoMapping.DelegatedEnergyEvseModeClusterSupportedModesAttributeCallback(),
+ readEnergyEvseModeSupportedModesCommandParams
+ );
+ result.put("readSupportedModesAttribute", readEnergyEvseModeSupportedModesAttributeInteractionInfo);
+ Map readEnergyEvseModeCurrentModeCommandParams = new LinkedHashMap();
+ InteractionInfo readEnergyEvseModeCurrentModeAttributeInteractionInfo = new InteractionInfo(
+ (cluster, callback, commandArguments) -> {
+ ((ChipClusters.EnergyEvseModeCluster) cluster).readCurrentModeAttribute(
+ (ChipClusters.IntegerAttributeCallback) callback
+ );
+ },
+ () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(),
+ readEnergyEvseModeCurrentModeCommandParams
+ );
+ result.put("readCurrentModeAttribute", readEnergyEvseModeCurrentModeAttributeInteractionInfo);
+ Map readEnergyEvseModeStartUpModeCommandParams = new LinkedHashMap();
+ InteractionInfo readEnergyEvseModeStartUpModeAttributeInteractionInfo = new InteractionInfo(
+ (cluster, callback, commandArguments) -> {
+ ((ChipClusters.EnergyEvseModeCluster) cluster).readStartUpModeAttribute(
+ (ChipClusters.EnergyEvseModeCluster.StartUpModeAttributeCallback) callback
+ );
+ },
+ () -> new ClusterInfoMapping.DelegatedEnergyEvseModeClusterStartUpModeAttributeCallback(),
+ readEnergyEvseModeStartUpModeCommandParams
+ );
+ result.put("readStartUpModeAttribute", readEnergyEvseModeStartUpModeAttributeInteractionInfo);
+ Map readEnergyEvseModeOnModeCommandParams = new LinkedHashMap();
+ InteractionInfo readEnergyEvseModeOnModeAttributeInteractionInfo = new InteractionInfo(
+ (cluster, callback, commandArguments) -> {
+ ((ChipClusters.EnergyEvseModeCluster) cluster).readOnModeAttribute(
+ (ChipClusters.EnergyEvseModeCluster.OnModeAttributeCallback) callback
+ );
+ },
+ () -> new ClusterInfoMapping.DelegatedEnergyEvseModeClusterOnModeAttributeCallback(),
+ readEnergyEvseModeOnModeCommandParams
+ );
+ result.put("readOnModeAttribute", readEnergyEvseModeOnModeAttributeInteractionInfo);
+ Map readEnergyEvseModeGeneratedCommandListCommandParams = new LinkedHashMap();
+ InteractionInfo readEnergyEvseModeGeneratedCommandListAttributeInteractionInfo = new InteractionInfo(
+ (cluster, callback, commandArguments) -> {
+ ((ChipClusters.EnergyEvseModeCluster) cluster).readGeneratedCommandListAttribute(
+ (ChipClusters.EnergyEvseModeCluster.GeneratedCommandListAttributeCallback) callback
+ );
+ },
+ () -> new ClusterInfoMapping.DelegatedEnergyEvseModeClusterGeneratedCommandListAttributeCallback(),
+ readEnergyEvseModeGeneratedCommandListCommandParams
+ );
+ result.put("readGeneratedCommandListAttribute", readEnergyEvseModeGeneratedCommandListAttributeInteractionInfo);
+ Map readEnergyEvseModeAcceptedCommandListCommandParams = new LinkedHashMap();
+ InteractionInfo readEnergyEvseModeAcceptedCommandListAttributeInteractionInfo = new InteractionInfo(
+ (cluster, callback, commandArguments) -> {
+ ((ChipClusters.EnergyEvseModeCluster) cluster).readAcceptedCommandListAttribute(
+ (ChipClusters.EnergyEvseModeCluster.AcceptedCommandListAttributeCallback) callback
+ );
+ },
+ () -> new ClusterInfoMapping.DelegatedEnergyEvseModeClusterAcceptedCommandListAttributeCallback(),
+ readEnergyEvseModeAcceptedCommandListCommandParams
+ );
+ result.put("readAcceptedCommandListAttribute", readEnergyEvseModeAcceptedCommandListAttributeInteractionInfo);
+ Map readEnergyEvseModeEventListCommandParams = new LinkedHashMap();
+ InteractionInfo readEnergyEvseModeEventListAttributeInteractionInfo = new InteractionInfo(
+ (cluster, callback, commandArguments) -> {
+ ((ChipClusters.EnergyEvseModeCluster) cluster).readEventListAttribute(
+ (ChipClusters.EnergyEvseModeCluster.EventListAttributeCallback) callback
+ );
+ },
+ () -> new ClusterInfoMapping.DelegatedEnergyEvseModeClusterEventListAttributeCallback(),
+ readEnergyEvseModeEventListCommandParams
+ );
+ result.put("readEventListAttribute", readEnergyEvseModeEventListAttributeInteractionInfo);
+ Map readEnergyEvseModeAttributeListCommandParams = new LinkedHashMap();
+ InteractionInfo readEnergyEvseModeAttributeListAttributeInteractionInfo = new InteractionInfo(
+ (cluster, callback, commandArguments) -> {
+ ((ChipClusters.EnergyEvseModeCluster) cluster).readAttributeListAttribute(
+ (ChipClusters.EnergyEvseModeCluster.AttributeListAttributeCallback) callback
+ );
+ },
+ () -> new ClusterInfoMapping.DelegatedEnergyEvseModeClusterAttributeListAttributeCallback(),
+ readEnergyEvseModeAttributeListCommandParams
+ );
+ result.put("readAttributeListAttribute", readEnergyEvseModeAttributeListAttributeInteractionInfo);
+ Map readEnergyEvseModeFeatureMapCommandParams = new LinkedHashMap();
+ InteractionInfo readEnergyEvseModeFeatureMapAttributeInteractionInfo = new InteractionInfo(
+ (cluster, callback, commandArguments) -> {
+ ((ChipClusters.EnergyEvseModeCluster) cluster).readFeatureMapAttribute(
+ (ChipClusters.LongAttributeCallback) callback
+ );
+ },
+ () -> new ClusterInfoMapping.DelegatedLongAttributeCallback(),
+ readEnergyEvseModeFeatureMapCommandParams
+ );
+ result.put("readFeatureMapAttribute", readEnergyEvseModeFeatureMapAttributeInteractionInfo);
+ Map readEnergyEvseModeClusterRevisionCommandParams = new LinkedHashMap();
+ InteractionInfo readEnergyEvseModeClusterRevisionAttributeInteractionInfo = new InteractionInfo(
+ (cluster, callback, commandArguments) -> {
+ ((ChipClusters.EnergyEvseModeCluster) cluster).readClusterRevisionAttribute(
+ (ChipClusters.IntegerAttributeCallback) callback
+ );
+ },
+ () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(),
+ readEnergyEvseModeClusterRevisionCommandParams
+ );
+ result.put("readClusterRevisionAttribute", readEnergyEvseModeClusterRevisionAttributeInteractionInfo);
+
+ return result;
+ }
+ private static Map readDeviceEnergyManagementModeInteractionInfo() {
+ Map result = new LinkedHashMap<>();Map readDeviceEnergyManagementModeSupportedModesCommandParams = new LinkedHashMap();
+ InteractionInfo readDeviceEnergyManagementModeSupportedModesAttributeInteractionInfo = new InteractionInfo(
+ (cluster, callback, commandArguments) -> {
+ ((ChipClusters.DeviceEnergyManagementModeCluster) cluster).readSupportedModesAttribute(
+ (ChipClusters.DeviceEnergyManagementModeCluster.SupportedModesAttributeCallback) callback
+ );
+ },
+ () -> new ClusterInfoMapping.DelegatedDeviceEnergyManagementModeClusterSupportedModesAttributeCallback(),
+ readDeviceEnergyManagementModeSupportedModesCommandParams
+ );
+ result.put("readSupportedModesAttribute", readDeviceEnergyManagementModeSupportedModesAttributeInteractionInfo);
+ Map readDeviceEnergyManagementModeCurrentModeCommandParams = new LinkedHashMap();
+ InteractionInfo readDeviceEnergyManagementModeCurrentModeAttributeInteractionInfo = new InteractionInfo(
+ (cluster, callback, commandArguments) -> {
+ ((ChipClusters.DeviceEnergyManagementModeCluster) cluster).readCurrentModeAttribute(
+ (ChipClusters.IntegerAttributeCallback) callback
+ );
+ },
+ () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(),
+ readDeviceEnergyManagementModeCurrentModeCommandParams
+ );
+ result.put("readCurrentModeAttribute", readDeviceEnergyManagementModeCurrentModeAttributeInteractionInfo);
+ Map readDeviceEnergyManagementModeStartUpModeCommandParams = new LinkedHashMap();
+ InteractionInfo readDeviceEnergyManagementModeStartUpModeAttributeInteractionInfo = new InteractionInfo(
+ (cluster, callback, commandArguments) -> {
+ ((ChipClusters.DeviceEnergyManagementModeCluster) cluster).readStartUpModeAttribute(
+ (ChipClusters.DeviceEnergyManagementModeCluster.StartUpModeAttributeCallback) callback
+ );
+ },
+ () -> new ClusterInfoMapping.DelegatedDeviceEnergyManagementModeClusterStartUpModeAttributeCallback(),
+ readDeviceEnergyManagementModeStartUpModeCommandParams
+ );
+ result.put("readStartUpModeAttribute", readDeviceEnergyManagementModeStartUpModeAttributeInteractionInfo);
+ Map readDeviceEnergyManagementModeOnModeCommandParams = new LinkedHashMap();
+ InteractionInfo readDeviceEnergyManagementModeOnModeAttributeInteractionInfo = new InteractionInfo(
+ (cluster, callback, commandArguments) -> {
+ ((ChipClusters.DeviceEnergyManagementModeCluster) cluster).readOnModeAttribute(
+ (ChipClusters.DeviceEnergyManagementModeCluster.OnModeAttributeCallback) callback
+ );
+ },
+ () -> new ClusterInfoMapping.DelegatedDeviceEnergyManagementModeClusterOnModeAttributeCallback(),
+ readDeviceEnergyManagementModeOnModeCommandParams
+ );
+ result.put("readOnModeAttribute", readDeviceEnergyManagementModeOnModeAttributeInteractionInfo);
+ Map readDeviceEnergyManagementModeGeneratedCommandListCommandParams = new LinkedHashMap();
+ InteractionInfo readDeviceEnergyManagementModeGeneratedCommandListAttributeInteractionInfo = new InteractionInfo(
+ (cluster, callback, commandArguments) -> {
+ ((ChipClusters.DeviceEnergyManagementModeCluster) cluster).readGeneratedCommandListAttribute(
+ (ChipClusters.DeviceEnergyManagementModeCluster.GeneratedCommandListAttributeCallback) callback
+ );
+ },
+ () -> new ClusterInfoMapping.DelegatedDeviceEnergyManagementModeClusterGeneratedCommandListAttributeCallback(),
+ readDeviceEnergyManagementModeGeneratedCommandListCommandParams
+ );
+ result.put("readGeneratedCommandListAttribute", readDeviceEnergyManagementModeGeneratedCommandListAttributeInteractionInfo);
+ Map readDeviceEnergyManagementModeAcceptedCommandListCommandParams = new LinkedHashMap();
+ InteractionInfo readDeviceEnergyManagementModeAcceptedCommandListAttributeInteractionInfo = new InteractionInfo(
+ (cluster, callback, commandArguments) -> {
+ ((ChipClusters.DeviceEnergyManagementModeCluster) cluster).readAcceptedCommandListAttribute(
+ (ChipClusters.DeviceEnergyManagementModeCluster.AcceptedCommandListAttributeCallback) callback
+ );
+ },
+ () -> new ClusterInfoMapping.DelegatedDeviceEnergyManagementModeClusterAcceptedCommandListAttributeCallback(),
+ readDeviceEnergyManagementModeAcceptedCommandListCommandParams
+ );
+ result.put("readAcceptedCommandListAttribute", readDeviceEnergyManagementModeAcceptedCommandListAttributeInteractionInfo);
+ Map readDeviceEnergyManagementModeEventListCommandParams = new LinkedHashMap();
+ InteractionInfo readDeviceEnergyManagementModeEventListAttributeInteractionInfo = new InteractionInfo(
+ (cluster, callback, commandArguments) -> {
+ ((ChipClusters.DeviceEnergyManagementModeCluster) cluster).readEventListAttribute(
+ (ChipClusters.DeviceEnergyManagementModeCluster.EventListAttributeCallback) callback
+ );
+ },
+ () -> new ClusterInfoMapping.DelegatedDeviceEnergyManagementModeClusterEventListAttributeCallback(),
+ readDeviceEnergyManagementModeEventListCommandParams
+ );
+ result.put("readEventListAttribute", readDeviceEnergyManagementModeEventListAttributeInteractionInfo);
+ Map readDeviceEnergyManagementModeAttributeListCommandParams = new LinkedHashMap();
+ InteractionInfo readDeviceEnergyManagementModeAttributeListAttributeInteractionInfo = new InteractionInfo(
+ (cluster, callback, commandArguments) -> {
+ ((ChipClusters.DeviceEnergyManagementModeCluster) cluster).readAttributeListAttribute(
+ (ChipClusters.DeviceEnergyManagementModeCluster.AttributeListAttributeCallback) callback
+ );
+ },
+ () -> new ClusterInfoMapping.DelegatedDeviceEnergyManagementModeClusterAttributeListAttributeCallback(),
+ readDeviceEnergyManagementModeAttributeListCommandParams
+ );
+ result.put("readAttributeListAttribute", readDeviceEnergyManagementModeAttributeListAttributeInteractionInfo);
+ Map readDeviceEnergyManagementModeFeatureMapCommandParams = new LinkedHashMap();
+ InteractionInfo readDeviceEnergyManagementModeFeatureMapAttributeInteractionInfo = new InteractionInfo(
+ (cluster, callback, commandArguments) -> {
+ ((ChipClusters.DeviceEnergyManagementModeCluster) cluster).readFeatureMapAttribute(
+ (ChipClusters.LongAttributeCallback) callback
+ );
+ },
+ () -> new ClusterInfoMapping.DelegatedLongAttributeCallback(),
+ readDeviceEnergyManagementModeFeatureMapCommandParams
+ );
+ result.put("readFeatureMapAttribute", readDeviceEnergyManagementModeFeatureMapAttributeInteractionInfo);
+ Map readDeviceEnergyManagementModeClusterRevisionCommandParams = new LinkedHashMap();
+ InteractionInfo readDeviceEnergyManagementModeClusterRevisionAttributeInteractionInfo = new InteractionInfo(
+ (cluster, callback, commandArguments) -> {
+ ((ChipClusters.DeviceEnergyManagementModeCluster) cluster).readClusterRevisionAttribute(
+ (ChipClusters.IntegerAttributeCallback) callback
+ );
+ },
+ () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(),
+ readDeviceEnergyManagementModeClusterRevisionCommandParams
+ );
+ result.put("readClusterRevisionAttribute", readDeviceEnergyManagementModeClusterRevisionAttributeInteractionInfo);
+
+ return result;
+ }
private static Map readDoorLockInteractionInfo() {
Map result = new LinkedHashMap<>();Map readDoorLockLockStateCommandParams = new LinkedHashMap();
InteractionInfo readDoorLockLockStateAttributeInteractionInfo = new InteractionInfo(
@@ -19933,6 +20161,8 @@ public Map> getReadAttributeMap() {
put("deviceEnergyManagement", readDeviceEnergyManagementInteractionInfo());
put("energyEvse", readEnergyEvseInteractionInfo());
put("energyPreference", readEnergyPreferenceInteractionInfo());
+ put("energyEvseMode", readEnergyEvseModeInteractionInfo());
+ put("deviceEnergyManagementMode", readDeviceEnergyManagementModeInteractionInfo());
put("doorLock", readDoorLockInteractionInfo());
put("windowCovering", readWindowCoveringInteractionInfo());
put("barrierControl", readBarrierControlInteractionInfo());
diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java
index c3003c33ed19e0..f854f52c4e0d56 100644
--- a/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java
+++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java
@@ -1398,6 +1398,98 @@ public Map> getWriteAttributeMap() {
);
writeEnergyPreferenceInteractionInfo.put("writeCurrentLowPowerModeSensitivityAttribute", writeEnergyPreferenceCurrentLowPowerModeSensitivityAttributeInteractionInfo);
writeAttributeMap.put("energyPreference", writeEnergyPreferenceInteractionInfo);
+ Map writeEnergyEvseModeInteractionInfo = new LinkedHashMap<>();
+ Map writeEnergyEvseModeStartUpModeCommandParams = new LinkedHashMap();
+ CommandParameterInfo energyEvseModestartUpModeCommandParameterInfo =
+ new CommandParameterInfo(
+ "value",
+ Integer.class,
+ Integer.class
+ );
+ writeEnergyEvseModeStartUpModeCommandParams.put(
+ "value",
+ energyEvseModestartUpModeCommandParameterInfo
+ );
+ InteractionInfo writeEnergyEvseModeStartUpModeAttributeInteractionInfo = new InteractionInfo(
+ (cluster, callback, commandArguments) -> {
+ ((ChipClusters.EnergyEvseModeCluster) cluster).writeStartUpModeAttribute(
+ (DefaultClusterCallback) callback,
+ (Integer) commandArguments.get("value")
+ );
+ },
+ () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(),
+ writeEnergyEvseModeStartUpModeCommandParams
+ );
+ writeEnergyEvseModeInteractionInfo.put("writeStartUpModeAttribute", writeEnergyEvseModeStartUpModeAttributeInteractionInfo);
+ Map writeEnergyEvseModeOnModeCommandParams = new LinkedHashMap();
+ CommandParameterInfo energyEvseModeonModeCommandParameterInfo =
+ new CommandParameterInfo(
+ "value",
+ Integer.class,
+ Integer.class
+ );
+ writeEnergyEvseModeOnModeCommandParams.put(
+ "value",
+ energyEvseModeonModeCommandParameterInfo
+ );
+ InteractionInfo writeEnergyEvseModeOnModeAttributeInteractionInfo = new InteractionInfo(
+ (cluster, callback, commandArguments) -> {
+ ((ChipClusters.EnergyEvseModeCluster) cluster).writeOnModeAttribute(
+ (DefaultClusterCallback) callback,
+ (Integer) commandArguments.get("value")
+ );
+ },
+ () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(),
+ writeEnergyEvseModeOnModeCommandParams
+ );
+ writeEnergyEvseModeInteractionInfo.put("writeOnModeAttribute", writeEnergyEvseModeOnModeAttributeInteractionInfo);
+ writeAttributeMap.put("energyEvseMode", writeEnergyEvseModeInteractionInfo);
+ Map writeDeviceEnergyManagementModeInteractionInfo = new LinkedHashMap<>();
+ Map writeDeviceEnergyManagementModeStartUpModeCommandParams = new LinkedHashMap();
+ CommandParameterInfo deviceEnergyManagementModestartUpModeCommandParameterInfo =
+ new CommandParameterInfo(
+ "value",
+ Integer.class,
+ Integer.class
+ );
+ writeDeviceEnergyManagementModeStartUpModeCommandParams.put(
+ "value",
+ deviceEnergyManagementModestartUpModeCommandParameterInfo
+ );
+ InteractionInfo writeDeviceEnergyManagementModeStartUpModeAttributeInteractionInfo = new InteractionInfo(
+ (cluster, callback, commandArguments) -> {
+ ((ChipClusters.DeviceEnergyManagementModeCluster) cluster).writeStartUpModeAttribute(
+ (DefaultClusterCallback) callback,
+ (Integer) commandArguments.get("value")
+ );
+ },
+ () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(),
+ writeDeviceEnergyManagementModeStartUpModeCommandParams
+ );
+ writeDeviceEnergyManagementModeInteractionInfo.put("writeStartUpModeAttribute", writeDeviceEnergyManagementModeStartUpModeAttributeInteractionInfo);
+ Map writeDeviceEnergyManagementModeOnModeCommandParams = new LinkedHashMap();
+ CommandParameterInfo deviceEnergyManagementModeonModeCommandParameterInfo =
+ new CommandParameterInfo(
+ "value",
+ Integer.class,
+ Integer.class
+ );
+ writeDeviceEnergyManagementModeOnModeCommandParams.put(
+ "value",
+ deviceEnergyManagementModeonModeCommandParameterInfo
+ );
+ InteractionInfo writeDeviceEnergyManagementModeOnModeAttributeInteractionInfo = new InteractionInfo(
+ (cluster, callback, commandArguments) -> {
+ ((ChipClusters.DeviceEnergyManagementModeCluster) cluster).writeOnModeAttribute(
+ (DefaultClusterCallback) callback,
+ (Integer) commandArguments.get("value")
+ );
+ },
+ () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(),
+ writeDeviceEnergyManagementModeOnModeCommandParams
+ );
+ writeDeviceEnergyManagementModeInteractionInfo.put("writeOnModeAttribute", writeDeviceEnergyManagementModeOnModeAttributeInteractionInfo);
+ writeAttributeMap.put("deviceEnergyManagementMode", writeDeviceEnergyManagementModeInteractionInfo);
Map writeDoorLockInteractionInfo = new LinkedHashMap<>();
Map writeDoorLockDoorOpenEventsCommandParams = new LinkedHashMap();
CommandParameterInfo doorLockdoorOpenEventsCommandParameterInfo =
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 dc97dce9da6268..b0b58a8d5f5cfe 100644
--- a/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni
+++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni
@@ -50,6 +50,8 @@ structs_sources = [
"${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",
+ "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DeviceEnergyManagementModeClusterModeOptionStruct.kt",
+ "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DeviceEnergyManagementModeClusterModeTagStruct.kt",
"${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DishwasherModeClusterModeOptionStruct.kt",
"${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DishwasherModeClusterModeTagStruct.kt",
"${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DoorLockClusterCredentialStruct.kt",
@@ -58,6 +60,8 @@ structs_sources = [
"${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalEnergyMeasurementClusterMeasurementAccuracyStruct.kt",
"${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt",
"${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseClusterChargingTargetStruct.kt",
+ "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseModeClusterModeOptionStruct.kt",
+ "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseModeClusterModeTagStruct.kt",
"${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyPreferenceClusterBalanceStruct.kt",
"${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/FixedLabelClusterLabelStruct.kt",
"${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/GeneralCommissioningClusterBasicCommissioningInfo.kt",
diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DeviceEnergyManagementModeClusterModeOptionStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DeviceEnergyManagementModeClusterModeOptionStruct.kt
new file mode 100644
index 00000000000000..6940454d5d2383
--- /dev/null
+++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DeviceEnergyManagementModeClusterModeOptionStruct.kt
@@ -0,0 +1,79 @@
+/*
+ *
+ * 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 DeviceEnergyManagementModeClusterModeOptionStruct(
+ val label: String,
+ val mode: UInt,
+ val modeTags: List
+) {
+ override fun toString(): String = buildString {
+ append("DeviceEnergyManagementModeClusterModeOptionStruct {\n")
+ append("\tlabel : $label\n")
+ append("\tmode : $mode\n")
+ append("\tmodeTags : $modeTags\n")
+ append("}\n")
+ }
+
+ fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) {
+ tlvWriter.apply {
+ startStructure(tlvTag)
+ put(ContextSpecificTag(TAG_LABEL), label)
+ put(ContextSpecificTag(TAG_MODE), mode)
+ startArray(ContextSpecificTag(TAG_MODE_TAGS))
+ for (item in modeTags.iterator()) {
+ item.toTlv(AnonymousTag, this)
+ }
+ endArray()
+ endStructure()
+ }
+ }
+
+ companion object {
+ private const val TAG_LABEL = 0
+ private const val TAG_MODE = 1
+ private const val TAG_MODE_TAGS = 2
+
+ fun fromTlv(
+ tlvTag: Tag,
+ tlvReader: TlvReader
+ ): DeviceEnergyManagementModeClusterModeOptionStruct {
+ tlvReader.enterStructure(tlvTag)
+ val label = tlvReader.getString(ContextSpecificTag(TAG_LABEL))
+ val mode = tlvReader.getUInt(ContextSpecificTag(TAG_MODE))
+ val modeTags =
+ buildList {
+ tlvReader.enterArray(ContextSpecificTag(TAG_MODE_TAGS))
+ while (!tlvReader.isEndOfContainer()) {
+ add(DeviceEnergyManagementModeClusterModeTagStruct.fromTlv(AnonymousTag, tlvReader))
+ }
+ tlvReader.exitContainer()
+ }
+
+ tlvReader.exitContainer()
+
+ return DeviceEnergyManagementModeClusterModeOptionStruct(label, mode, modeTags)
+ }
+ }
+}
diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DeviceEnergyManagementModeClusterModeTagStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DeviceEnergyManagementModeClusterModeTagStruct.kt
new file mode 100644
index 00000000000000..b47b743cbff0e8
--- /dev/null
+++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DeviceEnergyManagementModeClusterModeTagStruct.kt
@@ -0,0 +1,65 @@
+/*
+ *
+ * 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 java.util.Optional
+import matter.tlv.ContextSpecificTag
+import matter.tlv.Tag
+import matter.tlv.TlvReader
+import matter.tlv.TlvWriter
+
+class DeviceEnergyManagementModeClusterModeTagStruct(val mfgCode: Optional, val value: UInt) {
+ override fun toString(): String = buildString {
+ append("DeviceEnergyManagementModeClusterModeTagStruct {\n")
+ append("\tmfgCode : $mfgCode\n")
+ append("\tvalue : $value\n")
+ append("}\n")
+ }
+
+ fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) {
+ tlvWriter.apply {
+ startStructure(tlvTag)
+ if (mfgCode.isPresent) {
+ val optmfgCode = mfgCode.get()
+ put(ContextSpecificTag(TAG_MFG_CODE), optmfgCode)
+ }
+ put(ContextSpecificTag(TAG_VALUE), value)
+ endStructure()
+ }
+ }
+
+ companion object {
+ private const val TAG_MFG_CODE = 0
+ private const val TAG_VALUE = 1
+
+ fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): DeviceEnergyManagementModeClusterModeTagStruct {
+ tlvReader.enterStructure(tlvTag)
+ val mfgCode =
+ if (tlvReader.isNextTag(ContextSpecificTag(TAG_MFG_CODE))) {
+ Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_MFG_CODE)))
+ } else {
+ Optional.empty()
+ }
+ val value = tlvReader.getUInt(ContextSpecificTag(TAG_VALUE))
+
+ tlvReader.exitContainer()
+
+ return DeviceEnergyManagementModeClusterModeTagStruct(mfgCode, value)
+ }
+ }
+}
diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseModeClusterModeOptionStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseModeClusterModeOptionStruct.kt
new file mode 100644
index 00000000000000..762598ee0f78c9
--- /dev/null
+++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseModeClusterModeOptionStruct.kt
@@ -0,0 +1,76 @@
+/*
+ *
+ * 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 EnergyEvseModeClusterModeOptionStruct(
+ val label: String,
+ val mode: UInt,
+ val modeTags: List
+) {
+ override fun toString(): String = buildString {
+ append("EnergyEvseModeClusterModeOptionStruct {\n")
+ append("\tlabel : $label\n")
+ append("\tmode : $mode\n")
+ append("\tmodeTags : $modeTags\n")
+ append("}\n")
+ }
+
+ fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) {
+ tlvWriter.apply {
+ startStructure(tlvTag)
+ put(ContextSpecificTag(TAG_LABEL), label)
+ put(ContextSpecificTag(TAG_MODE), mode)
+ startArray(ContextSpecificTag(TAG_MODE_TAGS))
+ for (item in modeTags.iterator()) {
+ item.toTlv(AnonymousTag, this)
+ }
+ endArray()
+ endStructure()
+ }
+ }
+
+ companion object {
+ private const val TAG_LABEL = 0
+ private const val TAG_MODE = 1
+ private const val TAG_MODE_TAGS = 2
+
+ fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyEvseModeClusterModeOptionStruct {
+ tlvReader.enterStructure(tlvTag)
+ val label = tlvReader.getString(ContextSpecificTag(TAG_LABEL))
+ val mode = tlvReader.getUInt(ContextSpecificTag(TAG_MODE))
+ val modeTags =
+ buildList {
+ tlvReader.enterArray(ContextSpecificTag(TAG_MODE_TAGS))
+ while (!tlvReader.isEndOfContainer()) {
+ add(EnergyEvseModeClusterModeTagStruct.fromTlv(AnonymousTag, tlvReader))
+ }
+ tlvReader.exitContainer()
+ }
+
+ tlvReader.exitContainer()
+
+ return EnergyEvseModeClusterModeOptionStruct(label, mode, modeTags)
+ }
+ }
+}
diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseModeClusterModeTagStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseModeClusterModeTagStruct.kt
new file mode 100644
index 00000000000000..44073906d8afdc
--- /dev/null
+++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseModeClusterModeTagStruct.kt
@@ -0,0 +1,65 @@
+/*
+ *
+ * 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 java.util.Optional
+import matter.tlv.ContextSpecificTag
+import matter.tlv.Tag
+import matter.tlv.TlvReader
+import matter.tlv.TlvWriter
+
+class EnergyEvseModeClusterModeTagStruct(val mfgCode: Optional, val value: UInt) {
+ override fun toString(): String = buildString {
+ append("EnergyEvseModeClusterModeTagStruct {\n")
+ append("\tmfgCode : $mfgCode\n")
+ append("\tvalue : $value\n")
+ append("}\n")
+ }
+
+ fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) {
+ tlvWriter.apply {
+ startStructure(tlvTag)
+ if (mfgCode.isPresent) {
+ val optmfgCode = mfgCode.get()
+ put(ContextSpecificTag(TAG_MFG_CODE), optmfgCode)
+ }
+ put(ContextSpecificTag(TAG_VALUE), value)
+ endStructure()
+ }
+ }
+
+ companion object {
+ private const val TAG_MFG_CODE = 0
+ private const val TAG_VALUE = 1
+
+ fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyEvseModeClusterModeTagStruct {
+ tlvReader.enterStructure(tlvTag)
+ val mfgCode =
+ if (tlvReader.isNextTag(ContextSpecificTag(TAG_MFG_CODE))) {
+ Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_MFG_CODE)))
+ } else {
+ Optional.empty()
+ }
+ val value = tlvReader.getUInt(ContextSpecificTag(TAG_VALUE))
+
+ tlvReader.exitContainer()
+
+ return EnergyEvseModeClusterModeTagStruct(mfgCode, value)
+ }
+ }
+}
diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/DeviceEnergyManagementModeCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/DeviceEnergyManagementModeCluster.kt
new file mode 100644
index 00000000000000..57d57908068487
--- /dev/null
+++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/DeviceEnergyManagementModeCluster.kt
@@ -0,0 +1,1201 @@
+/*
+ *
+ * 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.clusters
+
+import java.time.Duration
+import java.util.logging.Level
+import java.util.logging.Logger
+import kotlinx.coroutines.flow.Flow
+import kotlinx.coroutines.flow.transform
+import matter.controller.InvokeRequest
+import matter.controller.InvokeResponse
+import matter.controller.MatterController
+import matter.controller.ReadData
+import matter.controller.ReadRequest
+import matter.controller.SubscribeRequest
+import matter.controller.SubscriptionState
+import matter.controller.UByteSubscriptionState
+import matter.controller.UIntSubscriptionState
+import matter.controller.UShortSubscriptionState
+import matter.controller.WriteRequest
+import matter.controller.WriteRequests
+import matter.controller.WriteResponse
+import matter.controller.cluster.structs.*
+import matter.controller.model.AttributePath
+import matter.controller.model.CommandPath
+import matter.tlv.AnonymousTag
+import matter.tlv.ContextSpecificTag
+import matter.tlv.TlvReader
+import matter.tlv.TlvWriter
+
+class DeviceEnergyManagementModeCluster(
+ private val controller: MatterController,
+ private val endpointId: UShort
+) {
+ class ChangeToModeResponse(val status: UByte, val statusText: String?)
+
+ class SupportedModesAttribute(val value: List)
+
+ sealed class SupportedModesAttributeSubscriptionState {
+ data class Success(val value: List) :
+ SupportedModesAttributeSubscriptionState()
+
+ data class Error(val exception: Exception) : SupportedModesAttributeSubscriptionState()
+
+ object SubscriptionEstablished : SupportedModesAttributeSubscriptionState()
+ }
+
+ class StartUpModeAttribute(val value: UByte?)
+
+ sealed class StartUpModeAttributeSubscriptionState {
+ data class Success(val value: UByte?) : StartUpModeAttributeSubscriptionState()
+
+ data class Error(val exception: Exception) : StartUpModeAttributeSubscriptionState()
+
+ object SubscriptionEstablished : StartUpModeAttributeSubscriptionState()
+ }
+
+ class OnModeAttribute(val value: UByte?)
+
+ sealed class OnModeAttributeSubscriptionState {
+ data class Success(val value: UByte?) : OnModeAttributeSubscriptionState()
+
+ data class Error(val exception: Exception) : OnModeAttributeSubscriptionState()
+
+ object SubscriptionEstablished : OnModeAttributeSubscriptionState()
+ }
+
+ class GeneratedCommandListAttribute(val value: List)
+
+ sealed class GeneratedCommandListAttributeSubscriptionState {
+ data class Success(val value: List) : GeneratedCommandListAttributeSubscriptionState()
+
+ data class Error(val exception: Exception) : GeneratedCommandListAttributeSubscriptionState()
+
+ object SubscriptionEstablished : GeneratedCommandListAttributeSubscriptionState()
+ }
+
+ class AcceptedCommandListAttribute(val value: List)
+
+ sealed class AcceptedCommandListAttributeSubscriptionState {
+ data class Success(val value: List) : AcceptedCommandListAttributeSubscriptionState()
+
+ data class Error(val exception: Exception) : AcceptedCommandListAttributeSubscriptionState()
+
+ object SubscriptionEstablished : AcceptedCommandListAttributeSubscriptionState()
+ }
+
+ class EventListAttribute(val value: List)
+
+ sealed class EventListAttributeSubscriptionState {
+ data class Success(val value: List) : EventListAttributeSubscriptionState()
+
+ data class Error(val exception: Exception) : EventListAttributeSubscriptionState()
+
+ object SubscriptionEstablished : EventListAttributeSubscriptionState()
+ }
+
+ class AttributeListAttribute(val value: List)
+
+ sealed class AttributeListAttributeSubscriptionState {
+ data class Success(val value: List) : AttributeListAttributeSubscriptionState()
+
+ data class Error(val exception: Exception) : AttributeListAttributeSubscriptionState()
+
+ object SubscriptionEstablished : AttributeListAttributeSubscriptionState()
+ }
+
+ suspend fun changeToMode(
+ newMode: UByte,
+ timedInvokeTimeout: Duration? = null
+ ): ChangeToModeResponse {
+ val commandId: UInt = 0u
+
+ val tlvWriter = TlvWriter()
+ tlvWriter.startStructure(AnonymousTag)
+
+ val TAG_NEW_MODE_REQ: Int = 0
+ tlvWriter.put(ContextSpecificTag(TAG_NEW_MODE_REQ), newMode)
+ tlvWriter.endStructure()
+
+ val request: InvokeRequest =
+ InvokeRequest(
+ CommandPath(endpointId, clusterId = CLUSTER_ID, commandId),
+ tlvPayload = tlvWriter.getEncoded(),
+ timedRequest = timedInvokeTimeout
+ )
+
+ val response: InvokeResponse = controller.invoke(request)
+ logger.log(Level.FINE, "Invoke command succeeded: ${response}")
+
+ val tlvReader = TlvReader(response.payload)
+ tlvReader.enterStructure(AnonymousTag)
+ val TAG_STATUS: Int = 0
+ var status_decoded: UByte? = null
+
+ val TAG_STATUS_TEXT: Int = 1
+ var statusText_decoded: String? = null
+
+ while (!tlvReader.isEndOfContainer()) {
+ val tag = tlvReader.peekElement().tag
+
+ if (tag == ContextSpecificTag(TAG_STATUS)) {
+ status_decoded = tlvReader.getUByte(tag)
+ }
+
+ if (tag == ContextSpecificTag(TAG_STATUS_TEXT)) {
+ statusText_decoded =
+ if (tlvReader.isNull()) {
+ tlvReader.getNull(tag)
+ null
+ } else {
+ if (tlvReader.isNextTag(tag)) {
+ tlvReader.getString(tag)
+ } else {
+ null
+ }
+ }
+ } else {
+ tlvReader.skipElement()
+ }
+ }
+
+ if (status_decoded == null) {
+ throw IllegalStateException("status not found in TLV")
+ }
+
+ tlvReader.exitContainer()
+
+ return ChangeToModeResponse(status_decoded, statusText_decoded)
+ }
+
+ suspend fun readSupportedModesAttribute(): SupportedModesAttribute {
+ val ATTRIBUTE_ID: UInt = 0u
+
+ val attributePath =
+ AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID)
+
+ val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath))
+
+ val response = controller.read(readRequest)
+
+ if (response.successes.isEmpty()) {
+ logger.log(Level.WARNING, "Read command failed")
+ throw IllegalStateException("Read command failed with failures: ${response.failures}")
+ }
+
+ logger.log(Level.FINE, "Read command succeeded")
+
+ val attributeData =
+ response.successes.filterIsInstance().firstOrNull {
+ it.path.attributeId == ATTRIBUTE_ID
+ }
+
+ requireNotNull(attributeData) { "Supportedmodes attribute not found in response" }
+
+ // Decode the TLV data into the appropriate type
+ val tlvReader = TlvReader(attributeData.data)
+ val decodedValue: List =
+ buildList {
+ tlvReader.enterArray(AnonymousTag)
+ while (!tlvReader.isEndOfContainer()) {
+ add(DeviceEnergyManagementModeClusterModeOptionStruct.fromTlv(AnonymousTag, tlvReader))
+ }
+ tlvReader.exitContainer()
+ }
+
+ return SupportedModesAttribute(decodedValue)
+ }
+
+ suspend fun subscribeSupportedModesAttribute(
+ minInterval: Int,
+ maxInterval: Int
+ ): Flow {
+ val ATTRIBUTE_ID: UInt = 0u
+ val attributePaths =
+ listOf(
+ AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID)
+ )
+
+ val subscribeRequest: SubscribeRequest =
+ SubscribeRequest(
+ eventPaths = emptyList(),
+ attributePaths = attributePaths,
+ minInterval = Duration.ofSeconds(minInterval.toLong()),
+ maxInterval = Duration.ofSeconds(maxInterval.toLong())
+ )
+
+ return controller.subscribe(subscribeRequest).transform { subscriptionState ->
+ when (subscriptionState) {
+ is SubscriptionState.SubscriptionErrorNotification -> {
+ emit(
+ SupportedModesAttributeSubscriptionState.Error(
+ Exception(
+ "Subscription terminated with error code: ${subscriptionState.terminationCause}"
+ )
+ )
+ )
+ }
+ is SubscriptionState.NodeStateUpdate -> {
+ val attributeData =
+ subscriptionState.updateState.successes
+ .filterIsInstance()
+ .firstOrNull { it.path.attributeId == ATTRIBUTE_ID }
+
+ requireNotNull(attributeData) {
+ "Supportedmodes attribute not found in Node State update"
+ }
+
+ // Decode the TLV data into the appropriate type
+ val tlvReader = TlvReader(attributeData.data)
+ val decodedValue: List =
+ buildList {
+ tlvReader.enterArray(AnonymousTag)
+ while (!tlvReader.isEndOfContainer()) {
+ add(
+ DeviceEnergyManagementModeClusterModeOptionStruct.fromTlv(AnonymousTag, tlvReader)
+ )
+ }
+ tlvReader.exitContainer()
+ }
+
+ emit(SupportedModesAttributeSubscriptionState.Success(decodedValue))
+ }
+ SubscriptionState.SubscriptionEstablished -> {
+ emit(SupportedModesAttributeSubscriptionState.SubscriptionEstablished)
+ }
+ }
+ }
+ }
+
+ suspend fun readCurrentModeAttribute(): UByte {
+ val ATTRIBUTE_ID: UInt = 1u
+
+ val attributePath =
+ AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID)
+
+ val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath))
+
+ val response = controller.read(readRequest)
+
+ if (response.successes.isEmpty()) {
+ logger.log(Level.WARNING, "Read command failed")
+ throw IllegalStateException("Read command failed with failures: ${response.failures}")
+ }
+
+ logger.log(Level.FINE, "Read command succeeded")
+
+ val attributeData =
+ response.successes.filterIsInstance().firstOrNull {
+ it.path.attributeId == ATTRIBUTE_ID
+ }
+
+ requireNotNull(attributeData) { "Currentmode attribute not found in response" }
+
+ // Decode the TLV data into the appropriate type
+ val tlvReader = TlvReader(attributeData.data)
+ val decodedValue: UByte = tlvReader.getUByte(AnonymousTag)
+
+ return decodedValue
+ }
+
+ suspend fun subscribeCurrentModeAttribute(
+ minInterval: Int,
+ maxInterval: Int
+ ): Flow {
+ val ATTRIBUTE_ID: UInt = 1u
+ val attributePaths =
+ listOf(
+ AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID)
+ )
+
+ val subscribeRequest: SubscribeRequest =
+ SubscribeRequest(
+ eventPaths = emptyList(),
+ attributePaths = attributePaths,
+ minInterval = Duration.ofSeconds(minInterval.toLong()),
+ maxInterval = Duration.ofSeconds(maxInterval.toLong())
+ )
+
+ return controller.subscribe(subscribeRequest).transform { subscriptionState ->
+ when (subscriptionState) {
+ is SubscriptionState.SubscriptionErrorNotification -> {
+ emit(
+ UByteSubscriptionState.Error(
+ Exception(
+ "Subscription terminated with error code: ${subscriptionState.terminationCause}"
+ )
+ )
+ )
+ }
+ is SubscriptionState.NodeStateUpdate -> {
+ val attributeData =
+ subscriptionState.updateState.successes
+ .filterIsInstance()
+ .firstOrNull { it.path.attributeId == ATTRIBUTE_ID }
+
+ requireNotNull(attributeData) { "Currentmode attribute not found in Node State update" }
+
+ // Decode the TLV data into the appropriate type
+ val tlvReader = TlvReader(attributeData.data)
+ val decodedValue: UByte = tlvReader.getUByte(AnonymousTag)
+
+ emit(UByteSubscriptionState.Success(decodedValue))
+ }
+ SubscriptionState.SubscriptionEstablished -> {
+ emit(UByteSubscriptionState.SubscriptionEstablished)
+ }
+ }
+ }
+ }
+
+ suspend fun readStartUpModeAttribute(): StartUpModeAttribute {
+ val ATTRIBUTE_ID: UInt = 2u
+
+ val attributePath =
+ AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID)
+
+ val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath))
+
+ val response = controller.read(readRequest)
+
+ if (response.successes.isEmpty()) {
+ logger.log(Level.WARNING, "Read command failed")
+ throw IllegalStateException("Read command failed with failures: ${response.failures}")
+ }
+
+ logger.log(Level.FINE, "Read command succeeded")
+
+ val attributeData =
+ response.successes.filterIsInstance().firstOrNull {
+ it.path.attributeId == ATTRIBUTE_ID
+ }
+
+ requireNotNull(attributeData) { "Startupmode attribute not found in response" }
+
+ // Decode the TLV data into the appropriate type
+ val tlvReader = TlvReader(attributeData.data)
+ val decodedValue: UByte? =
+ if (!tlvReader.isNull()) {
+ if (tlvReader.isNextTag(AnonymousTag)) {
+ tlvReader.getUByte(AnonymousTag)
+ } else {
+ null
+ }
+ } else {
+ tlvReader.getNull(AnonymousTag)
+ null
+ }
+
+ return StartUpModeAttribute(decodedValue)
+ }
+
+ suspend fun writeStartUpModeAttribute(value: UByte, timedWriteTimeout: Duration? = null) {
+ val ATTRIBUTE_ID: UInt = 2u
+
+ val tlvWriter = TlvWriter()
+ tlvWriter.put(AnonymousTag, value)
+
+ val writeRequests: WriteRequests =
+ WriteRequests(
+ requests =
+ listOf(
+ WriteRequest(
+ attributePath =
+ AttributePath(endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID),
+ tlvPayload = tlvWriter.getEncoded()
+ )
+ ),
+ timedRequest = timedWriteTimeout
+ )
+
+ val response: WriteResponse = controller.write(writeRequests)
+
+ when (response) {
+ is WriteResponse.Success -> {
+ logger.log(Level.FINE, "Write command succeeded")
+ }
+ is WriteResponse.PartialWriteFailure -> {
+ val aggregatedErrorMessage =
+ response.failures.joinToString("\n") { failure ->
+ "Error at ${failure.attributePath}: ${failure.ex.message}"
+ }
+
+ response.failures.forEach { failure ->
+ logger.log(Level.WARNING, "Error at ${failure.attributePath}: ${failure.ex.message}")
+ }
+
+ throw IllegalStateException("Write command failed with errors: \n$aggregatedErrorMessage")
+ }
+ }
+ }
+
+ suspend fun subscribeStartUpModeAttribute(
+ minInterval: Int,
+ maxInterval: Int
+ ): Flow {
+ val ATTRIBUTE_ID: UInt = 2u
+ val attributePaths =
+ listOf(
+ AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID)
+ )
+
+ val subscribeRequest: SubscribeRequest =
+ SubscribeRequest(
+ eventPaths = emptyList(),
+ attributePaths = attributePaths,
+ minInterval = Duration.ofSeconds(minInterval.toLong()),
+ maxInterval = Duration.ofSeconds(maxInterval.toLong())
+ )
+
+ return controller.subscribe(subscribeRequest).transform { subscriptionState ->
+ when (subscriptionState) {
+ is SubscriptionState.SubscriptionErrorNotification -> {
+ emit(
+ StartUpModeAttributeSubscriptionState.Error(
+ Exception(
+ "Subscription terminated with error code: ${subscriptionState.terminationCause}"
+ )
+ )
+ )
+ }
+ is SubscriptionState.NodeStateUpdate -> {
+ val attributeData =
+ subscriptionState.updateState.successes
+ .filterIsInstance()
+ .firstOrNull { it.path.attributeId == ATTRIBUTE_ID }
+
+ requireNotNull(attributeData) { "Startupmode attribute not found in Node State update" }
+
+ // Decode the TLV data into the appropriate type
+ val tlvReader = TlvReader(attributeData.data)
+ val decodedValue: UByte? =
+ if (!tlvReader.isNull()) {
+ if (tlvReader.isNextTag(AnonymousTag)) {
+ tlvReader.getUByte(AnonymousTag)
+ } else {
+ null
+ }
+ } else {
+ tlvReader.getNull(AnonymousTag)
+ null
+ }
+
+ decodedValue?.let { emit(StartUpModeAttributeSubscriptionState.Success(it)) }
+ }
+ SubscriptionState.SubscriptionEstablished -> {
+ emit(StartUpModeAttributeSubscriptionState.SubscriptionEstablished)
+ }
+ }
+ }
+ }
+
+ suspend fun readOnModeAttribute(): OnModeAttribute {
+ val ATTRIBUTE_ID: UInt = 3u
+
+ val attributePath =
+ AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID)
+
+ val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath))
+
+ val response = controller.read(readRequest)
+
+ if (response.successes.isEmpty()) {
+ logger.log(Level.WARNING, "Read command failed")
+ throw IllegalStateException("Read command failed with failures: ${response.failures}")
+ }
+
+ logger.log(Level.FINE, "Read command succeeded")
+
+ val attributeData =
+ response.successes.filterIsInstance().firstOrNull {
+ it.path.attributeId == ATTRIBUTE_ID
+ }
+
+ requireNotNull(attributeData) { "Onmode attribute not found in response" }
+
+ // Decode the TLV data into the appropriate type
+ val tlvReader = TlvReader(attributeData.data)
+ val decodedValue: UByte? =
+ if (!tlvReader.isNull()) {
+ if (tlvReader.isNextTag(AnonymousTag)) {
+ tlvReader.getUByte(AnonymousTag)
+ } else {
+ null
+ }
+ } else {
+ tlvReader.getNull(AnonymousTag)
+ null
+ }
+
+ return OnModeAttribute(decodedValue)
+ }
+
+ suspend fun writeOnModeAttribute(value: UByte, timedWriteTimeout: Duration? = null) {
+ val ATTRIBUTE_ID: UInt = 3u
+
+ val tlvWriter = TlvWriter()
+ tlvWriter.put(AnonymousTag, value)
+
+ val writeRequests: WriteRequests =
+ WriteRequests(
+ requests =
+ listOf(
+ WriteRequest(
+ attributePath =
+ AttributePath(endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID),
+ tlvPayload = tlvWriter.getEncoded()
+ )
+ ),
+ timedRequest = timedWriteTimeout
+ )
+
+ val response: WriteResponse = controller.write(writeRequests)
+
+ when (response) {
+ is WriteResponse.Success -> {
+ logger.log(Level.FINE, "Write command succeeded")
+ }
+ is WriteResponse.PartialWriteFailure -> {
+ val aggregatedErrorMessage =
+ response.failures.joinToString("\n") { failure ->
+ "Error at ${failure.attributePath}: ${failure.ex.message}"
+ }
+
+ response.failures.forEach { failure ->
+ logger.log(Level.WARNING, "Error at ${failure.attributePath}: ${failure.ex.message}")
+ }
+
+ throw IllegalStateException("Write command failed with errors: \n$aggregatedErrorMessage")
+ }
+ }
+ }
+
+ suspend fun subscribeOnModeAttribute(
+ minInterval: Int,
+ maxInterval: Int
+ ): Flow {
+ val ATTRIBUTE_ID: UInt = 3u
+ val attributePaths =
+ listOf(
+ AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID)
+ )
+
+ val subscribeRequest: SubscribeRequest =
+ SubscribeRequest(
+ eventPaths = emptyList(),
+ attributePaths = attributePaths,
+ minInterval = Duration.ofSeconds(minInterval.toLong()),
+ maxInterval = Duration.ofSeconds(maxInterval.toLong())
+ )
+
+ return controller.subscribe(subscribeRequest).transform { subscriptionState ->
+ when (subscriptionState) {
+ is SubscriptionState.SubscriptionErrorNotification -> {
+ emit(
+ OnModeAttributeSubscriptionState.Error(
+ Exception(
+ "Subscription terminated with error code: ${subscriptionState.terminationCause}"
+ )
+ )
+ )
+ }
+ is SubscriptionState.NodeStateUpdate -> {
+ val attributeData =
+ subscriptionState.updateState.successes
+ .filterIsInstance()
+ .firstOrNull { it.path.attributeId == ATTRIBUTE_ID }
+
+ requireNotNull(attributeData) { "Onmode attribute not found in Node State update" }
+
+ // Decode the TLV data into the appropriate type
+ val tlvReader = TlvReader(attributeData.data)
+ val decodedValue: UByte? =
+ if (!tlvReader.isNull()) {
+ if (tlvReader.isNextTag(AnonymousTag)) {
+ tlvReader.getUByte(AnonymousTag)
+ } else {
+ null
+ }
+ } else {
+ tlvReader.getNull(AnonymousTag)
+ null
+ }
+
+ decodedValue?.let { emit(OnModeAttributeSubscriptionState.Success(it)) }
+ }
+ SubscriptionState.SubscriptionEstablished -> {
+ emit(OnModeAttributeSubscriptionState.SubscriptionEstablished)
+ }
+ }
+ }
+ }
+
+ suspend fun readGeneratedCommandListAttribute(): GeneratedCommandListAttribute {
+ val ATTRIBUTE_ID: UInt = 65528u
+
+ val attributePath =
+ AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID)
+
+ val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath))
+
+ val response = controller.read(readRequest)
+
+ if (response.successes.isEmpty()) {
+ logger.log(Level.WARNING, "Read command failed")
+ throw IllegalStateException("Read command failed with failures: ${response.failures}")
+ }
+
+ logger.log(Level.FINE, "Read command succeeded")
+
+ val attributeData =
+ response.successes.filterIsInstance().firstOrNull {
+ it.path.attributeId == ATTRIBUTE_ID
+ }
+
+ requireNotNull(attributeData) { "Generatedcommandlist attribute not found in response" }
+
+ // Decode the TLV data into the appropriate type
+ val tlvReader = TlvReader(attributeData.data)
+ val decodedValue: List =
+ buildList {
+ tlvReader.enterArray(AnonymousTag)
+ while (!tlvReader.isEndOfContainer()) {
+ add(tlvReader.getUInt(AnonymousTag))
+ }
+ tlvReader.exitContainer()
+ }
+
+ return GeneratedCommandListAttribute(decodedValue)
+ }
+
+ suspend fun subscribeGeneratedCommandListAttribute(
+ minInterval: Int,
+ maxInterval: Int
+ ): Flow {
+ val ATTRIBUTE_ID: UInt = 65528u
+ val attributePaths =
+ listOf(
+ AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID)
+ )
+
+ val subscribeRequest: SubscribeRequest =
+ SubscribeRequest(
+ eventPaths = emptyList(),
+ attributePaths = attributePaths,
+ minInterval = Duration.ofSeconds(minInterval.toLong()),
+ maxInterval = Duration.ofSeconds(maxInterval.toLong())
+ )
+
+ return controller.subscribe(subscribeRequest).transform { subscriptionState ->
+ when (subscriptionState) {
+ is SubscriptionState.SubscriptionErrorNotification -> {
+ emit(
+ GeneratedCommandListAttributeSubscriptionState.Error(
+ Exception(
+ "Subscription terminated with error code: ${subscriptionState.terminationCause}"
+ )
+ )
+ )
+ }
+ is SubscriptionState.NodeStateUpdate -> {
+ val attributeData =
+ subscriptionState.updateState.successes
+ .filterIsInstance