From 874d750a1cec3bf99ec4181933666d7c214abc32 Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Wed, 29 Nov 2023 11:37:49 +0000
Subject: [PATCH 01/80] Fix #30665 (EVSE) - Changed to use amperage_mA,
 energy_mWh - removed max on epoch_s - removed access for operate - removed
 side for events

---
 .../data-model/chip/energy-evse-cluster.xml   | 57 ++++++++-----------
 1 file changed, 25 insertions(+), 32 deletions(-)

diff --git a/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml
index 8eed118f9ef953..6cd2a47dab50c5 100644
--- a/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml
+++ b/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml
@@ -71,7 +71,7 @@ limitations under the License.
     <cluster code="0x0099"/>
     <item fieldId="0" name="TargetTime" type="int16u" min="0" max="1439"/>
     <item fieldId="1" name="TargetSoC" type="percent" optional="true"/>
-    <item fieldId="2" name="AddedEnergy" type="int64s" min="0" max="500000000" optional="true"/>
+    <item fieldId="2" name="AddedEnergy" type="energy_mWh" min="0" optional="true"/>
   </struct>
   <cluster apiMaturity="provisional">
     <name>Energy EVSE</name>
@@ -88,15 +88,15 @@ limitations under the License.
     <attribute code="0x0000" side="server" type="StateEnum" define="STATE" isNullable="true" writable="false" optional="false">State</attribute>
     <attribute code="0x0001" side="server" type="SupplyStateEnum" define="SUPPLY_STATE" writable="false" optional="false">SupplyState</attribute>
     <attribute code="0x0002" side="server" type="FaultStateEnum" define="FAULT_STATE" writable="false" optional="false">FaultState</attribute>
-    <attribute code="0x0003" side="server" type="epoch_s" define="CHARGING_ENABLED_UNTIL" isNullable="true" default="0" max="0xFFFFFFFE" writable="false" optional="false">ChargingEnabledUntil</attribute>
+    <attribute code="0x0003" side="server" type="epoch_s" define="CHARGING_ENABLED_UNTIL" isNullable="true" default="0" writable="false" optional="false">ChargingEnabledUntil</attribute>
     <!--Conformance feature V2X - for now optional-->
-    <attribute code="0x0004" side="server" type="epoch_s" define="DISCHARGING_ENABLED_UNTIL" isNullable="true" default="0" max="0xFFFFFFFE" writable="false" optional="true">DischargingEnabledUntil</attribute>
-    <attribute code="0x0005" side="server" type="int64s" define="CIRCUIT_CAPACITY" default="0" min="0" max="80000" writable="false" optional="false">CircuitCapacity</attribute>
-    <attribute code="0x0006" side="server" type="int64s" define="MINIMUM_CHARGE_CURRENT" default="6000" min="0" max="80000" writable="false" optional="false">MinimumChargeCurrent</attribute>
-    <attribute code="0x0007" side="server" type="int64s" define="MAXIMUM_CHARGE_CURRENT" default="0" min="0" max="80000" writable="false" optional="false">MaximumChargeCurrent</attribute>
+    <attribute code="0x0004" side="server" type="epoch_s" define="DISCHARGING_ENABLED_UNTIL" isNullable="true" default="0" writable="false" optional="true">DischargingEnabledUntil</attribute>
+    <attribute code="0x0005" side="server" type="amperage_mA" define="CIRCUIT_CAPACITY" default="0" min="0" max="80000" writable="false" optional="false">CircuitCapacity</attribute>
+    <attribute code="0x0006" side="server" type="amperage_mA" define="MINIMUM_CHARGE_CURRENT" default="6000" min="0" max="80000" writable="false" optional="false">MinimumChargeCurrent</attribute>
+    <attribute code="0x0007" side="server" type="amperage_mA" define="MAXIMUM_CHARGE_CURRENT" default="0" min="0" max="80000" writable="false" optional="false">MaximumChargeCurrent</attribute>
     <!--Conformance feature V2X - for now optional-->
-    <attribute code="0x0008" side="server" type="int64s" define="MAXIMUM_DISCHARGE_CURRENT" default="0" min="0" max="80000" writable="false" optional="true">MaximumDischargeCurrent</attribute>
-    <attribute code="0x0009" side="server" type="int64s" define="USER_MAXIMUM_CHARGE_CURRENT" default="0" writable="true" optional="true">
+    <attribute code="0x0008" side="server" type="amperage_mA" define="MAXIMUM_DISCHARGE_CURRENT" default="0" min="0" max="80000" writable="false" optional="true">MaximumDischargeCurrent</attribute>
+    <attribute code="0x0009" side="server" type="amperage_mA" define="USER_MAXIMUM_CHARGE_CURRENT" default="0" writable="true" optional="true">
       <access op="read" privilege="view"/>
       <access op="write" privilege="manage"/>
       <description>UserMaximumChargeCurrent</description>
@@ -115,7 +115,7 @@ limitations under the License.
     <!--Conformance feature PREF - for now optional-->
     <attribute code="0x0024" side="server" type="epoch_s" define="NEXT_CHARGE_TARGET_TIME" isNullable="true" max="0xFFFFFFFE" writable="false" optional="true">NextChargeTargetTime</attribute>
     <!--Conformance feature PREF - for now optional-->
-    <attribute code="0x0025" side="server" type="int64s" define="NEXT_CHARGE_REQUIRED_ENERGY" isNullable="true" min="0" max="500000000" writable="false" optional="true">NextChargeRequiredEnergy</attribute>
+    <attribute code="0x0025" side="server" type="energy_mWh" define="NEXT_CHARGE_REQUIRED_ENERGY" isNullable="true" min="0" writable="false" optional="true">NextChargeRequiredEnergy</attribute>
     <!--Conformance feature PREF - for now optional-->
     <attribute code="0x0026" side="server" type="percent" define="NEXT_CHARGE_TARGET_SOC" isNullable="true" max="100" writable="false" optional="true">NextChargeTargetSoC</attribute>
     <!--Conformance feature [PREF] - for now optional-->
@@ -127,48 +127,41 @@ limitations under the License.
     <!--Conformance feature SOC - for now optional-->
     <attribute code="0x0030" side="server" type="percent" define="STATE_OF_CHARGE" isNullable="true" max="100" writable="false" optional="true">StateOfCharge</attribute>
     <!--Conformance feature SOC - for now optional-->
-    <attribute code="0x0031" side="server" type="int64s" define="BATTERY_CAPACITY" isNullable="true" min="0" max="500000000" writable="false" optional="true">BatteryCapacity</attribute>
+    <attribute code="0x0031" side="server" type="energy_mWh" define="BATTERY_CAPACITY" isNullable="true" min="0" writable="false" optional="true">BatteryCapacity</attribute>
     <!--Conformance feature PNC - for now optional-->
     <attribute code="0x0032" side="server" type="char_string" define="VEHICLE_ID" isNullable="true" length="32" writable="false" optional="true">VehicleID</attribute>
     <attribute code="0x0040" side="server" type="int32u" define="SESSION_ID" isNullable="true" default="0" min="1" max="0xFFFFFFFF" writable="false" optional="false">SessionID</attribute>
     <attribute code="0x0041" side="server" type="elapsed_s" define="SESSION_DURATION" default="0" writable="false" optional="false">SessionDuration</attribute>
-    <attribute code="0x0042" side="server" type="int64s" define="SESSION_ENERGY_CHARGED" default="0" min="0" max="500000000" writable="false" optional="false">SessionEnergyCharged</attribute>
+    <attribute code="0x0042" side="server" type="energy_mWh" define="SESSION_ENERGY_CHARGED" default="0" min="0" writable="false" optional="false">SessionEnergyCharged</attribute>
     <!--Conformance feature V2X - for now optional-->
-    <attribute code="0x0043" side="server" type="int64s" define="SESSION_ENERGY_DISCHARGED" default="0" min="0" max="500000000" writable="false" optional="true">SessionEnergyDischarged</attribute>
+    <attribute code="0x0043" side="server" type="energy_mWh" define="SESSION_ENERGY_DISCHARGED" default="0" min="0" writable="false" optional="true">SessionEnergyDischarged</attribute>
     <command source="client" code="0x0001" name="Disable" optional="false" mustUseTimedInvoke="true" apiMaturity="provisional">
-      <access op="invoke" privilege="operate"/>
       <description>Allows a client to disable the EVSE from charging and discharging.</description>
     </command>
     <command source="client" code="0x0002" name="EnableCharging" optional="false" mustUseTimedInvoke="true" apiMaturity="provisional">
-      <access op="invoke" privilege="operate"/>
       <arg name="ChargingEnabledUntil" type="epoch_s" max="0xFFFFFFFE" isNullable="true"/>
-      <arg name="MinimumChargeCurrent" type="int64s" min="0" max="80000"/>
-      <arg name="MaximumChargeCurrent" type="int64s" min="0" max="80000"/>
+      <arg name="MinimumChargeCurrent" type="amperage_mA" min="0" max="80000"/>
+      <arg name="MaximumChargeCurrent" type="amperage_mA" min="0" max="80000"/>
       <description>Allows a client to enable the EVSE to charge an EV.</description>
     </command>
     <command source="client" code="0x0003" name="EnableDischarging" optional="true" mustUseTimedInvoke="true" apiMaturity="provisional">
-      <access op="invoke" privilege="operate"/>
       <arg name="DischargingEnabledUntil" type="epoch_s" max="0xFFFFFFFE" isNullable="true"/>
-      <arg name="MaximumDischargeCurrent" type="int64s" min="0" max="80000"/>
+      <arg name="MaximumDischargeCurrent" type="amperage_mA" min="0" max="80000"/>
       <description>Allows a client to enable the EVSE to discharge an EV.</description>
     </command>
     <command source="client" code="0x0004" name="StartDiagnostics" optional="true" mustUseTimedInvoke="true" apiMaturity="provisional">
-      <access op="invoke" privilege="operate"/>
       <description>Allows a client to put the EVSE into a self-diagnostics mode.</description>
     </command>
     <command source="client" code="0x0005" name="SetTargets" optional="true" mustUseTimedInvoke="true" apiMaturity="provisional">
-      <access op="invoke" privilege="operate"/>
       <arg name="DayOfWeekforSequence" type="TargetDayOfWeekBitmap"/>
       <arg name="ChargingTargets" array="true" type="ChargingTargetStruct"/>
       <description>Allows a client to set the user specified charging targets.</description>
     </command>
     <command source="client" code="0x0006" name="GetTargets" optional="true" response="GetTargetsResponse" mustUseTimedInvoke="true" apiMaturity="provisional">
-      <access op="invoke" privilege="operate"/>
       <arg name="DaysToReturn" type="TargetDayOfWeekBitmap"/>
       <description>Allows a client to retrieve the user specified charging targets.</description>
     </command>
     <command source="client" code="0x0007" name="ClearTargets" optional="true" mustUseTimedInvoke="true" apiMaturity="provisional">
-      <access op="invoke" privilege="operate"/>
       <description>Allows a client to clear all stored charging targets.</description>
     </command>
     <command source="server" code="0x0000" name="GetTargetsResponse" optional="true" apiMaturity="provisional">
@@ -176,39 +169,39 @@ limitations under the License.
       <arg name="ChargingTargets" array="true" type="ChargingTargetStruct"/>
       <description>The GetTargetsResponse is sent in response to the GetTargets Command.</description>
     </command>
-    <event code="0x0000" name="EVConnected" priority="info" side="server" apiMaturity="provisional">
+    <event code="0x0000" name="EVConnected" priority="info" apiMaturity="provisional">
       <description>EVConnected</description>
       <field id="0" name="SessionID" type="int32u" min="1" max="0xFFFFFFFF" apiMaturity="provisional"/>
     </event>
-    <event code="0x0001" name="EVNotDetected" priority="info" side="server" apiMaturity="provisional">
+    <event code="0x0001" name="EVNotDetected" priority="info" apiMaturity="provisional">
       <description>EVNotDetected</description>
       <field id="0" name="SessionID" type="int32u" min="1" max="0xFFFFFFFF" apiMaturity="provisional"/>
       <field id="1" name="State" type="StateEnum" apiMaturity="provisional"/>
       <field id="2" name="SessionDuration" type="elapsed_s" apiMaturity="provisional"/>
-      <field id="3" name="SessionEnergyCharged" type="int64s" min="0" max="500000000" apiMaturity="provisional"/>
-      <field id="4" name="SessionEnergyDischarged" type="int64s" min="0" max="500000000" optional="true" apiMaturity="provisional"/>
+      <field id="3" name="SessionEnergyCharged" type="energy_mWh" min="0" apiMaturity="provisional"/>
+      <field id="4" name="SessionEnergyDischarged" type="energy_mWh" min="0"  optional="true" apiMaturity="provisional"/>
     </event>
-    <event code="0x0002" name="EnergyTransferStarted" priority="info" side="server" apiMaturity="provisional">
+    <event code="0x0002" name="EnergyTransferStarted" priority="info" apiMaturity="provisional">
       <description>EnergyTransferStarted</description>
       <field id="0" name="SessionID" type="int32u" min="1" max="0xFFFFFFFF" apiMaturity="provisional"/>
       <field id="1" name="State" type="StateEnum" apiMaturity="provisional"/>
-      <field id="2" name="MaximumCurrent" type="int64s" min="0" max="80000" apiMaturity="provisional"/>
+      <field id="2" name="MaximumCurrent" type="amperage_mA" min="0" max="80000" apiMaturity="provisional"/>
     </event>
-    <event code="0x0003" name="EnergyTransferStopped" priority="info" side="server" apiMaturity="provisional">
+    <event code="0x0003" name="EnergyTransferStopped" priority="info" apiMaturity="provisional">
       <description>EnergyTransferStopped</description>
       <field id="0" name="SessionID" type="int32u" min="1" max="0xFFFFFFFF" apiMaturity="provisional"/>
       <field id="1" name="State" type="StateEnum" apiMaturity="provisional"/>
       <field id="2" name="Reason" type="EnergyTransferStoppedReasonEnum" apiMaturity="provisional"/>
-      <field id="4" name="EnergyTransferred" type="int64s" min="0" max="500000000" apiMaturity="provisional"/>
+      <field id="4" name="EnergyTransferred" type="energy_mWh" min="0" apiMaturity="provisional"/>
     </event>
-    <event code="0x0004" name="Fault" priority="critical" side="server" apiMaturity="provisional">
+    <event code="0x0004" name="Fault" priority="critical" apiMaturity="provisional">
       <description>Fault</description>
       <field id="0" name="SessionID" type="int32u" min="1" max="0xFFFFFFFF" apiMaturity="provisional"/>
       <field id="1" name="State" type="StateEnum" apiMaturity="provisional"/>
       <field id="2" name="FaultStatePreviousState" type="FaultStateEnum" apiMaturity="provisional"/>
       <field id="4" name="FaultStateCurrentState" type="FaultStateEnum" apiMaturity="provisional"/>
     </event>
-    <event code="0x0005" name="RFID" priority="info" side="server" apiMaturity="provisional" optional="true">
+    <event code="0x0005" name="RFID" priority="info" apiMaturity="provisional" optional="true">
       <description>RFID</description>
       <field id="0" name="UID" type="octet_string" length="10" apiMaturity="provisional"/>
     </event>

From 35a06a7d2853f065b6b86e5990985a9f31b76be3 Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Wed, 29 Nov 2023 15:28:55 +0000
Subject: [PATCH 02/80] Fix #30665 updates to try to get further with ZAP and
 autogen, but still fails with some parts of regen_all

---
 .../matter_idl/generators/type_definitions.py |  4 +++
 src/app/zap-templates/common/override.js      |  5 +++
 .../zcl/data-model/chip/chip-types.xml        |  5 +++
 .../data_model/controller-clusters.matter     | 34 +++++++++----------
 .../data_model/controller-clusters.zap        |  3 +-
 .../app-common/zap-generated/attribute-type.h |  4 +++
 .../zap-generated/attributes/Accessors.cpp    | 22 ++++++------
 .../zap-generated/attributes/Accessors.h      | 18 +++++-----
 8 files changed, 57 insertions(+), 38 deletions(-)

diff --git a/scripts/py_matter_idl/matter_idl/generators/type_definitions.py b/scripts/py_matter_idl/matter_idl/generators/type_definitions.py
index 29d496b48315bb..f244294b6bb192 100644
--- a/scripts/py_matter_idl/matter_idl/generators/type_definitions.py
+++ b/scripts/py_matter_idl/matter_idl/generators/type_definitions.py
@@ -190,6 +190,7 @@ def is_struct(self) -> bool:
     # Derived types
     # Specification describes them in section '7.18.2. Derived Data Types'
     "action_id": BasicInteger(idl_name="action_id", byte_count=1, is_signed=False),
+    "amperage_mA": BasicInteger(idl_name="amperage_mA", byte_count=8, is_signed=True),
     "attrib_id": BasicInteger(idl_name="attrib_id", byte_count=4, is_signed=False),
     "cluster_id": BasicInteger(idl_name="cluster_id", byte_count=4, is_signed=False),
     "command_id": BasicInteger(idl_name="command_id", byte_count=4, is_signed=False),
@@ -198,6 +199,7 @@ def is_struct(self) -> bool:
     "devtype_id": BasicInteger(idl_name="devtype_id", byte_count=4, is_signed=False),
     "elapsed_s": BasicInteger(idl_name="elapsed_s", byte_count=4, is_signed=False),
     "endpoint_no": BasicInteger(idl_name="endpoint_no", byte_count=2, is_signed=False),
+    "energy_mWh":  BasicInteger(idl_name="energy_mWh", byte_count=8, is_signed=True), 
     "entry_idx": BasicInteger(idl_name="entry_idx", byte_count=2, is_signed=False),
     "epoch_s": BasicInteger(idl_name="epoch_s", byte_count=4, is_signed=False),
     "epoch_us": BasicInteger(idl_name="epoch_us", byte_count=8, is_signed=False),
@@ -212,6 +214,7 @@ def is_struct(self) -> bool:
     "percent": BasicInteger(idl_name="percent", byte_count=1, is_signed=False),
     "percent100ths": BasicInteger(idl_name="percent100ths", byte_count=2, is_signed=False),
     "posix_ms": BasicInteger(idl_name="posix_ms", byte_count=8, is_signed=False),
+    "power_mW": BasicInteger(idl_name="power_mW", byte_count=8, is_signed=True),
     "priority": BasicInteger(idl_name="priority", byte_count=1, is_signed=False),
     "status": BasicInteger(idl_name="status", byte_count=2, is_signed=False),
     "systime_ms": BasicInteger(idl_name="systime_ms", byte_count=8, is_signed=False),
@@ -221,6 +224,7 @@ def is_struct(self) -> bool:
     "tod": BasicInteger(idl_name="tod", byte_count=4, is_signed=False),
     "trans_id": BasicInteger(idl_name="trans_id", byte_count=4, is_signed=False),
     "vendor_id": BasicInteger(idl_name="vendor_id", byte_count=2, is_signed=False),
+    "voltage_mV": BasicInteger(idl_name="voltage_mV", byte_count=8, is_signed=True),
 }
 
 
diff --git a/src/app/zap-templates/common/override.js b/src/app/zap-templates/common/override.js
index 98420cdabb1fda..de7bd90165bfc3 100644
--- a/src/app/zap-templates/common/override.js
+++ b/src/app/zap-templates/common/override.js
@@ -74,6 +74,11 @@ function atomicType(arg)
     return 'chip::Percent';
   case 'percent100ths':
     return 'chip::Percent100ths';
+  case 'power_mW':
+  case 'amperage_mA':
+  case 'voltage_mV':
+  case 'energy_mWh':
+    return 'int64_t';    
   case 'epoch_us':
   case 'systime_us':
   case 'posix_ms':
diff --git a/src/app/zap-templates/zcl/data-model/chip/chip-types.xml b/src/app/zap-templates/zcl/data-model/chip/chip-types.xml
index 0756fd85569f6c..40b5fc808f5ba9 100644
--- a/src/app/zap-templates/zcl/data-model/chip/chip-types.xml
+++ b/src/app/zap-templates/zcl/data-model/chip/chip-types.xml
@@ -56,6 +56,11 @@ limitations under the License.
     <type id="0x42" description="Character String"         name="char_string"                 composite="true"/>
     <type id="0x44" description="Long Character String"    name="long_char_string"            composite="true"/>
 
+    <type id="0xD9" description="Power milliwatts"         name="power_mW"          size="8"  analog="true"   />
+    <type id="0xDA" description="Amperage milliamps"       name="amperage_mA"       size="8"  analog="true"   />
+    <type id="0xDB" description="Voltage millivolts"       name="voltage_mV"        size="8"  analog="true"   />
+    <type id="0xDC" description="Energy milliwatt-hours"   name="energy_mWh"        size="8"  analog="true"   />
+
     <type id="0xE6" description="Percentage units 1%"      name="percent"           size="1"  analog="true"   />
     <type id="0xE7" description="Percentage units 0.01%"   name="percent100ths"     size="2"  analog="true"   />
 
diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter
index 54eae3531eadd4..33acf1e0c9616f 100644
--- a/src/controller/data_model/controller-clusters.matter
+++ b/src/controller/data_model/controller-clusters.matter
@@ -4370,7 +4370,7 @@ provisional cluster EnergyEvse = 153 {
   struct ChargingTargetStruct {
     int16u targetTime = 0;
     optional percent targetSoC = 1;
-    optional int64s addedEnergy = 2;
+    optional energy_mWh addedEnergy = 2;
   }
 
   info event EVConnected = 0 {
@@ -4381,21 +4381,21 @@ provisional cluster EnergyEvse = 153 {
     int32u sessionID = 0;
     StateEnum state = 1;
     elapsed_s sessionDuration = 2;
-    int64s sessionEnergyCharged = 3;
-    optional int64s sessionEnergyDischarged = 4;
+    energy_mWh sessionEnergyCharged = 3;
+    optional energy_mWh sessionEnergyDischarged = 4;
   }
 
   info event EnergyTransferStarted = 2 {
     int32u sessionID = 0;
     StateEnum state = 1;
-    int64s maximumCurrent = 2;
+    amperage_mA maximumCurrent = 2;
   }
 
   info event EnergyTransferStopped = 3 {
     int32u sessionID = 0;
     StateEnum state = 1;
     EnergyTransferStoppedReasonEnum reason = 2;
-    int64s energyTransferred = 4;
+    energy_mWh energyTransferred = 4;
   }
 
   critical event Fault = 4 {
@@ -4414,26 +4414,26 @@ provisional cluster EnergyEvse = 153 {
   readonly attribute FaultStateEnum faultState = 2;
   readonly attribute nullable epoch_s chargingEnabledUntil = 3;
   readonly attribute optional nullable epoch_s dischargingEnabledUntil = 4;
-  readonly attribute int64s circuitCapacity = 5;
-  readonly attribute int64s minimumChargeCurrent = 6;
-  readonly attribute int64s maximumChargeCurrent = 7;
-  readonly attribute optional int64s maximumDischargeCurrent = 8;
-  attribute access(write: manage) optional int64s userMaximumChargeCurrent = 9;
+  readonly attribute amperage_mA circuitCapacity = 5;
+  readonly attribute amperage_mA minimumChargeCurrent = 6;
+  readonly attribute amperage_mA maximumChargeCurrent = 7;
+  readonly attribute optional amperage_mA maximumDischargeCurrent = 8;
+  attribute access(write: manage) optional amperage_mA userMaximumChargeCurrent = 9;
   attribute access(write: manage) optional elapsed_s randomizationDelayWindow = 10;
   readonly attribute optional int8u numberOfWeeklyTargets = 33;
   readonly attribute optional int8u numberOfDailyTargets = 34;
   readonly attribute optional nullable epoch_s nextChargeStartTime = 35;
   readonly attribute optional nullable epoch_s nextChargeTargetTime = 36;
-  readonly attribute optional nullable int64s nextChargeRequiredEnergy = 37;
+  readonly attribute optional nullable energy_mWh nextChargeRequiredEnergy = 37;
   readonly attribute optional nullable percent nextChargeTargetSoC = 38;
   attribute access(write: manage) optional nullable int16u approximateEVEfficiency = 39;
   readonly attribute optional nullable percent stateOfCharge = 48;
-  readonly attribute optional nullable int64s batteryCapacity = 49;
+  readonly attribute optional nullable energy_mWh batteryCapacity = 49;
   readonly attribute optional nullable char_string<32> vehicleID = 50;
   readonly attribute nullable int32u sessionID = 64;
   readonly attribute elapsed_s sessionDuration = 65;
-  readonly attribute int64s sessionEnergyCharged = 66;
-  readonly attribute optional int64s sessionEnergyDischarged = 67;
+  readonly attribute energy_mWh sessionEnergyCharged = 66;
+  readonly attribute optional energy_mWh sessionEnergyDischarged = 67;
   readonly attribute command_id generatedCommandList[] = 65528;
   readonly attribute command_id acceptedCommandList[] = 65529;
   readonly attribute event_id eventList[] = 65530;
@@ -4448,13 +4448,13 @@ provisional cluster EnergyEvse = 153 {
 
   request struct EnableChargingRequest {
     nullable epoch_s chargingEnabledUntil = 0;
-    int64s minimumChargeCurrent = 1;
-    int64s maximumChargeCurrent = 2;
+    amperage_mA minimumChargeCurrent = 1;
+    amperage_mA maximumChargeCurrent = 2;
   }
 
   request struct EnableDischargingRequest {
     nullable epoch_s dischargingEnabledUntil = 0;
-    int64s maximumDischargeCurrent = 1;
+    amperage_mA maximumDischargeCurrent = 1;
   }
 
   request struct SetTargetsRequest {
diff --git a/src/controller/data_model/controller-clusters.zap b/src/controller/data_model/controller-clusters.zap
index 67b8da72bb5505..9bb8be22fae1a2 100644
--- a/src/controller/data_model/controller-clusters.zap
+++ b/src/controller/data_model/controller-clusters.zap
@@ -5400,5 +5400,6 @@
       "endpointId": 1,
       "networkId": 0
     }
-  ]
+  ],
+  "log": []
 }
\ No newline at end of file
diff --git a/zzz_generated/app-common/app-common/zap-generated/attribute-type.h b/zzz_generated/app-common/app-common/zap-generated/attribute-type.h
index e79d1281b33a8c..6b3b35cc4aa684 100644
--- a/zzz_generated/app-common/app-common/zap-generated/attribute-type.h
+++ b/zzz_generated/app-common/app-common/zap-generated/attribute-type.h
@@ -74,6 +74,10 @@ enum
     ZCL_SYSTIME_MS_ATTRIBUTE_TYPE        = 0xD1, // System Time Milliseconds
     ZCL_ELAPSED_S_ATTRIBUTE_TYPE         = 0xD2, // Elapsed Time Seconds
     ZCL_TEMPERATURE_ATTRIBUTE_TYPE       = 0xD8, // Temperature
+    ZCL_POWER_M_W_ATTRIBUTE_TYPE         = 0xD9, // Power milliwatts
+    ZCL_AMPERAGE_M_A_ATTRIBUTE_TYPE      = 0xDA, // Amperage milliamps
+    ZCL_VOLTAGE_M_V_ATTRIBUTE_TYPE       = 0xDB, // Voltage millivolts
+    ZCL_ENERGY_M_WH_ATTRIBUTE_TYPE       = 0xDC, // Energy milliwatt-hours
     ZCL_TOD_ATTRIBUTE_TYPE               = 0xE0, // Time of day
     ZCL_DATE_ATTRIBUTE_TYPE              = 0xE1, // Date
     ZCL_EPOCH_US_ATTRIBUTE_TYPE          = 0xE3, // Epoch Microseconds
diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp
index 1da947a4603420..329d3fe2711ade 100644
--- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp
+++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp
@@ -10604,7 +10604,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, int64_t value)
     Traits::StorageType storageValue;
     Traits::WorkingToStorage(value, storageValue);
     uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue);
-    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_INT64S_ATTRIBUTE_TYPE);
+    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_AMPERAGE_M_A_ATTRIBUTE_TYPE);
 }
 
 } // namespace CircuitCapacity
@@ -10635,7 +10635,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, int64_t value)
     Traits::StorageType storageValue;
     Traits::WorkingToStorage(value, storageValue);
     uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue);
-    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_INT64S_ATTRIBUTE_TYPE);
+    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_AMPERAGE_M_A_ATTRIBUTE_TYPE);
 }
 
 } // namespace MinimumChargeCurrent
@@ -10666,7 +10666,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, int64_t value)
     Traits::StorageType storageValue;
     Traits::WorkingToStorage(value, storageValue);
     uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue);
-    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_INT64S_ATTRIBUTE_TYPE);
+    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_AMPERAGE_M_A_ATTRIBUTE_TYPE);
 }
 
 } // namespace MaximumChargeCurrent
@@ -10697,7 +10697,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, int64_t value)
     Traits::StorageType storageValue;
     Traits::WorkingToStorage(value, storageValue);
     uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue);
-    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_INT64S_ATTRIBUTE_TYPE);
+    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_AMPERAGE_M_A_ATTRIBUTE_TYPE);
 }
 
 } // namespace MaximumDischargeCurrent
@@ -10728,7 +10728,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, int64_t value)
     Traits::StorageType storageValue;
     Traits::WorkingToStorage(value, storageValue);
     uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue);
-    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_INT64S_ATTRIBUTE_TYPE);
+    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_AMPERAGE_M_A_ATTRIBUTE_TYPE);
 }
 
 } // namespace UserMaximumChargeCurrent
@@ -10961,7 +10961,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, int64_t value)
     Traits::StorageType storageValue;
     Traits::WorkingToStorage(value, storageValue);
     uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue);
-    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_INT64S_ATTRIBUTE_TYPE);
+    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_M_WH_ATTRIBUTE_TYPE);
 }
 
 EmberAfStatus SetNull(chip::EndpointId endpoint)
@@ -10970,7 +10970,7 @@ EmberAfStatus SetNull(chip::EndpointId endpoint)
     Traits::StorageType value;
     Traits::SetNull(value);
     uint8_t * writable = Traits::ToAttributeStoreRepresentation(value);
-    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_INT64S_ATTRIBUTE_TYPE);
+    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_M_WH_ATTRIBUTE_TYPE);
 }
 
 EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable<int64_t> & value)
@@ -11173,7 +11173,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, int64_t value)
     Traits::StorageType storageValue;
     Traits::WorkingToStorage(value, storageValue);
     uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue);
-    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_INT64S_ATTRIBUTE_TYPE);
+    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_M_WH_ATTRIBUTE_TYPE);
 }
 
 EmberAfStatus SetNull(chip::EndpointId endpoint)
@@ -11182,7 +11182,7 @@ EmberAfStatus SetNull(chip::EndpointId endpoint)
     Traits::StorageType value;
     Traits::SetNull(value);
     uint8_t * writable = Traits::ToAttributeStoreRepresentation(value);
-    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_INT64S_ATTRIBUTE_TYPE);
+    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_M_WH_ATTRIBUTE_TYPE);
 }
 
 EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable<int64_t> & value)
@@ -11356,7 +11356,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, int64_t value)
     Traits::StorageType storageValue;
     Traits::WorkingToStorage(value, storageValue);
     uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue);
-    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_INT64S_ATTRIBUTE_TYPE);
+    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_M_WH_ATTRIBUTE_TYPE);
 }
 
 } // namespace SessionEnergyCharged
@@ -11387,7 +11387,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, int64_t value)
     Traits::StorageType storageValue;
     Traits::WorkingToStorage(value, storageValue);
     uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue);
-    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_INT64S_ATTRIBUTE_TYPE);
+    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_M_WH_ATTRIBUTE_TYPE);
 }
 
 } // namespace SessionEnergyDischarged
diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h
index 05505afea06d13..20da316a721554 100644
--- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h
+++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h
@@ -2038,27 +2038,27 @@ EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullabl
 } // namespace DischargingEnabledUntil
 
 namespace CircuitCapacity {
-EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // int64s
+EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // amperage_mA
 EmberAfStatus Set(chip::EndpointId endpoint, int64_t value);
 } // namespace CircuitCapacity
 
 namespace MinimumChargeCurrent {
-EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // int64s
+EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // amperage_mA
 EmberAfStatus Set(chip::EndpointId endpoint, int64_t value);
 } // namespace MinimumChargeCurrent
 
 namespace MaximumChargeCurrent {
-EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // int64s
+EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // amperage_mA
 EmberAfStatus Set(chip::EndpointId endpoint, int64_t value);
 } // namespace MaximumChargeCurrent
 
 namespace MaximumDischargeCurrent {
-EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // int64s
+EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // amperage_mA
 EmberAfStatus Set(chip::EndpointId endpoint, int64_t value);
 } // namespace MaximumDischargeCurrent
 
 namespace UserMaximumChargeCurrent {
-EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // int64s
+EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // amperage_mA
 EmberAfStatus Set(chip::EndpointId endpoint, int64_t value);
 } // namespace UserMaximumChargeCurrent
 
@@ -2092,7 +2092,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullabl
 } // namespace NextChargeTargetTime
 
 namespace NextChargeRequiredEnergy {
-EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable<int64_t> & value); // int64s
+EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable<int64_t> & value); // energy_mWh
 EmberAfStatus Set(chip::EndpointId endpoint, int64_t value);
 EmberAfStatus SetNull(chip::EndpointId endpoint);
 EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable<int64_t> & value);
@@ -2120,7 +2120,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullabl
 } // namespace StateOfCharge
 
 namespace BatteryCapacity {
-EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable<int64_t> & value); // int64s
+EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable<int64_t> & value); // energy_mWh
 EmberAfStatus Set(chip::EndpointId endpoint, int64_t value);
 EmberAfStatus SetNull(chip::EndpointId endpoint);
 EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable<int64_t> & value);
@@ -2146,12 +2146,12 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value);
 } // namespace SessionDuration
 
 namespace SessionEnergyCharged {
-EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // int64s
+EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // energy_mWh
 EmberAfStatus Set(chip::EndpointId endpoint, int64_t value);
 } // namespace SessionEnergyCharged
 
 namespace SessionEnergyDischarged {
-EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // int64s
+EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // energy_mWh
 EmberAfStatus Set(chip::EndpointId endpoint, int64_t value);
 } // namespace SessionEnergyDischarged
 

From c3aef3a35ee4d6256905b69ba03cd4105314f652 Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Wed, 29 Nov 2023 21:15:12 +0000
Subject: [PATCH 03/80] Added ember-compatibility-functions.cpp which was
 missing.

---
 src/app/util/ember-compatibility-functions.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/app/util/ember-compatibility-functions.cpp b/src/app/util/ember-compatibility-functions.cpp
index de08342c4f18f6..3cf10a86d3f169 100644
--- a/src/app/util/ember-compatibility-functions.cpp
+++ b/src/app/util/ember-compatibility-functions.cpp
@@ -123,6 +123,12 @@ EmberAfAttributeType BaseType(EmberAfAttributeType type)
                       "chip::DataVersion is expected to be uint32_t, change this when necessary");
         return ZCL_INT32U_ATTRIBUTE_TYPE;
 
+    case ZCL_AMPERAGE_M_A_ATTRIBUTE_TYPE: // Amperage milliamps
+    case ZCL_ENERGY_M_WH_ATTRIBUTE_TYPE:  // Energy milliwatt-hours
+    case ZCL_POWER_M_W_ATTRIBUTE_TYPE:    // Power milliwatts
+    case ZCL_VOLTAGE_M_V_ATTRIBUTE_TYPE:  // Voltage millivolts
+        return ZCL_INT64S_ATTRIBUTE_TYPE;
+
     case ZCL_EVENT_NO_ATTRIBUTE_TYPE:   // Event Number
     case ZCL_FABRIC_ID_ATTRIBUTE_TYPE:  // Fabric Id
     case ZCL_NODE_ID_ATTRIBUTE_TYPE:    // Node Id

From a71bef88c3584142c663fd3c17bb3defc1e4347e Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Wed, 29 Nov 2023 22:50:26 +0000
Subject: [PATCH 04/80] Made all types all lowercase to resolve regen_all
 issues.

---
 .../network-manager-app.matter                | 114 +++++++++---------
 .../matter_idl/generators/type_definitions.py |   8 +-
 .../util/ember-compatibility-functions.cpp    |   8 +-
 src/app/zap-templates/common/override.js      |   8 +-
 .../zcl/data-model/chip/chip-types.xml        |   8 +-
 .../data-model/chip/energy-evse-cluster.xml   |  34 +++---
 .../data_model/controller-clusters.matter     |  34 +++---
 .../app-common/zap-generated/attribute-type.h |   8 +-
 .../zap-generated/attributes/Accessors.cpp    |  22 ++--
 .../zap-generated/attributes/Accessors.h      |  18 +--
 .../zap-generated/cluster/Commands.h          |  35 +++---
 .../zap-generated/cluster/Commands.h          |   8 +-
 12 files changed, 151 insertions(+), 154 deletions(-)

diff --git a/examples/network-manager-app/network-manager-common/network-manager-app.matter b/examples/network-manager-app/network-manager-common/network-manager-app.matter
index b5760ecb46703b..a91e5664fcf32e 100644
--- a/examples/network-manager-app/network-manager-common/network-manager-app.matter
+++ b/examples/network-manager-app/network-manager-common/network-manager-app.matter
@@ -1178,11 +1178,11 @@ endpoint 0 {
     callback attribute serverList;
     callback attribute clientList;
     callback attribute partsList;
-    callback attribute generatedCommandList default = 0;
-    callback attribute acceptedCommandList default = 0;
-    callback attribute attributeList default = 0;
+    callback attribute generatedCommandList;
+    callback attribute acceptedCommandList;
+    callback attribute attributeList;
     ram      attribute featureMap default = 0;
-    callback attribute clusterRevision default = 1;
+    callback attribute clusterRevision;
   }
 
   server cluster AccessControl {
@@ -1190,32 +1190,32 @@ endpoint 0 {
     emits event AccessControlExtensionChanged;
     callback attribute acl;
     callback attribute extension;
-    callback attribute subjectsPerAccessControlEntry default = 4;
-    callback attribute targetsPerAccessControlEntry default = 3;
-    callback attribute accessControlEntriesPerFabric default = 3;
-    callback attribute generatedCommandList default = 0;
-    callback attribute acceptedCommandList default = 0;
+    callback attribute subjectsPerAccessControlEntry;
+    callback attribute targetsPerAccessControlEntry;
+    callback attribute accessControlEntriesPerFabric;
+    callback attribute generatedCommandList;
+    callback attribute acceptedCommandList;
     callback attribute attributeList;
     ram      attribute featureMap default = 0;
-    callback attribute clusterRevision default = 1;
+    callback attribute clusterRevision;
   }
 
   server cluster BasicInformation {
     emits event StartUp;
     emits event ShutDown;
     emits event Leave;
-    callback attribute dataModelRevision default = 10;
+    callback attribute dataModelRevision;
     callback attribute vendorName;
     callback attribute vendorID;
     callback attribute productName;
     callback attribute productID;
     persist  attribute nodeLabel;
-    callback attribute location default = "XX";
-    callback attribute hardwareVersion default = 0;
+    callback attribute location;
+    callback attribute hardwareVersion;
     callback attribute hardwareVersionString;
-    callback attribute softwareVersion default = 0;
+    callback attribute softwareVersion;
     callback attribute softwareVersionString;
-    callback attribute manufacturingDate default = "20210614123456ZZ";
+    callback attribute manufacturingDate;
     callback attribute partNumber;
     callback attribute productURL;
     callback attribute productLabel;
@@ -1226,9 +1226,9 @@ endpoint 0 {
     callback attribute capabilityMinima;
     callback attribute specificationVersion;
     callback attribute maxPathsPerInvoke;
-    callback attribute generatedCommandList default = 0;
-    callback attribute acceptedCommandList default = 0;
-    callback attribute attributeList default = 0;
+    callback attribute generatedCommandList;
+    callback attribute acceptedCommandList;
+    callback attribute attributeList;
     ram      attribute featureMap default = 0;
     ram      attribute clusterRevision default = 3;
   }
@@ -1236,12 +1236,12 @@ endpoint 0 {
   server cluster GeneralCommissioning {
     ram      attribute breadcrumb default = 0x0000000000000000;
     callback attribute basicCommissioningInfo;
-    callback attribute regulatoryConfig default = 0;
-    callback attribute locationCapability default = 0;
-    callback attribute supportsConcurrentConnection default = 1;
-    callback attribute generatedCommandList default = 0;
-    callback attribute acceptedCommandList default = 0;
-    callback attribute attributeList default = 0;
+    callback attribute regulatoryConfig;
+    callback attribute locationCapability;
+    callback attribute supportsConcurrentConnection;
+    callback attribute generatedCommandList;
+    callback attribute acceptedCommandList;
+    callback attribute attributeList;
     ram      attribute featureMap default = 0;
     ram      attribute clusterRevision default = 1;
 
@@ -1260,9 +1260,9 @@ endpoint 0 {
     callback attribute lastNetworkingStatus;
     callback attribute lastNetworkID;
     callback attribute lastConnectErrorValue;
-    callback attribute generatedCommandList default = 0;
-    callback attribute acceptedCommandList default = 0;
-    callback attribute attributeList default = 0;
+    callback attribute generatedCommandList;
+    callback attribute acceptedCommandList;
+    callback attribute attributeList;
     callback attribute featureMap default = 0;
     ram      attribute clusterRevision default = 1;
   }
@@ -1273,17 +1273,17 @@ endpoint 0 {
     emits event NetworkFaultChange;
     emits event BootReason;
     callback attribute networkInterfaces;
-    callback attribute rebootCount default = 0x0000;
-    callback attribute upTime default = 0x0000000000000000;
-    callback attribute totalOperationalHours default = 0x00000000;
+    callback attribute rebootCount;
+    callback attribute upTime;
+    callback attribute totalOperationalHours;
     callback attribute bootReason;
     callback attribute activeHardwareFaults;
     callback attribute activeRadioFaults;
     callback attribute activeNetworkFaults;
     callback attribute testEventTriggersEnabled default = false;
-    callback attribute generatedCommandList default = 0;
-    callback attribute acceptedCommandList default = 0;
-    callback attribute attributeList default = 0;
+    callback attribute generatedCommandList;
+    callback attribute acceptedCommandList;
+    callback attribute attributeList;
     ram      attribute featureMap default = 0;
     ram      attribute clusterRevision default = 0x0002;
 
@@ -1296,8 +1296,8 @@ endpoint 0 {
     callback attribute channel;
     callback attribute routingRole;
     callback attribute networkName;
-    callback attribute panId default = 0x0000;
-    callback attribute extendedPanId default = 0x0000000000000000;
+    callback attribute panId;
+    callback attribute extendedPanId;
     callback attribute meshLocalPrefix;
     callback attribute neighborTable;
     callback attribute routeTable;
@@ -1325,16 +1325,16 @@ endpoint 0 {
     callback attribute bssid;
     callback attribute securityType;
     callback attribute wiFiVersion;
-    callback attribute channelNumber default = 0x0000;
-    callback attribute rssi default = 0x00;
-    callback attribute beaconLostCount default = 0x00000000;
-    callback attribute beaconRxCount default = 0x00000000;
-    callback attribute packetMulticastRxCount default = 0x00000000;
-    callback attribute packetMulticastTxCount default = 0x00000000;
-    callback attribute packetUnicastRxCount default = 0x00000000;
-    callback attribute packetUnicastTxCount default = 0x00000000;
-    callback attribute currentMaxRate default = 0x0000000000000000;
-    callback attribute overrunCount default = 0x0000000000000000;
+    callback attribute channelNumber;
+    callback attribute rssi;
+    callback attribute beaconLostCount;
+    callback attribute beaconRxCount;
+    callback attribute packetMulticastRxCount;
+    callback attribute packetMulticastTxCount;
+    callback attribute packetUnicastRxCount;
+    callback attribute packetUnicastTxCount;
+    callback attribute currentMaxRate;
+    callback attribute overrunCount;
     ram      attribute featureMap default = 3;
     ram      attribute clusterRevision default = 1;
 
@@ -1352,12 +1352,12 @@ endpoint 0 {
   }
 
   server cluster AdministratorCommissioning {
-    callback attribute windowStatus default = 0;
-    callback attribute adminFabricIndex default = 1;
-    callback attribute adminVendorId default = 0;
-    callback attribute generatedCommandList default = 0;
-    callback attribute acceptedCommandList default = 0;
-    callback attribute attributeList default = 0;
+    callback attribute windowStatus;
+    callback attribute adminFabricIndex;
+    callback attribute adminVendorId;
+    callback attribute generatedCommandList;
+    callback attribute acceptedCommandList;
+    callback attribute attributeList;
     ram      attribute featureMap default = 0;
     ram      attribute clusterRevision default = 1;
 
@@ -1372,9 +1372,9 @@ endpoint 0 {
     callback attribute commissionedFabrics;
     callback attribute trustedRootCertificates;
     callback attribute currentFabricIndex;
-    callback attribute generatedCommandList default = 0;
-    callback attribute acceptedCommandList default = 0;
-    callback attribute attributeList default = 0;
+    callback attribute generatedCommandList;
+    callback attribute acceptedCommandList;
+    callback attribute attributeList;
     ram      attribute featureMap default = 0;
     ram      attribute clusterRevision default = 1;
 
@@ -1397,8 +1397,8 @@ endpoint 0 {
     callback attribute groupTable;
     callback attribute maxGroupsPerFabric;
     callback attribute maxGroupKeysPerFabric;
-    callback attribute featureMap default = 0;
-    callback attribute clusterRevision default = 1;
+    callback attribute featureMap;
+    callback attribute clusterRevision;
 
     handle command KeySetWrite;
     handle command KeySetRead;
@@ -1422,7 +1422,7 @@ endpoint 1 {
     callback attribute eventList;
     callback attribute attributeList;
     ram      attribute featureMap default = 0;
-    callback attribute clusterRevision default = 2;
+    callback attribute clusterRevision;
   }
 }
 
diff --git a/scripts/py_matter_idl/matter_idl/generators/type_definitions.py b/scripts/py_matter_idl/matter_idl/generators/type_definitions.py
index f244294b6bb192..6caf3a4dbd125c 100644
--- a/scripts/py_matter_idl/matter_idl/generators/type_definitions.py
+++ b/scripts/py_matter_idl/matter_idl/generators/type_definitions.py
@@ -190,7 +190,7 @@ def is_struct(self) -> bool:
     # Derived types
     # Specification describes them in section '7.18.2. Derived Data Types'
     "action_id": BasicInteger(idl_name="action_id", byte_count=1, is_signed=False),
-    "amperage_mA": BasicInteger(idl_name="amperage_mA", byte_count=8, is_signed=True),
+    "amperage_ma": BasicInteger(idl_name="amperage_ma", byte_count=8, is_signed=True),
     "attrib_id": BasicInteger(idl_name="attrib_id", byte_count=4, is_signed=False),
     "cluster_id": BasicInteger(idl_name="cluster_id", byte_count=4, is_signed=False),
     "command_id": BasicInteger(idl_name="command_id", byte_count=4, is_signed=False),
@@ -199,7 +199,7 @@ def is_struct(self) -> bool:
     "devtype_id": BasicInteger(idl_name="devtype_id", byte_count=4, is_signed=False),
     "elapsed_s": BasicInteger(idl_name="elapsed_s", byte_count=4, is_signed=False),
     "endpoint_no": BasicInteger(idl_name="endpoint_no", byte_count=2, is_signed=False),
-    "energy_mWh":  BasicInteger(idl_name="energy_mWh", byte_count=8, is_signed=True), 
+    "energy_mwh":  BasicInteger(idl_name="energy_mwh", byte_count=8, is_signed=True), 
     "entry_idx": BasicInteger(idl_name="entry_idx", byte_count=2, is_signed=False),
     "epoch_s": BasicInteger(idl_name="epoch_s", byte_count=4, is_signed=False),
     "epoch_us": BasicInteger(idl_name="epoch_us", byte_count=8, is_signed=False),
@@ -214,7 +214,7 @@ def is_struct(self) -> bool:
     "percent": BasicInteger(idl_name="percent", byte_count=1, is_signed=False),
     "percent100ths": BasicInteger(idl_name="percent100ths", byte_count=2, is_signed=False),
     "posix_ms": BasicInteger(idl_name="posix_ms", byte_count=8, is_signed=False),
-    "power_mW": BasicInteger(idl_name="power_mW", byte_count=8, is_signed=True),
+    "power_mw": BasicInteger(idl_name="power_mw", byte_count=8, is_signed=True),
     "priority": BasicInteger(idl_name="priority", byte_count=1, is_signed=False),
     "status": BasicInteger(idl_name="status", byte_count=2, is_signed=False),
     "systime_ms": BasicInteger(idl_name="systime_ms", byte_count=8, is_signed=False),
@@ -224,7 +224,7 @@ def is_struct(self) -> bool:
     "tod": BasicInteger(idl_name="tod", byte_count=4, is_signed=False),
     "trans_id": BasicInteger(idl_name="trans_id", byte_count=4, is_signed=False),
     "vendor_id": BasicInteger(idl_name="vendor_id", byte_count=2, is_signed=False),
-    "voltage_mV": BasicInteger(idl_name="voltage_mV", byte_count=8, is_signed=True),
+    "voltage_mv": BasicInteger(idl_name="voltage_mv", byte_count=8, is_signed=True),
 }
 
 
diff --git a/src/app/util/ember-compatibility-functions.cpp b/src/app/util/ember-compatibility-functions.cpp
index 3cf10a86d3f169..6a3c6fd5b0ada0 100644
--- a/src/app/util/ember-compatibility-functions.cpp
+++ b/src/app/util/ember-compatibility-functions.cpp
@@ -123,10 +123,10 @@ EmberAfAttributeType BaseType(EmberAfAttributeType type)
                       "chip::DataVersion is expected to be uint32_t, change this when necessary");
         return ZCL_INT32U_ATTRIBUTE_TYPE;
 
-    case ZCL_AMPERAGE_M_A_ATTRIBUTE_TYPE: // Amperage milliamps
-    case ZCL_ENERGY_M_WH_ATTRIBUTE_TYPE:  // Energy milliwatt-hours
-    case ZCL_POWER_M_W_ATTRIBUTE_TYPE:    // Power milliwatts
-    case ZCL_VOLTAGE_M_V_ATTRIBUTE_TYPE:  // Voltage millivolts
+    case ZCL_AMPERAGE_MA_ATTRIBUTE_TYPE: // Amperage milliamps
+    case ZCL_ENERGY_MWH_ATTRIBUTE_TYPE:  // Energy milliwatt-hours
+    case ZCL_POWER_MW_ATTRIBUTE_TYPE:    // Power milliwatts
+    case ZCL_VOLTAGE_MV_ATTRIBUTE_TYPE:  // Voltage millivolts
         return ZCL_INT64S_ATTRIBUTE_TYPE;
 
     case ZCL_EVENT_NO_ATTRIBUTE_TYPE:   // Event Number
diff --git a/src/app/zap-templates/common/override.js b/src/app/zap-templates/common/override.js
index de7bd90165bfc3..098af41e5154e2 100644
--- a/src/app/zap-templates/common/override.js
+++ b/src/app/zap-templates/common/override.js
@@ -74,10 +74,10 @@ function atomicType(arg)
     return 'chip::Percent';
   case 'percent100ths':
     return 'chip::Percent100ths';
-  case 'power_mW':
-  case 'amperage_mA':
-  case 'voltage_mV':
-  case 'energy_mWh':
+  case 'power_mw':
+  case 'amperage_ma':
+  case 'voltage_mv':
+  case 'energy_mwh':
     return 'int64_t';    
   case 'epoch_us':
   case 'systime_us':
diff --git a/src/app/zap-templates/zcl/data-model/chip/chip-types.xml b/src/app/zap-templates/zcl/data-model/chip/chip-types.xml
index 40b5fc808f5ba9..176b82722f2ecc 100644
--- a/src/app/zap-templates/zcl/data-model/chip/chip-types.xml
+++ b/src/app/zap-templates/zcl/data-model/chip/chip-types.xml
@@ -56,10 +56,10 @@ limitations under the License.
     <type id="0x42" description="Character String"         name="char_string"                 composite="true"/>
     <type id="0x44" description="Long Character String"    name="long_char_string"            composite="true"/>
 
-    <type id="0xD9" description="Power milliwatts"         name="power_mW"          size="8"  analog="true"   />
-    <type id="0xDA" description="Amperage milliamps"       name="amperage_mA"       size="8"  analog="true"   />
-    <type id="0xDB" description="Voltage millivolts"       name="voltage_mV"        size="8"  analog="true"   />
-    <type id="0xDC" description="Energy milliwatt-hours"   name="energy_mWh"        size="8"  analog="true"   />
+    <type id="0xD9" description="Power milliwatts"         name="power_mw"          size="8"  analog="true"   />
+    <type id="0xDA" description="Amperage milliamps"       name="amperage_ma"       size="8"  analog="true"   />
+    <type id="0xDB" description="Voltage millivolts"       name="voltage_mv"        size="8"  analog="true"   />
+    <type id="0xDC" description="Energy milliwatt-hours"   name="energy_mwh"        size="8"  analog="true"   />
 
     <type id="0xE6" description="Percentage units 1%"      name="percent"           size="1"  analog="true"   />
     <type id="0xE7" description="Percentage units 0.01%"   name="percent100ths"     size="2"  analog="true"   />
diff --git a/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml
index 6cd2a47dab50c5..83f44e37f1eaf4 100644
--- a/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml
+++ b/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml
@@ -71,7 +71,7 @@ limitations under the License.
     <cluster code="0x0099"/>
     <item fieldId="0" name="TargetTime" type="int16u" min="0" max="1439"/>
     <item fieldId="1" name="TargetSoC" type="percent" optional="true"/>
-    <item fieldId="2" name="AddedEnergy" type="energy_mWh" min="0" optional="true"/>
+    <item fieldId="2" name="AddedEnergy" type="energy_mwh" min="0" optional="true"/>
   </struct>
   <cluster apiMaturity="provisional">
     <name>Energy EVSE</name>
@@ -91,12 +91,12 @@ limitations under the License.
     <attribute code="0x0003" side="server" type="epoch_s" define="CHARGING_ENABLED_UNTIL" isNullable="true" default="0" writable="false" optional="false">ChargingEnabledUntil</attribute>
     <!--Conformance feature V2X - for now optional-->
     <attribute code="0x0004" side="server" type="epoch_s" define="DISCHARGING_ENABLED_UNTIL" isNullable="true" default="0" writable="false" optional="true">DischargingEnabledUntil</attribute>
-    <attribute code="0x0005" side="server" type="amperage_mA" define="CIRCUIT_CAPACITY" default="0" min="0" max="80000" writable="false" optional="false">CircuitCapacity</attribute>
-    <attribute code="0x0006" side="server" type="amperage_mA" define="MINIMUM_CHARGE_CURRENT" default="6000" min="0" max="80000" writable="false" optional="false">MinimumChargeCurrent</attribute>
-    <attribute code="0x0007" side="server" type="amperage_mA" define="MAXIMUM_CHARGE_CURRENT" default="0" min="0" max="80000" writable="false" optional="false">MaximumChargeCurrent</attribute>
+    <attribute code="0x0005" side="server" type="amperage_ma" define="CIRCUIT_CAPACITY" default="0" min="0" max="80000" writable="false" optional="false">CircuitCapacity</attribute>
+    <attribute code="0x0006" side="server" type="amperage_ma" define="MINIMUM_CHARGE_CURRENT" default="6000" min="0" max="80000" writable="false" optional="false">MinimumChargeCurrent</attribute>
+    <attribute code="0x0007" side="server" type="amperage_ma" define="MAXIMUM_CHARGE_CURRENT" default="0" min="0" max="80000" writable="false" optional="false">MaximumChargeCurrent</attribute>
     <!--Conformance feature V2X - for now optional-->
-    <attribute code="0x0008" side="server" type="amperage_mA" define="MAXIMUM_DISCHARGE_CURRENT" default="0" min="0" max="80000" writable="false" optional="true">MaximumDischargeCurrent</attribute>
-    <attribute code="0x0009" side="server" type="amperage_mA" define="USER_MAXIMUM_CHARGE_CURRENT" default="0" writable="true" optional="true">
+    <attribute code="0x0008" side="server" type="amperage_ma" define="MAXIMUM_DISCHARGE_CURRENT" default="0" min="0" max="80000" writable="false" optional="true">MaximumDischargeCurrent</attribute>
+    <attribute code="0x0009" side="server" type="amperage_ma" define="USER_MAXIMUM_CHARGE_CURRENT" default="0" writable="true" optional="true">
       <access op="read" privilege="view"/>
       <access op="write" privilege="manage"/>
       <description>UserMaximumChargeCurrent</description>
@@ -115,7 +115,7 @@ limitations under the License.
     <!--Conformance feature PREF - for now optional-->
     <attribute code="0x0024" side="server" type="epoch_s" define="NEXT_CHARGE_TARGET_TIME" isNullable="true" max="0xFFFFFFFE" writable="false" optional="true">NextChargeTargetTime</attribute>
     <!--Conformance feature PREF - for now optional-->
-    <attribute code="0x0025" side="server" type="energy_mWh" define="NEXT_CHARGE_REQUIRED_ENERGY" isNullable="true" min="0" writable="false" optional="true">NextChargeRequiredEnergy</attribute>
+    <attribute code="0x0025" side="server" type="energy_mwh" define="NEXT_CHARGE_REQUIRED_ENERGY" isNullable="true" min="0" writable="false" optional="true">NextChargeRequiredEnergy</attribute>
     <!--Conformance feature PREF - for now optional-->
     <attribute code="0x0026" side="server" type="percent" define="NEXT_CHARGE_TARGET_SOC" isNullable="true" max="100" writable="false" optional="true">NextChargeTargetSoC</attribute>
     <!--Conformance feature [PREF] - for now optional-->
@@ -127,26 +127,26 @@ limitations under the License.
     <!--Conformance feature SOC - for now optional-->
     <attribute code="0x0030" side="server" type="percent" define="STATE_OF_CHARGE" isNullable="true" max="100" writable="false" optional="true">StateOfCharge</attribute>
     <!--Conformance feature SOC - for now optional-->
-    <attribute code="0x0031" side="server" type="energy_mWh" define="BATTERY_CAPACITY" isNullable="true" min="0" writable="false" optional="true">BatteryCapacity</attribute>
+    <attribute code="0x0031" side="server" type="energy_mwh" define="BATTERY_CAPACITY" isNullable="true" min="0" writable="false" optional="true">BatteryCapacity</attribute>
     <!--Conformance feature PNC - for now optional-->
     <attribute code="0x0032" side="server" type="char_string" define="VEHICLE_ID" isNullable="true" length="32" writable="false" optional="true">VehicleID</attribute>
     <attribute code="0x0040" side="server" type="int32u" define="SESSION_ID" isNullable="true" default="0" min="1" max="0xFFFFFFFF" writable="false" optional="false">SessionID</attribute>
     <attribute code="0x0041" side="server" type="elapsed_s" define="SESSION_DURATION" default="0" writable="false" optional="false">SessionDuration</attribute>
-    <attribute code="0x0042" side="server" type="energy_mWh" define="SESSION_ENERGY_CHARGED" default="0" min="0" writable="false" optional="false">SessionEnergyCharged</attribute>
+    <attribute code="0x0042" side="server" type="energy_mwh" define="SESSION_ENERGY_CHARGED" default="0" min="0" writable="false" optional="false">SessionEnergyCharged</attribute>
     <!--Conformance feature V2X - for now optional-->
-    <attribute code="0x0043" side="server" type="energy_mWh" define="SESSION_ENERGY_DISCHARGED" default="0" min="0" writable="false" optional="true">SessionEnergyDischarged</attribute>
+    <attribute code="0x0043" side="server" type="energy_mwh" define="SESSION_ENERGY_DISCHARGED" default="0" min="0" writable="false" optional="true">SessionEnergyDischarged</attribute>
     <command source="client" code="0x0001" name="Disable" optional="false" mustUseTimedInvoke="true" apiMaturity="provisional">
       <description>Allows a client to disable the EVSE from charging and discharging.</description>
     </command>
     <command source="client" code="0x0002" name="EnableCharging" optional="false" mustUseTimedInvoke="true" apiMaturity="provisional">
       <arg name="ChargingEnabledUntil" type="epoch_s" max="0xFFFFFFFE" isNullable="true"/>
-      <arg name="MinimumChargeCurrent" type="amperage_mA" min="0" max="80000"/>
-      <arg name="MaximumChargeCurrent" type="amperage_mA" min="0" max="80000"/>
+      <arg name="MinimumChargeCurrent" type="amperage_ma" min="0" max="80000"/>
+      <arg name="MaximumChargeCurrent" type="amperage_ma" min="0" max="80000"/>
       <description>Allows a client to enable the EVSE to charge an EV.</description>
     </command>
     <command source="client" code="0x0003" name="EnableDischarging" optional="true" mustUseTimedInvoke="true" apiMaturity="provisional">
       <arg name="DischargingEnabledUntil" type="epoch_s" max="0xFFFFFFFE" isNullable="true"/>
-      <arg name="MaximumDischargeCurrent" type="amperage_mA" min="0" max="80000"/>
+      <arg name="MaximumDischargeCurrent" type="amperage_ma" min="0" max="80000"/>
       <description>Allows a client to enable the EVSE to discharge an EV.</description>
     </command>
     <command source="client" code="0x0004" name="StartDiagnostics" optional="true" mustUseTimedInvoke="true" apiMaturity="provisional">
@@ -178,21 +178,21 @@ limitations under the License.
       <field id="0" name="SessionID" type="int32u" min="1" max="0xFFFFFFFF" apiMaturity="provisional"/>
       <field id="1" name="State" type="StateEnum" apiMaturity="provisional"/>
       <field id="2" name="SessionDuration" type="elapsed_s" apiMaturity="provisional"/>
-      <field id="3" name="SessionEnergyCharged" type="energy_mWh" min="0" apiMaturity="provisional"/>
-      <field id="4" name="SessionEnergyDischarged" type="energy_mWh" min="0"  optional="true" apiMaturity="provisional"/>
+      <field id="3" name="SessionEnergyCharged" type="energy_mwh" min="0" apiMaturity="provisional"/>
+      <field id="4" name="SessionEnergyDischarged" type="energy_mwh" min="0"  optional="true" apiMaturity="provisional"/>
     </event>
     <event code="0x0002" name="EnergyTransferStarted" priority="info" apiMaturity="provisional">
       <description>EnergyTransferStarted</description>
       <field id="0" name="SessionID" type="int32u" min="1" max="0xFFFFFFFF" apiMaturity="provisional"/>
       <field id="1" name="State" type="StateEnum" apiMaturity="provisional"/>
-      <field id="2" name="MaximumCurrent" type="amperage_mA" min="0" max="80000" apiMaturity="provisional"/>
+      <field id="2" name="MaximumCurrent" type="amperage_ma" min="0" max="80000" apiMaturity="provisional"/>
     </event>
     <event code="0x0003" name="EnergyTransferStopped" priority="info" apiMaturity="provisional">
       <description>EnergyTransferStopped</description>
       <field id="0" name="SessionID" type="int32u" min="1" max="0xFFFFFFFF" apiMaturity="provisional"/>
       <field id="1" name="State" type="StateEnum" apiMaturity="provisional"/>
       <field id="2" name="Reason" type="EnergyTransferStoppedReasonEnum" apiMaturity="provisional"/>
-      <field id="4" name="EnergyTransferred" type="energy_mWh" min="0" apiMaturity="provisional"/>
+      <field id="4" name="EnergyTransferred" type="energy_mwh" min="0" apiMaturity="provisional"/>
     </event>
     <event code="0x0004" name="Fault" priority="critical" apiMaturity="provisional">
       <description>Fault</description>
diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter
index 33acf1e0c9616f..14a3fa22ab0809 100644
--- a/src/controller/data_model/controller-clusters.matter
+++ b/src/controller/data_model/controller-clusters.matter
@@ -4370,7 +4370,7 @@ provisional cluster EnergyEvse = 153 {
   struct ChargingTargetStruct {
     int16u targetTime = 0;
     optional percent targetSoC = 1;
-    optional energy_mWh addedEnergy = 2;
+    optional energy_mwh addedEnergy = 2;
   }
 
   info event EVConnected = 0 {
@@ -4381,21 +4381,21 @@ provisional cluster EnergyEvse = 153 {
     int32u sessionID = 0;
     StateEnum state = 1;
     elapsed_s sessionDuration = 2;
-    energy_mWh sessionEnergyCharged = 3;
-    optional energy_mWh sessionEnergyDischarged = 4;
+    energy_mwh sessionEnergyCharged = 3;
+    optional energy_mwh sessionEnergyDischarged = 4;
   }
 
   info event EnergyTransferStarted = 2 {
     int32u sessionID = 0;
     StateEnum state = 1;
-    amperage_mA maximumCurrent = 2;
+    amperage_ma maximumCurrent = 2;
   }
 
   info event EnergyTransferStopped = 3 {
     int32u sessionID = 0;
     StateEnum state = 1;
     EnergyTransferStoppedReasonEnum reason = 2;
-    energy_mWh energyTransferred = 4;
+    energy_mwh energyTransferred = 4;
   }
 
   critical event Fault = 4 {
@@ -4414,26 +4414,26 @@ provisional cluster EnergyEvse = 153 {
   readonly attribute FaultStateEnum faultState = 2;
   readonly attribute nullable epoch_s chargingEnabledUntil = 3;
   readonly attribute optional nullable epoch_s dischargingEnabledUntil = 4;
-  readonly attribute amperage_mA circuitCapacity = 5;
-  readonly attribute amperage_mA minimumChargeCurrent = 6;
-  readonly attribute amperage_mA maximumChargeCurrent = 7;
-  readonly attribute optional amperage_mA maximumDischargeCurrent = 8;
-  attribute access(write: manage) optional amperage_mA userMaximumChargeCurrent = 9;
+  readonly attribute amperage_ma circuitCapacity = 5;
+  readonly attribute amperage_ma minimumChargeCurrent = 6;
+  readonly attribute amperage_ma maximumChargeCurrent = 7;
+  readonly attribute optional amperage_ma maximumDischargeCurrent = 8;
+  attribute access(write: manage) optional amperage_ma userMaximumChargeCurrent = 9;
   attribute access(write: manage) optional elapsed_s randomizationDelayWindow = 10;
   readonly attribute optional int8u numberOfWeeklyTargets = 33;
   readonly attribute optional int8u numberOfDailyTargets = 34;
   readonly attribute optional nullable epoch_s nextChargeStartTime = 35;
   readonly attribute optional nullable epoch_s nextChargeTargetTime = 36;
-  readonly attribute optional nullable energy_mWh nextChargeRequiredEnergy = 37;
+  readonly attribute optional nullable energy_mwh nextChargeRequiredEnergy = 37;
   readonly attribute optional nullable percent nextChargeTargetSoC = 38;
   attribute access(write: manage) optional nullable int16u approximateEVEfficiency = 39;
   readonly attribute optional nullable percent stateOfCharge = 48;
-  readonly attribute optional nullable energy_mWh batteryCapacity = 49;
+  readonly attribute optional nullable energy_mwh batteryCapacity = 49;
   readonly attribute optional nullable char_string<32> vehicleID = 50;
   readonly attribute nullable int32u sessionID = 64;
   readonly attribute elapsed_s sessionDuration = 65;
-  readonly attribute energy_mWh sessionEnergyCharged = 66;
-  readonly attribute optional energy_mWh sessionEnergyDischarged = 67;
+  readonly attribute energy_mwh sessionEnergyCharged = 66;
+  readonly attribute optional energy_mwh sessionEnergyDischarged = 67;
   readonly attribute command_id generatedCommandList[] = 65528;
   readonly attribute command_id acceptedCommandList[] = 65529;
   readonly attribute event_id eventList[] = 65530;
@@ -4448,13 +4448,13 @@ provisional cluster EnergyEvse = 153 {
 
   request struct EnableChargingRequest {
     nullable epoch_s chargingEnabledUntil = 0;
-    amperage_mA minimumChargeCurrent = 1;
-    amperage_mA maximumChargeCurrent = 2;
+    amperage_ma minimumChargeCurrent = 1;
+    amperage_ma maximumChargeCurrent = 2;
   }
 
   request struct EnableDischargingRequest {
     nullable epoch_s dischargingEnabledUntil = 0;
-    amperage_mA maximumDischargeCurrent = 1;
+    amperage_ma maximumDischargeCurrent = 1;
   }
 
   request struct SetTargetsRequest {
diff --git a/zzz_generated/app-common/app-common/zap-generated/attribute-type.h b/zzz_generated/app-common/app-common/zap-generated/attribute-type.h
index 6b3b35cc4aa684..c89f71a91d4a21 100644
--- a/zzz_generated/app-common/app-common/zap-generated/attribute-type.h
+++ b/zzz_generated/app-common/app-common/zap-generated/attribute-type.h
@@ -74,10 +74,10 @@ enum
     ZCL_SYSTIME_MS_ATTRIBUTE_TYPE        = 0xD1, // System Time Milliseconds
     ZCL_ELAPSED_S_ATTRIBUTE_TYPE         = 0xD2, // Elapsed Time Seconds
     ZCL_TEMPERATURE_ATTRIBUTE_TYPE       = 0xD8, // Temperature
-    ZCL_POWER_M_W_ATTRIBUTE_TYPE         = 0xD9, // Power milliwatts
-    ZCL_AMPERAGE_M_A_ATTRIBUTE_TYPE      = 0xDA, // Amperage milliamps
-    ZCL_VOLTAGE_M_V_ATTRIBUTE_TYPE       = 0xDB, // Voltage millivolts
-    ZCL_ENERGY_M_WH_ATTRIBUTE_TYPE       = 0xDC, // Energy milliwatt-hours
+    ZCL_POWER_MW_ATTRIBUTE_TYPE          = 0xD9, // Power milliwatts
+    ZCL_AMPERAGE_MA_ATTRIBUTE_TYPE       = 0xDA, // Amperage milliamps
+    ZCL_VOLTAGE_MV_ATTRIBUTE_TYPE        = 0xDB, // Voltage millivolts
+    ZCL_ENERGY_MWH_ATTRIBUTE_TYPE        = 0xDC, // Energy milliwatt-hours
     ZCL_TOD_ATTRIBUTE_TYPE               = 0xE0, // Time of day
     ZCL_DATE_ATTRIBUTE_TYPE              = 0xE1, // Date
     ZCL_EPOCH_US_ATTRIBUTE_TYPE          = 0xE3, // Epoch Microseconds
diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp
index 329d3fe2711ade..728f9a5844b59c 100644
--- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp
+++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp
@@ -10604,7 +10604,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, int64_t value)
     Traits::StorageType storageValue;
     Traits::WorkingToStorage(value, storageValue);
     uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue);
-    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_AMPERAGE_M_A_ATTRIBUTE_TYPE);
+    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_AMPERAGE_MA_ATTRIBUTE_TYPE);
 }
 
 } // namespace CircuitCapacity
@@ -10635,7 +10635,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, int64_t value)
     Traits::StorageType storageValue;
     Traits::WorkingToStorage(value, storageValue);
     uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue);
-    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_AMPERAGE_M_A_ATTRIBUTE_TYPE);
+    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_AMPERAGE_MA_ATTRIBUTE_TYPE);
 }
 
 } // namespace MinimumChargeCurrent
@@ -10666,7 +10666,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, int64_t value)
     Traits::StorageType storageValue;
     Traits::WorkingToStorage(value, storageValue);
     uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue);
-    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_AMPERAGE_M_A_ATTRIBUTE_TYPE);
+    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_AMPERAGE_MA_ATTRIBUTE_TYPE);
 }
 
 } // namespace MaximumChargeCurrent
@@ -10697,7 +10697,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, int64_t value)
     Traits::StorageType storageValue;
     Traits::WorkingToStorage(value, storageValue);
     uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue);
-    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_AMPERAGE_M_A_ATTRIBUTE_TYPE);
+    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_AMPERAGE_MA_ATTRIBUTE_TYPE);
 }
 
 } // namespace MaximumDischargeCurrent
@@ -10728,7 +10728,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, int64_t value)
     Traits::StorageType storageValue;
     Traits::WorkingToStorage(value, storageValue);
     uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue);
-    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_AMPERAGE_M_A_ATTRIBUTE_TYPE);
+    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_AMPERAGE_MA_ATTRIBUTE_TYPE);
 }
 
 } // namespace UserMaximumChargeCurrent
@@ -10961,7 +10961,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, int64_t value)
     Traits::StorageType storageValue;
     Traits::WorkingToStorage(value, storageValue);
     uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue);
-    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_M_WH_ATTRIBUTE_TYPE);
+    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_MWH_ATTRIBUTE_TYPE);
 }
 
 EmberAfStatus SetNull(chip::EndpointId endpoint)
@@ -10970,7 +10970,7 @@ EmberAfStatus SetNull(chip::EndpointId endpoint)
     Traits::StorageType value;
     Traits::SetNull(value);
     uint8_t * writable = Traits::ToAttributeStoreRepresentation(value);
-    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_M_WH_ATTRIBUTE_TYPE);
+    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_MWH_ATTRIBUTE_TYPE);
 }
 
 EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable<int64_t> & value)
@@ -11173,7 +11173,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, int64_t value)
     Traits::StorageType storageValue;
     Traits::WorkingToStorage(value, storageValue);
     uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue);
-    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_M_WH_ATTRIBUTE_TYPE);
+    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_MWH_ATTRIBUTE_TYPE);
 }
 
 EmberAfStatus SetNull(chip::EndpointId endpoint)
@@ -11182,7 +11182,7 @@ EmberAfStatus SetNull(chip::EndpointId endpoint)
     Traits::StorageType value;
     Traits::SetNull(value);
     uint8_t * writable = Traits::ToAttributeStoreRepresentation(value);
-    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_M_WH_ATTRIBUTE_TYPE);
+    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_MWH_ATTRIBUTE_TYPE);
 }
 
 EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable<int64_t> & value)
@@ -11356,7 +11356,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, int64_t value)
     Traits::StorageType storageValue;
     Traits::WorkingToStorage(value, storageValue);
     uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue);
-    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_M_WH_ATTRIBUTE_TYPE);
+    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_MWH_ATTRIBUTE_TYPE);
 }
 
 } // namespace SessionEnergyCharged
@@ -11387,7 +11387,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, int64_t value)
     Traits::StorageType storageValue;
     Traits::WorkingToStorage(value, storageValue);
     uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue);
-    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_M_WH_ATTRIBUTE_TYPE);
+    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_MWH_ATTRIBUTE_TYPE);
 }
 
 } // namespace SessionEnergyDischarged
diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h
index 20da316a721554..68a10b448e4635 100644
--- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h
+++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h
@@ -2038,27 +2038,27 @@ EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullabl
 } // namespace DischargingEnabledUntil
 
 namespace CircuitCapacity {
-EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // amperage_mA
+EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // amperage_ma
 EmberAfStatus Set(chip::EndpointId endpoint, int64_t value);
 } // namespace CircuitCapacity
 
 namespace MinimumChargeCurrent {
-EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // amperage_mA
+EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // amperage_ma
 EmberAfStatus Set(chip::EndpointId endpoint, int64_t value);
 } // namespace MinimumChargeCurrent
 
 namespace MaximumChargeCurrent {
-EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // amperage_mA
+EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // amperage_ma
 EmberAfStatus Set(chip::EndpointId endpoint, int64_t value);
 } // namespace MaximumChargeCurrent
 
 namespace MaximumDischargeCurrent {
-EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // amperage_mA
+EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // amperage_ma
 EmberAfStatus Set(chip::EndpointId endpoint, int64_t value);
 } // namespace MaximumDischargeCurrent
 
 namespace UserMaximumChargeCurrent {
-EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // amperage_mA
+EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // amperage_ma
 EmberAfStatus Set(chip::EndpointId endpoint, int64_t value);
 } // namespace UserMaximumChargeCurrent
 
@@ -2092,7 +2092,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullabl
 } // namespace NextChargeTargetTime
 
 namespace NextChargeRequiredEnergy {
-EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable<int64_t> & value); // energy_mWh
+EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable<int64_t> & value); // energy_mwh
 EmberAfStatus Set(chip::EndpointId endpoint, int64_t value);
 EmberAfStatus SetNull(chip::EndpointId endpoint);
 EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable<int64_t> & value);
@@ -2120,7 +2120,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullabl
 } // namespace StateOfCharge
 
 namespace BatteryCapacity {
-EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable<int64_t> & value); // energy_mWh
+EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable<int64_t> & value); // energy_mwh
 EmberAfStatus Set(chip::EndpointId endpoint, int64_t value);
 EmberAfStatus SetNull(chip::EndpointId endpoint);
 EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable<int64_t> & value);
@@ -2146,12 +2146,12 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value);
 } // namespace SessionDuration
 
 namespace SessionEnergyCharged {
-EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // energy_mWh
+EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // energy_mwh
 EmberAfStatus Set(chip::EndpointId endpoint, int64_t value);
 } // namespace SessionEnergyCharged
 
 namespace SessionEnergyDischarged {
-EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // energy_mWh
+EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // energy_mwh
 EmberAfStatus Set(chip::EndpointId endpoint, int64_t value);
 } // namespace SessionEnergyDischarged
 
diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h
index 610e325a4e7dfa..7a93b0275e3029 100644
--- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h
+++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h
@@ -6903,8 +6903,8 @@ class EnergyEvseEnableCharging : public ClusterCommand
     EnergyEvseEnableCharging(CredentialIssuerCommands * credsIssuerConfig) : ClusterCommand("enable-charging", credsIssuerConfig)
     {
         AddArgument("ChargingEnabledUntil", 0, UINT32_MAX, &mRequest.chargingEnabledUntil);
-        AddArgument("MinimumChargeCurrent", INT64_MIN, INT64_MAX, &mRequest.minimumChargeCurrent);
-        AddArgument("MaximumChargeCurrent", INT64_MIN, INT64_MAX, &mRequest.maximumChargeCurrent);
+        AddArgument("MinimumChargeCurrent", 0, UINT64_MAX, &mRequest.minimumChargeCurrent);
+        AddArgument("MaximumChargeCurrent", 0, UINT64_MAX, &mRequest.maximumChargeCurrent);
         ClusterCommand::AddArguments();
     }
 
@@ -6943,7 +6943,7 @@ class EnergyEvseEnableDischarging : public ClusterCommand
         ClusterCommand("enable-discharging", credsIssuerConfig)
     {
         AddArgument("DischargingEnabledUntil", 0, UINT32_MAX, &mRequest.dischargingEnabledUntil);
-        AddArgument("MaximumDischargeCurrent", INT64_MIN, INT64_MAX, &mRequest.maximumDischargeCurrent);
+        AddArgument("MaximumDischargeCurrent", 0, UINT64_MAX, &mRequest.maximumDischargeCurrent);
         ClusterCommand::AddArguments();
     }
 
@@ -18446,18 +18446,16 @@ void registerClusterEnergyEvse(Commands & commands, CredentialIssuerCommands * c
         make_unique<WriteAttribute<chip::app::DataModel::Nullable<uint32_t>>>(Id, "discharging-enabled-until", 0, UINT32_MAX,
                                                                               Attributes::DischargingEnabledUntil::Id,
                                                                               WriteCommandType::kForceWrite, credsIssuerConfig), //
-        make_unique<WriteAttribute<int64_t>>(Id, "circuit-capacity", INT64_MIN, INT64_MAX, Attributes::CircuitCapacity::Id,
+        make_unique<WriteAttribute<int64_t>>(Id, "circuit-capacity", 0, UINT64_MAX, Attributes::CircuitCapacity::Id,
                                              WriteCommandType::kForceWrite, credsIssuerConfig), //
-        make_unique<WriteAttribute<int64_t>>(Id, "minimum-charge-current", INT64_MIN, INT64_MAX,
-                                             Attributes::MinimumChargeCurrent::Id, WriteCommandType::kForceWrite,
-                                             credsIssuerConfig), //
-        make_unique<WriteAttribute<int64_t>>(Id, "maximum-charge-current", INT64_MIN, INT64_MAX,
-                                             Attributes::MaximumChargeCurrent::Id, WriteCommandType::kForceWrite,
-                                             credsIssuerConfig), //
-        make_unique<WriteAttribute<int64_t>>(Id, "maximum-discharge-current", INT64_MIN, INT64_MAX,
+        make_unique<WriteAttribute<int64_t>>(Id, "minimum-charge-current", 0, UINT64_MAX, Attributes::MinimumChargeCurrent::Id,
+                                             WriteCommandType::kForceWrite, credsIssuerConfig), //
+        make_unique<WriteAttribute<int64_t>>(Id, "maximum-charge-current", 0, UINT64_MAX, Attributes::MaximumChargeCurrent::Id,
+                                             WriteCommandType::kForceWrite, credsIssuerConfig), //
+        make_unique<WriteAttribute<int64_t>>(Id, "maximum-discharge-current", 0, UINT64_MAX,
                                              Attributes::MaximumDischargeCurrent::Id, WriteCommandType::kForceWrite,
                                              credsIssuerConfig), //
-        make_unique<WriteAttribute<int64_t>>(Id, "user-maximum-charge-current", INT64_MIN, INT64_MAX,
+        make_unique<WriteAttribute<int64_t>>(Id, "user-maximum-charge-current", 0, UINT64_MAX,
                                              Attributes::UserMaximumChargeCurrent::Id, WriteCommandType::kWrite,
                                              credsIssuerConfig), //
         make_unique<WriteAttribute<uint32_t>>(Id, "randomization-delay-window", 0, UINT32_MAX,
@@ -18473,8 +18471,8 @@ void registerClusterEnergyEvse(Commands & commands, CredentialIssuerCommands * c
         make_unique<WriteAttribute<chip::app::DataModel::Nullable<uint32_t>>>(Id, "next-charge-target-time", 0, UINT32_MAX,
                                                                               Attributes::NextChargeTargetTime::Id,
                                                                               WriteCommandType::kForceWrite, credsIssuerConfig), //
-        make_unique<WriteAttribute<chip::app::DataModel::Nullable<int64_t>>>(Id, "next-charge-required-energy", INT64_MIN,
-                                                                             INT64_MAX, Attributes::NextChargeRequiredEnergy::Id,
+        make_unique<WriteAttribute<chip::app::DataModel::Nullable<int64_t>>>(Id, "next-charge-required-energy", 0, UINT64_MAX,
+                                                                             Attributes::NextChargeRequiredEnergy::Id,
                                                                              WriteCommandType::kForceWrite, credsIssuerConfig), //
         make_unique<WriteAttribute<chip::app::DataModel::Nullable<chip::Percent>>>(
             Id, "next-charge-target-so-c", 0, UINT8_MAX, Attributes::NextChargeTargetSoC::Id, WriteCommandType::kForceWrite,
@@ -18485,7 +18483,7 @@ void registerClusterEnergyEvse(Commands & commands, CredentialIssuerCommands * c
         make_unique<WriteAttribute<chip::app::DataModel::Nullable<chip::Percent>>>(
             Id, "state-of-charge", 0, UINT8_MAX, Attributes::StateOfCharge::Id, WriteCommandType::kForceWrite,
             credsIssuerConfig), //
-        make_unique<WriteAttribute<chip::app::DataModel::Nullable<int64_t>>>(Id, "battery-capacity", INT64_MIN, INT64_MAX,
+        make_unique<WriteAttribute<chip::app::DataModel::Nullable<int64_t>>>(Id, "battery-capacity", 0, UINT64_MAX,
                                                                              Attributes::BatteryCapacity::Id,
                                                                              WriteCommandType::kForceWrite, credsIssuerConfig), //
         make_unique<WriteAttribute<chip::app::DataModel::Nullable<chip::CharSpan>>>(
@@ -18494,10 +18492,9 @@ void registerClusterEnergyEvse(Commands & commands, CredentialIssuerCommands * c
             Id, "session-id", 0, UINT32_MAX, Attributes::SessionID::Id, WriteCommandType::kForceWrite, credsIssuerConfig), //
         make_unique<WriteAttribute<uint32_t>>(Id, "session-duration", 0, UINT32_MAX, Attributes::SessionDuration::Id,
                                               WriteCommandType::kForceWrite, credsIssuerConfig), //
-        make_unique<WriteAttribute<int64_t>>(Id, "session-energy-charged", INT64_MIN, INT64_MAX,
-                                             Attributes::SessionEnergyCharged::Id, WriteCommandType::kForceWrite,
-                                             credsIssuerConfig), //
-        make_unique<WriteAttribute<int64_t>>(Id, "session-energy-discharged", INT64_MIN, INT64_MAX,
+        make_unique<WriteAttribute<int64_t>>(Id, "session-energy-charged", 0, UINT64_MAX, Attributes::SessionEnergyCharged::Id,
+                                             WriteCommandType::kForceWrite, credsIssuerConfig), //
+        make_unique<WriteAttribute<int64_t>>(Id, "session-energy-discharged", 0, UINT64_MAX,
                                              Attributes::SessionEnergyDischarged::Id, WriteCommandType::kForceWrite,
                                              credsIssuerConfig), //
         make_unique<WriteAttributeAsComplex<chip::app::DataModel::List<const chip::CommandId>>>(
diff --git a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h
index 4358b5753c47c4..393fdbb30bba9c 100644
--- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h
+++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h
@@ -77912,10 +77912,10 @@ class EnergyEvseEnableCharging : public ClusterCommand {
         AddArgument("ChargingEnabledUntil", 0, UINT32_MAX, &mRequest.chargingEnabledUntil);
 #endif // MTR_ENABLE_PROVISIONAL
 #if MTR_ENABLE_PROVISIONAL
-        AddArgument("MinimumChargeCurrent", INT64_MIN, INT64_MAX, &mRequest.minimumChargeCurrent);
+        AddArgument("MinimumChargeCurrent", 0, UINT64_MAX, &mRequest.minimumChargeCurrent);
 #endif // MTR_ENABLE_PROVISIONAL
 #if MTR_ENABLE_PROVISIONAL
-        AddArgument("MaximumChargeCurrent", INT64_MIN, INT64_MAX, &mRequest.maximumChargeCurrent);
+        AddArgument("MaximumChargeCurrent", 0, UINT64_MAX, &mRequest.maximumChargeCurrent);
 #endif // MTR_ENABLE_PROVISIONAL
         ClusterCommand::AddArguments();
     }
@@ -77981,7 +77981,7 @@ class EnergyEvseEnableDischarging : public ClusterCommand {
         AddArgument("DischargingEnabledUntil", 0, UINT32_MAX, &mRequest.dischargingEnabledUntil);
 #endif // MTR_ENABLE_PROVISIONAL
 #if MTR_ENABLE_PROVISIONAL
-        AddArgument("MaximumDischargeCurrent", INT64_MIN, INT64_MAX, &mRequest.maximumDischargeCurrent);
+        AddArgument("MaximumDischargeCurrent", 0, UINT64_MAX, &mRequest.maximumDischargeCurrent);
 #endif // MTR_ENABLE_PROVISIONAL
         ClusterCommand::AddArguments();
     }
@@ -79073,7 +79073,7 @@ class WriteEnergyEvseUserMaximumChargeCurrent : public WriteAttribute {
         : WriteAttribute("user-maximum-charge-current")
     {
         AddArgument("attr-name", "user-maximum-charge-current");
-        AddArgument("attr-value", INT64_MIN, INT64_MAX, &mValue);
+        AddArgument("attr-value", 0, UINT64_MAX, &mValue);
         WriteAttribute::AddArguments();
     }
 

From 41acd01710b55e8c9091376010a058813c6db848 Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Wed, 29 Nov 2023 23:03:59 +0000
Subject: [PATCH 05/80] Fixed lint issue (trailing whitespace).

---
 scripts/py_matter_idl/matter_idl/generators/type_definitions.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/py_matter_idl/matter_idl/generators/type_definitions.py b/scripts/py_matter_idl/matter_idl/generators/type_definitions.py
index 6caf3a4dbd125c..9bfe20f455c110 100644
--- a/scripts/py_matter_idl/matter_idl/generators/type_definitions.py
+++ b/scripts/py_matter_idl/matter_idl/generators/type_definitions.py
@@ -199,7 +199,7 @@ def is_struct(self) -> bool:
     "devtype_id": BasicInteger(idl_name="devtype_id", byte_count=4, is_signed=False),
     "elapsed_s": BasicInteger(idl_name="elapsed_s", byte_count=4, is_signed=False),
     "endpoint_no": BasicInteger(idl_name="endpoint_no", byte_count=2, is_signed=False),
-    "energy_mwh":  BasicInteger(idl_name="energy_mwh", byte_count=8, is_signed=True), 
+    "energy_mwh":  BasicInteger(idl_name="energy_mwh", byte_count=8, is_signed=True),
     "entry_idx": BasicInteger(idl_name="entry_idx", byte_count=2, is_signed=False),
     "epoch_s": BasicInteger(idl_name="epoch_s", byte_count=4, is_signed=False),
     "epoch_us": BasicInteger(idl_name="epoch_us", byte_count=8, is_signed=False),

From e12cf09b6470e67b3313fa933978f5107a2fcb32 Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Mon, 4 Dec 2023 10:44:05 +0000
Subject: [PATCH 06/80] Fixes #30727 - Added initial EVSE cluster and Example
 Energy Managament app.

---
 .../energy-management-common/BUILD.gn         |   28 +
 .../energy-management-app.matter              | 1408 +++++++
 .../energy-management-app.zap                 | 3307 +++++++++++++++++
 .../include/EVSEManufacturerImpl.h            |   52 +
 .../include/EnergyEvseDelegateImpl.h          |  194 +
 .../include/EnergyEvseManager.h               |   60 +
 .../include/EnergyManagementManager.h         |   26 +
 .../src/EVSEManufacturerImpl.cpp              |   51 +
 .../src/EnergyEvseDelegateImpl.cpp            |  711 ++++
 .../src/EnergyEvseManager.cpp                 |   39 +
 .../src/EnergyManagementManager.cpp           |   18 +
 examples/energy-management-app/linux/.gn      |   25 +
 examples/energy-management-app/linux/BUILD.gn |  125 +
 .../energy-management-app/linux/README.md     |  143 +
 examples/energy-management-app/linux/args.gni |   31 +
 .../linux/build_overrides                     |    1 +
 .../linux/include/CHIPProjectAppConfig.h      |   49 +
 examples/energy-management-app/linux/main.cpp |   97 +
 .../linux/third_party/connectedhomeip         |    1 +
 .../energy-evse-server/energy-evse-server.cpp |  330 ++
 .../energy-evse-server/energy-evse-server.h   |  164 +
 21 files changed, 6860 insertions(+)
 create mode 100644 examples/energy-management-app/energy-management-common/BUILD.gn
 create mode 100644 examples/energy-management-app/energy-management-common/energy-management-app.matter
 create mode 100644 examples/energy-management-app/energy-management-common/energy-management-app.zap
 create mode 100644 examples/energy-management-app/energy-management-common/include/EVSEManufacturerImpl.h
 create mode 100644 examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h
 create mode 100644 examples/energy-management-app/energy-management-common/include/EnergyEvseManager.h
 create mode 100644 examples/energy-management-app/energy-management-common/include/EnergyManagementManager.h
 create mode 100644 examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp
 create mode 100644 examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
 create mode 100644 examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp
 create mode 100644 examples/energy-management-app/energy-management-common/src/EnergyManagementManager.cpp
 create mode 100644 examples/energy-management-app/linux/.gn
 create mode 100644 examples/energy-management-app/linux/BUILD.gn
 create mode 100644 examples/energy-management-app/linux/README.md
 create mode 100644 examples/energy-management-app/linux/args.gni
 create mode 120000 examples/energy-management-app/linux/build_overrides
 create mode 100644 examples/energy-management-app/linux/include/CHIPProjectAppConfig.h
 create mode 100644 examples/energy-management-app/linux/main.cpp
 create mode 120000 examples/energy-management-app/linux/third_party/connectedhomeip
 create mode 100644 src/app/clusters/energy-evse-server/energy-evse-server.cpp
 create mode 100644 src/app/clusters/energy-evse-server/energy-evse-server.h

diff --git a/examples/energy-management-app/energy-management-common/BUILD.gn b/examples/energy-management-app/energy-management-common/BUILD.gn
new file mode 100644
index 00000000000000..8c681d70500ccc
--- /dev/null
+++ b/examples/energy-management-app/energy-management-common/BUILD.gn
@@ -0,0 +1,28 @@
+# 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.
+
+import("//build_overrides/chip.gni")
+import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")
+import("${chip_root}/src/app/chip_data_model.gni")
+
+config("config") {
+  include_dirs = [ "include" ]
+}
+
+chip_data_model("energy-management-common") {
+  zap_file = "energy-management-app.zap"
+
+  zap_pregenerated_dir = "${chip_root}/zzz_generated/energy-management-app/zap-generated"
+  is_server = true
+}
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
new file mode 100644
index 00000000000000..a29bb693e4f5cf
--- /dev/null
+++ b/examples/energy-management-app/energy-management-common/energy-management-app.matter
@@ -0,0 +1,1408 @@
+// This IDL was generated automatically by ZAP.
+// It is for view/code review purposes only.
+
+/** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */
+cluster Identify = 3 {
+  revision 4;
+
+  enum EffectIdentifierEnum : enum8 {
+    kBlink = 0;
+    kBreathe = 1;
+    kOkay = 2;
+    kChannelChange = 11;
+    kFinishEffect = 254;
+    kStopEffect = 255;
+  }
+
+  enum EffectVariantEnum : enum8 {
+    kDefault = 0;
+  }
+
+  enum IdentifyTypeEnum : enum8 {
+    kNone = 0;
+    kLightOutput = 1;
+    kVisibleIndicator = 2;
+    kAudibleBeep = 3;
+    kDisplay = 4;
+    kActuator = 5;
+  }
+
+  attribute int16u identifyTime = 0;
+  readonly attribute IdentifyTypeEnum identifyType = 1;
+  readonly attribute command_id generatedCommandList[] = 65528;
+  readonly attribute command_id acceptedCommandList[] = 65529;
+  readonly attribute event_id eventList[] = 65530;
+  readonly attribute attrib_id attributeList[] = 65531;
+  readonly attribute bitmap32 featureMap = 65532;
+  readonly attribute int16u clusterRevision = 65533;
+
+  request struct IdentifyRequest {
+    int16u identifyTime = 0;
+  }
+
+  request struct TriggerEffectRequest {
+    EffectIdentifierEnum effectIdentifier = 0;
+    EffectVariantEnum effectVariant = 1;
+  }
+
+  /** Command description for Identify */
+  command access(invoke: manage) Identify(IdentifyRequest): DefaultSuccess = 0;
+  /** Command description for TriggerEffect */
+  command access(invoke: manage) TriggerEffect(TriggerEffectRequest): DefaultSuccess = 64;
+}
+
+/** The Descriptor Cluster is meant to replace the support from the Zigbee Device Object (ZDO) for describing a node, its endpoints and clusters. */
+cluster Descriptor = 29 {
+  revision 2;
+
+  bitmap Feature : bitmap32 {
+    kTagList = 0x1;
+  }
+
+  struct DeviceTypeStruct {
+    devtype_id deviceType = 0;
+    int16u revision = 1;
+  }
+
+  struct SemanticTagStruct {
+    nullable vendor_id mfgCode = 0;
+    enum8 namespaceID = 1;
+    enum8 tag = 2;
+    optional nullable char_string label = 3;
+  }
+
+  readonly attribute DeviceTypeStruct deviceTypeList[] = 0;
+  readonly attribute cluster_id serverList[] = 1;
+  readonly attribute cluster_id clientList[] = 2;
+  readonly attribute endpoint_no partsList[] = 3;
+  readonly attribute optional SemanticTagStruct tagList[] = 4;
+  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;
+}
+
+/** The Access Control Cluster exposes a data model view of a
+      Node's Access Control List (ACL), which codifies the rules used to manage
+      and enforce Access Control for the Node's endpoints and their associated
+      cluster instances. */
+cluster AccessControl = 31 {
+  revision 1; // NOTE: Default/not specifically set
+
+  enum AccessControlEntryAuthModeEnum : enum8 {
+    kPASE = 1;
+    kCASE = 2;
+    kGroup = 3;
+  }
+
+  enum AccessControlEntryPrivilegeEnum : enum8 {
+    kView = 1;
+    kProxyView = 2;
+    kOperate = 3;
+    kManage = 4;
+    kAdminister = 5;
+  }
+
+  enum ChangeTypeEnum : enum8 {
+    kChanged = 0;
+    kAdded = 1;
+    kRemoved = 2;
+  }
+
+  struct AccessControlTargetStruct {
+    nullable cluster_id cluster = 0;
+    nullable endpoint_no endpoint = 1;
+    nullable devtype_id deviceType = 2;
+  }
+
+  fabric_scoped struct AccessControlEntryStruct {
+    fabric_sensitive AccessControlEntryPrivilegeEnum privilege = 1;
+    fabric_sensitive AccessControlEntryAuthModeEnum authMode = 2;
+    nullable fabric_sensitive int64u subjects[] = 3;
+    nullable fabric_sensitive AccessControlTargetStruct targets[] = 4;
+    fabric_idx fabricIndex = 254;
+  }
+
+  fabric_scoped struct AccessControlExtensionStruct {
+    fabric_sensitive octet_string<128> data = 1;
+    fabric_idx fabricIndex = 254;
+  }
+
+  fabric_sensitive info event access(read: administer) AccessControlEntryChanged = 0 {
+    nullable node_id adminNodeID = 1;
+    nullable int16u adminPasscodeID = 2;
+    ChangeTypeEnum changeType = 3;
+    nullable AccessControlEntryStruct latestValue = 4;
+    fabric_idx fabricIndex = 254;
+  }
+
+  fabric_sensitive info event access(read: administer) AccessControlExtensionChanged = 1 {
+    nullable node_id adminNodeID = 1;
+    nullable int16u adminPasscodeID = 2;
+    ChangeTypeEnum changeType = 3;
+    nullable AccessControlExtensionStruct latestValue = 4;
+    fabric_idx fabricIndex = 254;
+  }
+
+  attribute access(read: administer, write: administer) AccessControlEntryStruct acl[] = 0;
+  attribute access(read: administer, write: administer) optional AccessControlExtensionStruct extension[] = 1;
+  readonly attribute int16u subjectsPerAccessControlEntry = 2;
+  readonly attribute int16u targetsPerAccessControlEntry = 3;
+  readonly attribute int16u accessControlEntriesPerFabric = 4;
+  readonly attribute command_id generatedCommandList[] = 65528;
+  readonly attribute command_id acceptedCommandList[] = 65529;
+  readonly attribute event_id eventList[] = 65530;
+  readonly attribute attrib_id attributeList[] = 65531;
+  readonly attribute bitmap32 featureMap = 65532;
+  readonly attribute int16u clusterRevision = 65533;
+}
+
+/** This cluster provides attributes and events for determining basic information about Nodes, which supports both
+      Commissioning and operational determination of Node characteristics, such as Vendor ID, Product ID and serial number,
+      which apply to the whole Node. Also allows setting user device information such as location. */
+cluster BasicInformation = 40 {
+  revision 3;
+
+  enum ColorEnum : enum8 {
+    kBlack = 0;
+    kNavy = 1;
+    kGreen = 2;
+    kTeal = 3;
+    kMaroon = 4;
+    kPurple = 5;
+    kOlive = 6;
+    kGray = 7;
+    kBlue = 8;
+    kLime = 9;
+    kAqua = 10;
+    kRed = 11;
+    kFuchsia = 12;
+    kYellow = 13;
+    kWhite = 14;
+    kNickel = 15;
+    kChrome = 16;
+    kBrass = 17;
+    kCopper = 18;
+    kSilver = 19;
+    kGold = 20;
+  }
+
+  enum ProductFinishEnum : enum8 {
+    kOther = 0;
+    kMatte = 1;
+    kSatin = 2;
+    kPolished = 3;
+    kRugged = 4;
+    kFabric = 5;
+  }
+
+  struct CapabilityMinimaStruct {
+    int16u caseSessionsPerFabric = 0;
+    int16u subscriptionsPerFabric = 1;
+  }
+
+  struct ProductAppearanceStruct {
+    ProductFinishEnum finish = 0;
+    nullable ColorEnum primaryColor = 1;
+  }
+
+  critical event StartUp = 0 {
+    int32u softwareVersion = 0;
+  }
+
+  critical event ShutDown = 1 {
+  }
+
+  info event Leave = 2 {
+    fabric_idx fabricIndex = 0;
+  }
+
+  info event ReachableChanged = 3 {
+    boolean reachableNewValue = 0;
+  }
+
+  readonly attribute int16u dataModelRevision = 0;
+  readonly attribute char_string<32> vendorName = 1;
+  readonly attribute vendor_id vendorID = 2;
+  readonly attribute char_string<32> productName = 3;
+  readonly attribute int16u productID = 4;
+  attribute access(write: manage) char_string<32> nodeLabel = 5;
+  attribute access(write: administer) char_string<2> location = 6;
+  readonly attribute int16u hardwareVersion = 7;
+  readonly attribute char_string<64> hardwareVersionString = 8;
+  readonly attribute int32u softwareVersion = 9;
+  readonly attribute char_string<64> softwareVersionString = 10;
+  readonly attribute optional char_string<16> manufacturingDate = 11;
+  readonly attribute optional char_string<32> partNumber = 12;
+  readonly attribute optional long_char_string<256> productURL = 13;
+  readonly attribute optional char_string<64> productLabel = 14;
+  readonly attribute optional char_string<32> serialNumber = 15;
+  attribute access(write: manage) optional boolean localConfigDisabled = 16;
+  readonly attribute optional boolean reachable = 17;
+  readonly attribute optional char_string<32> uniqueID = 18;
+  readonly attribute CapabilityMinimaStruct capabilityMinima = 19;
+  readonly attribute optional ProductAppearanceStruct productAppearance = 20;
+  readonly attribute int32u specificationVersion = 21;
+  readonly attribute int16u maxPathsPerInvoke = 22;
+  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;
+
+  command MfgSpecificPing(): DefaultSuccess = 0;
+}
+
+/** Nodes should be expected to be deployed to any and all regions of the world. These global regions
+      may have differing common languages, units of measurements, and numerical formatting
+      standards. As such, Nodes that visually or audibly convey information need a mechanism by which
+      they can be configured to use a user’s preferred language, units, etc */
+cluster LocalizationConfiguration = 43 {
+  revision 1; // NOTE: Default/not specifically set
+
+  attribute access(write: manage) char_string<35> activeLocale = 0;
+  readonly attribute char_string supportedLocales[] = 1;
+  readonly attribute command_id generatedCommandList[] = 65528;
+  readonly attribute command_id acceptedCommandList[] = 65529;
+  readonly attribute event_id eventList[] = 65530;
+  readonly attribute attrib_id attributeList[] = 65531;
+  readonly attribute bitmap32 featureMap = 65532;
+  readonly attribute int16u clusterRevision = 65533;
+}
+
+/** Nodes should be expected to be deployed to any and all regions of the world. These global regions
+      may have differing preferences for how dates and times are conveyed. As such, Nodes that visually
+      or audibly convey time information need a mechanism by which they can be configured to use a
+      user’s preferred format. */
+cluster TimeFormatLocalization = 44 {
+  revision 1; // NOTE: Default/not specifically set
+
+  enum CalendarTypeEnum : enum8 {
+    kBuddhist = 0;
+    kChinese = 1;
+    kCoptic = 2;
+    kEthiopian = 3;
+    kGregorian = 4;
+    kHebrew = 5;
+    kIndian = 6;
+    kIslamic = 7;
+    kJapanese = 8;
+    kKorean = 9;
+    kPersian = 10;
+    kTaiwanese = 11;
+  }
+
+  enum HourFormatEnum : enum8 {
+    k12hr = 0;
+    k24hr = 1;
+  }
+
+  bitmap Feature : bitmap32 {
+    kCalendarFormat = 0x1;
+  }
+
+  attribute access(write: manage) HourFormatEnum hourFormat = 0;
+  attribute access(write: manage) optional CalendarTypeEnum activeCalendarType = 1;
+  readonly attribute optional CalendarTypeEnum supportedCalendarTypes[] = 2;
+  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;
+}
+
+/** Nodes should be expected to be deployed to any and all regions of the world. These global regions
+      may have differing preferences for the units in which values are conveyed in communication to a
+      user. As such, Nodes that visually or audibly convey measurable values to the user need a
+      mechanism by which they can be configured to use a user’s preferred unit. */
+cluster UnitLocalization = 45 {
+  revision 1;
+
+  enum TempUnitEnum : enum8 {
+    kFahrenheit = 0;
+    kCelsius = 1;
+    kKelvin = 2;
+  }
+
+  bitmap Feature : bitmap32 {
+    kTemperatureUnit = 0x1;
+  }
+
+  attribute access(write: manage) optional TempUnitEnum temperatureUnit = 0;
+  readonly attribute command_id generatedCommandList[] = 65528;
+  readonly attribute command_id acceptedCommandList[] = 65529;
+  readonly attribute event_id eventList[] = 65530;
+  readonly attribute attrib_id attributeList[] = 65531;
+  readonly attribute bitmap32 featureMap = 65532;
+  readonly attribute int16u clusterRevision = 65533;
+}
+
+/** This cluster is used to manage global aspects of the Commissioning flow. */
+cluster GeneralCommissioning = 48 {
+  revision 1; // NOTE: Default/not specifically set
+
+  enum CommissioningErrorEnum : enum8 {
+    kOK = 0;
+    kValueOutsideRange = 1;
+    kInvalidAuthentication = 2;
+    kNoFailSafe = 3;
+    kBusyWithOtherAdmin = 4;
+  }
+
+  enum RegulatoryLocationTypeEnum : enum8 {
+    kIndoor = 0;
+    kOutdoor = 1;
+    kIndoorOutdoor = 2;
+  }
+
+  struct BasicCommissioningInfo {
+    int16u failSafeExpiryLengthSeconds = 0;
+    int16u maxCumulativeFailsafeSeconds = 1;
+  }
+
+  attribute access(write: administer) int64u breadcrumb = 0;
+  readonly attribute BasicCommissioningInfo basicCommissioningInfo = 1;
+  readonly attribute RegulatoryLocationTypeEnum regulatoryConfig = 2;
+  readonly attribute RegulatoryLocationTypeEnum locationCapability = 3;
+  readonly attribute boolean supportsConcurrentConnection = 4;
+  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 ArmFailSafeRequest {
+    int16u expiryLengthSeconds = 0;
+    int64u breadcrumb = 1;
+  }
+
+  response struct ArmFailSafeResponse = 1 {
+    CommissioningErrorEnum errorCode = 0;
+    char_string<128> debugText = 1;
+  }
+
+  request struct SetRegulatoryConfigRequest {
+    RegulatoryLocationTypeEnum newRegulatoryConfig = 0;
+    char_string<2> countryCode = 1;
+    int64u breadcrumb = 2;
+  }
+
+  response struct SetRegulatoryConfigResponse = 3 {
+    CommissioningErrorEnum errorCode = 0;
+    char_string debugText = 1;
+  }
+
+  response struct CommissioningCompleteResponse = 5 {
+    CommissioningErrorEnum errorCode = 0;
+    char_string debugText = 1;
+  }
+
+  /** Arm the persistent fail-safe timer with an expiry time of now + ExpiryLengthSeconds using device clock */
+  command access(invoke: administer) ArmFailSafe(ArmFailSafeRequest): ArmFailSafeResponse = 0;
+  /** Set the regulatory configuration to be used during commissioning */
+  command access(invoke: administer) SetRegulatoryConfig(SetRegulatoryConfigRequest): SetRegulatoryConfigResponse = 2;
+  /** Signals the Server that the Client has successfully completed all steps of Commissioning/Recofiguration needed during fail-safe period. */
+  fabric command access(invoke: administer) CommissioningComplete(): CommissioningCompleteResponse = 4;
+}
+
+/** Functionality to configure, enable, disable network credentials and access on a Matter device. */
+cluster NetworkCommissioning = 49 {
+  revision 1; // NOTE: Default/not specifically set
+
+  enum NetworkCommissioningStatusEnum : enum8 {
+    kSuccess = 0;
+    kOutOfRange = 1;
+    kBoundsExceeded = 2;
+    kNetworkIDNotFound = 3;
+    kDuplicateNetworkID = 4;
+    kNetworkNotFound = 5;
+    kRegulatoryError = 6;
+    kAuthFailure = 7;
+    kUnsupportedSecurity = 8;
+    kOtherConnectionFailure = 9;
+    kIPV6Failed = 10;
+    kIPBindFailed = 11;
+    kUnknownError = 12;
+  }
+
+  enum WiFiBandEnum : enum8 {
+    k2G4 = 0;
+    k3G65 = 1;
+    k5G = 2;
+    k6G = 3;
+    k60G = 4;
+    k1G = 5;
+  }
+
+  bitmap Feature : bitmap32 {
+    kWiFiNetworkInterface = 0x1;
+    kThreadNetworkInterface = 0x2;
+    kEthernetNetworkInterface = 0x4;
+    kPerDeviceCredentials = 0x8;
+  }
+
+  bitmap ThreadCapabilitiesBitmap : bitmap16 {
+    kIsBorderRouterCapable = 0x1;
+    kIsRouterCapable = 0x2;
+    kIsSleepyEndDeviceCapable = 0x4;
+    kIsFullThreadDevice = 0x8;
+    kIsSynchronizedSleepyEndDeviceCapable = 0x10;
+  }
+
+  bitmap WiFiSecurityBitmap : bitmap8 {
+    kUnencrypted = 0x1;
+    kWEP = 0x2;
+    kWPAPersonal = 0x4;
+    kWPA2Personal = 0x8;
+    kWPA3Personal = 0x10;
+    kWPA3MatterPDC = 0x20;
+  }
+
+  struct NetworkInfoStruct {
+    octet_string<32> networkID = 0;
+    boolean connected = 1;
+    optional nullable octet_string<20> networkIdentifier = 2;
+    optional nullable octet_string<20> clientIdentifier = 3;
+  }
+
+  struct ThreadInterfaceScanResultStruct {
+    int16u panId = 0;
+    int64u extendedPanId = 1;
+    char_string<16> networkName = 2;
+    int16u channel = 3;
+    int8u version = 4;
+    octet_string<8> extendedAddress = 5;
+    int8s rssi = 6;
+    int8u lqi = 7;
+  }
+
+  struct WiFiInterfaceScanResultStruct {
+    WiFiSecurityBitmap security = 0;
+    octet_string<32> ssid = 1;
+    octet_string<6> bssid = 2;
+    int16u channel = 3;
+    WiFiBandEnum wiFiBand = 4;
+    int8s rssi = 5;
+  }
+
+  readonly attribute access(read: administer) int8u maxNetworks = 0;
+  readonly attribute access(read: administer) NetworkInfoStruct networks[] = 1;
+  readonly attribute optional int8u scanMaxTimeSeconds = 2;
+  readonly attribute optional int8u connectMaxTimeSeconds = 3;
+  attribute access(write: administer) boolean interfaceEnabled = 4;
+  readonly attribute access(read: administer) nullable NetworkCommissioningStatusEnum lastNetworkingStatus = 5;
+  readonly attribute access(read: administer) nullable octet_string<32> lastNetworkID = 6;
+  readonly attribute access(read: administer) nullable int32s lastConnectErrorValue = 7;
+  readonly attribute optional WiFiBandEnum supportedWiFiBands[] = 8;
+  readonly attribute optional ThreadCapabilitiesBitmap supportedThreadFeatures = 9;
+  readonly attribute optional int16u threadVersion = 10;
+  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 ScanNetworksRequest {
+    optional nullable octet_string<32> ssid = 0;
+    optional int64u breadcrumb = 1;
+  }
+
+  response struct ScanNetworksResponse = 1 {
+    NetworkCommissioningStatusEnum networkingStatus = 0;
+    optional char_string debugText = 1;
+    optional WiFiInterfaceScanResultStruct wiFiScanResults[] = 2;
+    optional ThreadInterfaceScanResultStruct threadScanResults[] = 3;
+  }
+
+  request struct AddOrUpdateWiFiNetworkRequest {
+    octet_string<32> ssid = 0;
+    octet_string<64> credentials = 1;
+    optional int64u breadcrumb = 2;
+    optional octet_string<140> networkIdentity = 3;
+    optional octet_string<20> clientIdentifier = 4;
+    optional octet_string<32> possessionNonce = 5;
+  }
+
+  request struct AddOrUpdateThreadNetworkRequest {
+    octet_string<254> operationalDataset = 0;
+    optional int64u breadcrumb = 1;
+  }
+
+  request struct RemoveNetworkRequest {
+    octet_string<32> networkID = 0;
+    optional int64u breadcrumb = 1;
+  }
+
+  response struct NetworkConfigResponse = 5 {
+    NetworkCommissioningStatusEnum networkingStatus = 0;
+    optional char_string<512> debugText = 1;
+    optional int8u networkIndex = 2;
+    optional octet_string<140> clientIdentity = 3;
+    optional octet_string<64> possessionSignature = 4;
+  }
+
+  request struct ConnectNetworkRequest {
+    octet_string<32> networkID = 0;
+    optional int64u breadcrumb = 1;
+  }
+
+  response struct ConnectNetworkResponse = 7 {
+    NetworkCommissioningStatusEnum networkingStatus = 0;
+    optional char_string debugText = 1;
+    nullable int32s errorValue = 2;
+  }
+
+  request struct ReorderNetworkRequest {
+    octet_string<32> networkID = 0;
+    int8u networkIndex = 1;
+    optional int64u breadcrumb = 2;
+  }
+
+  request struct QueryIdentityRequest {
+    octet_string<20> keyIdentifier = 0;
+    optional octet_string<32> possessionNonce = 1;
+  }
+
+  response struct QueryIdentityResponse = 10 {
+    octet_string<140> identity = 0;
+    optional octet_string<64> possessionSignature = 1;
+  }
+
+  /** Detemine the set of networks the device sees as available. */
+  command access(invoke: administer) ScanNetworks(ScanNetworksRequest): ScanNetworksResponse = 0;
+  /** Add or update the credentials for a given Wi-Fi network. */
+  command access(invoke: administer) AddOrUpdateWiFiNetwork(AddOrUpdateWiFiNetworkRequest): NetworkConfigResponse = 2;
+  /** Add or update the credentials for a given Thread network. */
+  command access(invoke: administer) AddOrUpdateThreadNetwork(AddOrUpdateThreadNetworkRequest): NetworkConfigResponse = 3;
+  /** Remove the definition of a given network (including its credentials). */
+  command access(invoke: administer) RemoveNetwork(RemoveNetworkRequest): NetworkConfigResponse = 4;
+  /** Connect to the specified network, using previously-defined credentials. */
+  command access(invoke: administer) ConnectNetwork(ConnectNetworkRequest): ConnectNetworkResponse = 6;
+  /** Modify the order in which networks will be presented in the Networks attribute. */
+  command access(invoke: administer) ReorderNetwork(ReorderNetworkRequest): NetworkConfigResponse = 8;
+  /** Retrieve details about and optionally proof of possession of a network client identity. */
+  command access(invoke: administer) QueryIdentity(QueryIdentityRequest): QueryIdentityResponse = 9;
+}
+
+/** The General Diagnostics Cluster, along with other diagnostics clusters, provide a means to acquire standardized diagnostics metrics that MAY be used by a Node to assist a user or Administrative Node in diagnosing potential problems. */
+cluster GeneralDiagnostics = 51 {
+  revision 1; // NOTE: Default/not specifically set
+
+  enum BootReasonEnum : enum8 {
+    kUnspecified = 0;
+    kPowerOnReboot = 1;
+    kBrownOutReset = 2;
+    kSoftwareWatchdogReset = 3;
+    kHardwareWatchdogReset = 4;
+    kSoftwareUpdateCompleted = 5;
+    kSoftwareReset = 6;
+  }
+
+  enum HardwareFaultEnum : enum8 {
+    kUnspecified = 0;
+    kRadio = 1;
+    kSensor = 2;
+    kResettableOverTemp = 3;
+    kNonResettableOverTemp = 4;
+    kPowerSource = 5;
+    kVisualDisplayFault = 6;
+    kAudioOutputFault = 7;
+    kUserInterfaceFault = 8;
+    kNonVolatileMemoryError = 9;
+    kTamperDetected = 10;
+  }
+
+  enum InterfaceTypeEnum : enum8 {
+    kUnspecified = 0;
+    kWiFi = 1;
+    kEthernet = 2;
+    kCellular = 3;
+    kThread = 4;
+  }
+
+  enum NetworkFaultEnum : enum8 {
+    kUnspecified = 0;
+    kHardwareFailure = 1;
+    kNetworkJammed = 2;
+    kConnectionFailed = 3;
+  }
+
+  enum RadioFaultEnum : enum8 {
+    kUnspecified = 0;
+    kWiFiFault = 1;
+    kCellularFault = 2;
+    kThreadFault = 3;
+    kNFCFault = 4;
+    kBLEFault = 5;
+    kEthernetFault = 6;
+  }
+
+  struct NetworkInterface {
+    char_string<32> name = 0;
+    boolean isOperational = 1;
+    nullable boolean offPremiseServicesReachableIPv4 = 2;
+    nullable boolean offPremiseServicesReachableIPv6 = 3;
+    octet_string<8> hardwareAddress = 4;
+    octet_string IPv4Addresses[] = 5;
+    octet_string IPv6Addresses[] = 6;
+    InterfaceTypeEnum type = 7;
+  }
+
+  critical event HardwareFaultChange = 0 {
+    HardwareFaultEnum current[] = 0;
+    HardwareFaultEnum previous[] = 1;
+  }
+
+  critical event RadioFaultChange = 1 {
+    RadioFaultEnum current[] = 0;
+    RadioFaultEnum previous[] = 1;
+  }
+
+  critical event NetworkFaultChange = 2 {
+    NetworkFaultEnum current[] = 0;
+    NetworkFaultEnum previous[] = 1;
+  }
+
+  critical event BootReason = 3 {
+    BootReasonEnum bootReason = 0;
+  }
+
+  readonly attribute NetworkInterface networkInterfaces[] = 0;
+  readonly attribute int16u rebootCount = 1;
+  readonly attribute optional int64u upTime = 2;
+  readonly attribute optional int32u totalOperationalHours = 3;
+  readonly attribute optional BootReasonEnum bootReason = 4;
+  readonly attribute optional HardwareFaultEnum activeHardwareFaults[] = 5;
+  readonly attribute optional RadioFaultEnum activeRadioFaults[] = 6;
+  readonly attribute optional NetworkFaultEnum activeNetworkFaults[] = 7;
+  readonly attribute boolean testEventTriggersEnabled = 8;
+  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 TestEventTriggerRequest {
+    octet_string<16> enableKey = 0;
+    int64u eventTrigger = 1;
+  }
+
+  response struct TimeSnapshotResponse = 2 {
+    systime_us systemTimeUs = 0;
+    nullable epoch_us UTCTimeUs = 1;
+  }
+
+  /** Provide a means for certification tests to trigger some test-plan-specific events */
+  command access(invoke: manage) TestEventTrigger(TestEventTriggerRequest): DefaultSuccess = 0;
+  /** Take a snapshot of system time and epoch time. */
+  command TimeSnapshot(): TimeSnapshotResponse = 1;
+}
+
+/** Commands to trigger a Node to allow a new Administrator to commission it. */
+cluster AdministratorCommissioning = 60 {
+  revision 1; // NOTE: Default/not specifically set
+
+  enum CommissioningWindowStatusEnum : enum8 {
+    kWindowNotOpen = 0;
+    kEnhancedWindowOpen = 1;
+    kBasicWindowOpen = 2;
+  }
+
+  enum StatusCode : enum8 {
+    kBusy = 2;
+    kPAKEParameterError = 3;
+    kWindowNotOpen = 4;
+  }
+
+  bitmap Feature : bitmap32 {
+    kBasic = 0x1;
+  }
+
+  readonly attribute CommissioningWindowStatusEnum windowStatus = 0;
+  readonly attribute nullable fabric_idx adminFabricIndex = 1;
+  readonly attribute nullable vendor_id adminVendorId = 2;
+  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 OpenCommissioningWindowRequest {
+    int16u commissioningTimeout = 0;
+    octet_string PAKEPasscodeVerifier = 1;
+    int16u discriminator = 2;
+    int32u iterations = 3;
+    octet_string<32> salt = 4;
+  }
+
+  request struct OpenBasicCommissioningWindowRequest {
+    int16u commissioningTimeout = 0;
+  }
+
+  /** This command is used by a current Administrator to instruct a Node to go into commissioning mode using enhanced commissioning method. */
+  timed command access(invoke: administer) OpenCommissioningWindow(OpenCommissioningWindowRequest): DefaultSuccess = 0;
+  /** This command is used by a current Administrator to instruct a Node to go into commissioning mode using basic commissioning method, if the node supports it. */
+  timed command access(invoke: administer) OpenBasicCommissioningWindow(OpenBasicCommissioningWindowRequest): DefaultSuccess = 1;
+  /** This command is used by a current Administrator to instruct a Node to revoke any active Open Commissioning Window or Open Basic Commissioning Window command. */
+  timed command access(invoke: administer) RevokeCommissioning(): DefaultSuccess = 2;
+}
+
+/** This cluster is used to add or remove Operational Credentials on a Commissionee or Node, as well as manage the associated Fabrics. */
+cluster OperationalCredentials = 62 {
+  revision 1; // NOTE: Default/not specifically set
+
+  enum CertificateChainTypeEnum : enum8 {
+    kDACCertificate = 1;
+    kPAICertificate = 2;
+  }
+
+  enum NodeOperationalCertStatusEnum : enum8 {
+    kOK = 0;
+    kInvalidPublicKey = 1;
+    kInvalidNodeOpId = 2;
+    kInvalidNOC = 3;
+    kMissingCsr = 4;
+    kTableFull = 5;
+    kInvalidAdminSubject = 6;
+    kFabricConflict = 9;
+    kLabelConflict = 10;
+    kInvalidFabricIndex = 11;
+  }
+
+  fabric_scoped struct FabricDescriptorStruct {
+    octet_string<65> rootPublicKey = 1;
+    vendor_id vendorID = 2;
+    fabric_id fabricID = 3;
+    node_id nodeID = 4;
+    char_string<32> label = 5;
+    fabric_idx fabricIndex = 254;
+  }
+
+  fabric_scoped struct NOCStruct {
+    fabric_sensitive octet_string noc = 1;
+    nullable fabric_sensitive octet_string icac = 2;
+    fabric_idx fabricIndex = 254;
+  }
+
+  readonly attribute access(read: administer) NOCStruct NOCs[] = 0;
+  readonly attribute FabricDescriptorStruct fabrics[] = 1;
+  readonly attribute int8u supportedFabrics = 2;
+  readonly attribute int8u commissionedFabrics = 3;
+  readonly attribute octet_string trustedRootCertificates[] = 4;
+  readonly attribute int8u currentFabricIndex = 5;
+  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 AttestationRequestRequest {
+    octet_string<32> attestationNonce = 0;
+  }
+
+  response struct AttestationResponse = 1 {
+    octet_string<900> attestationElements = 0;
+    octet_string<64> attestationSignature = 1;
+  }
+
+  request struct CertificateChainRequestRequest {
+    CertificateChainTypeEnum certificateType = 0;
+  }
+
+  response struct CertificateChainResponse = 3 {
+    octet_string<600> certificate = 0;
+  }
+
+  request struct CSRRequestRequest {
+    octet_string<32> CSRNonce = 0;
+    optional boolean isForUpdateNOC = 1;
+  }
+
+  response struct CSRResponse = 5 {
+    octet_string NOCSRElements = 0;
+    octet_string attestationSignature = 1;
+  }
+
+  request struct AddNOCRequest {
+    octet_string<400> NOCValue = 0;
+    optional octet_string<400> ICACValue = 1;
+    octet_string<16> IPKValue = 2;
+    int64u caseAdminSubject = 3;
+    vendor_id adminVendorId = 4;
+  }
+
+  request struct UpdateNOCRequest {
+    octet_string NOCValue = 0;
+    optional octet_string ICACValue = 1;
+  }
+
+  response struct NOCResponse = 8 {
+    NodeOperationalCertStatusEnum statusCode = 0;
+    optional fabric_idx fabricIndex = 1;
+    optional char_string<128> debugText = 2;
+  }
+
+  request struct UpdateFabricLabelRequest {
+    char_string<32> label = 0;
+  }
+
+  request struct RemoveFabricRequest {
+    fabric_idx fabricIndex = 0;
+  }
+
+  request struct AddTrustedRootCertificateRequest {
+    octet_string rootCACertificate = 0;
+  }
+
+  /** Sender is requesting attestation information from the receiver. */
+  command access(invoke: administer) AttestationRequest(AttestationRequestRequest): AttestationResponse = 0;
+  /** Sender is requesting a device attestation certificate from the receiver. */
+  command access(invoke: administer) CertificateChainRequest(CertificateChainRequestRequest): CertificateChainResponse = 2;
+  /** Sender is requesting a certificate signing request (CSR) from the receiver. */
+  command access(invoke: administer) CSRRequest(CSRRequestRequest): CSRResponse = 4;
+  /** Sender is requesting to add the new node operational certificates. */
+  command access(invoke: administer) AddNOC(AddNOCRequest): NOCResponse = 6;
+  /** Sender is requesting to update the node operational certificates. */
+  fabric command access(invoke: administer) UpdateNOC(UpdateNOCRequest): NOCResponse = 7;
+  /** This command SHALL be used by an Administrative Node to set the user-visible Label field for a given Fabric, as reflected by entries in the Fabrics attribute. */
+  fabric command access(invoke: administer) UpdateFabricLabel(UpdateFabricLabelRequest): NOCResponse = 9;
+  /** This command is used by Administrative Nodes to remove a given fabric index and delete all associated fabric-scoped data. */
+  command access(invoke: administer) RemoveFabric(RemoveFabricRequest): NOCResponse = 10;
+  /** This command SHALL add a Trusted Root CA Certificate, provided as its CHIP Certificate representation. */
+  command access(invoke: administer) AddTrustedRootCertificate(AddTrustedRootCertificateRequest): DefaultSuccess = 11;
+}
+
+/** The Group Key Management Cluster is the mechanism by which group keys are managed. */
+cluster GroupKeyManagement = 63 {
+  revision 1; // NOTE: Default/not specifically set
+
+  enum GroupKeySecurityPolicyEnum : enum8 {
+    kTrustFirst = 0;
+    kCacheAndSync = 1;
+  }
+
+  bitmap Feature : bitmap32 {
+    kCacheAndSync = 0x1;
+  }
+
+  fabric_scoped struct GroupInfoMapStruct {
+    group_id groupId = 1;
+    endpoint_no endpoints[] = 2;
+    optional char_string<16> groupName = 3;
+    fabric_idx fabricIndex = 254;
+  }
+
+  fabric_scoped struct GroupKeyMapStruct {
+    group_id groupId = 1;
+    int16u groupKeySetID = 2;
+    fabric_idx fabricIndex = 254;
+  }
+
+  struct GroupKeySetStruct {
+    int16u groupKeySetID = 0;
+    GroupKeySecurityPolicyEnum groupKeySecurityPolicy = 1;
+    nullable octet_string<16> epochKey0 = 2;
+    nullable epoch_us epochStartTime0 = 3;
+    nullable octet_string<16> epochKey1 = 4;
+    nullable epoch_us epochStartTime1 = 5;
+    nullable octet_string<16> epochKey2 = 6;
+    nullable epoch_us epochStartTime2 = 7;
+  }
+
+  attribute access(write: manage) GroupKeyMapStruct groupKeyMap[] = 0;
+  readonly attribute GroupInfoMapStruct groupTable[] = 1;
+  readonly attribute int16u maxGroupsPerFabric = 2;
+  readonly attribute int16u maxGroupKeysPerFabric = 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 KeySetWriteRequest {
+    GroupKeySetStruct groupKeySet = 0;
+  }
+
+  request struct KeySetReadRequest {
+    int16u groupKeySetID = 0;
+  }
+
+  response struct KeySetReadResponse = 2 {
+    GroupKeySetStruct groupKeySet = 0;
+  }
+
+  request struct KeySetRemoveRequest {
+    int16u groupKeySetID = 0;
+  }
+
+  response struct KeySetReadAllIndicesResponse = 5 {
+    int16u groupKeySetIDs[] = 0;
+  }
+
+  /** Write a new set of keys for the given key set id. */
+  fabric command access(invoke: administer) KeySetWrite(KeySetWriteRequest): DefaultSuccess = 0;
+  /** Read the keys for a given key set id. */
+  fabric command access(invoke: administer) KeySetRead(KeySetReadRequest): KeySetReadResponse = 1;
+  /** Revoke a Root Key from a Group */
+  fabric command access(invoke: administer) KeySetRemove(KeySetRemoveRequest): DefaultSuccess = 3;
+  /** Return the list of Group Key Sets associated with the accessing fabric */
+  fabric command access(invoke: administer) KeySetReadAllIndices(): KeySetReadAllIndicesResponse = 4;
+}
+
+/** Electric Vehicle Supply Equipment (EVSE) is equipment used to charge an Electric Vehicle (EV) or Plug-In Hybrid Electric Vehicle. This cluster provides an interface to the functionality of Electric Vehicle Supply Equipment (EVSE) management. */
+provisional cluster EnergyEvse = 153 {
+  revision 1; // NOTE: Default/not specifically set
+
+  enum EnergyTransferStoppedReasonEnum : enum8 {
+    kEVStopped = 0;
+    kEVSEStopped = 1;
+    kOther = 2;
+  }
+
+  enum FaultStateEnum : enum8 {
+    kNoError = 0;
+    kMeterFailure = 1;
+    kOverVoltage = 2;
+    kUnderVoltage = 3;
+    kOverCurrent = 4;
+    kContactWetFailure = 5;
+    kContactDryFailure = 6;
+    kGroundFault = 7;
+    kPowerLoss = 8;
+    kPowerQuality = 9;
+    kPilotShortCircuit = 10;
+    kEmergencyStop = 11;
+    kEVDisconnected = 12;
+    kWrongPowerSupply = 13;
+    kLiveNeutralSwap = 14;
+    kOverTemperature = 15;
+    kOther = 255;
+  }
+
+  enum StateEnum : enum8 {
+    kNotPluggedIn = 0;
+    kPluggedInNoDemand = 1;
+    kPluggedInDemand = 2;
+    kPluggedInCharging = 3;
+    kPluggedInDischarging = 4;
+    kSessionEnding = 5;
+    kFault = 6;
+  }
+
+  enum SupplyStateEnum : enum8 {
+    kDisabled = 0;
+    kChargingEnabled = 1;
+    kDischargingEnabled = 2;
+    kDisabledError = 3;
+    kDisabledDiagnostics = 4;
+  }
+
+  bitmap Feature : bitmap32 {
+    kChargingPreferences = 0x1;
+    kSoCReporting = 0x2;
+    kPlugAndCharge = 0x4;
+    kRFID = 0x8;
+    kV2X = 0x10;
+  }
+
+  bitmap TargetDayOfWeekBitmap : bitmap8 {
+    kSunday = 0x1;
+    kMonday = 0x2;
+    kTuesday = 0x4;
+    kWednesday = 0x8;
+    kThursday = 0x10;
+    kFriday = 0x20;
+    kSaturday = 0x40;
+  }
+
+  struct ChargingTargetStruct {
+    int16u targetTime = 0;
+    optional percent targetSoC = 1;
+    optional energy_mwh addedEnergy = 2;
+  }
+
+  info event EVConnected = 0 {
+    int32u sessionID = 0;
+  }
+
+  info event EVNotDetected = 1 {
+    int32u sessionID = 0;
+    StateEnum state = 1;
+    elapsed_s sessionDuration = 2;
+    energy_mwh sessionEnergyCharged = 3;
+    optional energy_mwh sessionEnergyDischarged = 4;
+  }
+
+  info event EnergyTransferStarted = 2 {
+    int32u sessionID = 0;
+    StateEnum state = 1;
+    amperage_ma maximumCurrent = 2;
+  }
+
+  info event EnergyTransferStopped = 3 {
+    int32u sessionID = 0;
+    StateEnum state = 1;
+    EnergyTransferStoppedReasonEnum reason = 2;
+    energy_mwh energyTransferred = 4;
+  }
+
+  critical event Fault = 4 {
+    int32u sessionID = 0;
+    StateEnum state = 1;
+    FaultStateEnum faultStatePreviousState = 2;
+    FaultStateEnum faultStateCurrentState = 4;
+  }
+
+  info event RFID = 5 {
+    octet_string uid = 0;
+  }
+
+  readonly attribute nullable StateEnum state = 0;
+  readonly attribute SupplyStateEnum supplyState = 1;
+  readonly attribute FaultStateEnum faultState = 2;
+  readonly attribute nullable epoch_s chargingEnabledUntil = 3;
+  readonly attribute optional nullable epoch_s dischargingEnabledUntil = 4;
+  readonly attribute amperage_ma circuitCapacity = 5;
+  readonly attribute amperage_ma minimumChargeCurrent = 6;
+  readonly attribute amperage_ma maximumChargeCurrent = 7;
+  readonly attribute optional amperage_ma maximumDischargeCurrent = 8;
+  attribute access(write: manage) optional amperage_ma userMaximumChargeCurrent = 9;
+  attribute access(write: manage) optional elapsed_s randomizationDelayWindow = 10;
+  readonly attribute optional int8u numberOfWeeklyTargets = 33;
+  readonly attribute optional int8u numberOfDailyTargets = 34;
+  readonly attribute optional nullable epoch_s nextChargeStartTime = 35;
+  readonly attribute optional nullable epoch_s nextChargeTargetTime = 36;
+  readonly attribute optional nullable energy_mwh nextChargeRequiredEnergy = 37;
+  readonly attribute optional nullable percent nextChargeTargetSoC = 38;
+  attribute access(write: manage) optional nullable int16u approximateEVEfficiency = 39;
+  readonly attribute optional nullable percent stateOfCharge = 48;
+  readonly attribute optional nullable energy_mwh batteryCapacity = 49;
+  readonly attribute optional nullable char_string<32> vehicleID = 50;
+  readonly attribute nullable int32u sessionID = 64;
+  readonly attribute elapsed_s sessionDuration = 65;
+  readonly attribute energy_mwh sessionEnergyCharged = 66;
+  readonly attribute optional energy_mwh sessionEnergyDischarged = 67;
+  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;
+
+  response struct GetTargetsResponse = 0 {
+    TargetDayOfWeekBitmap dayOfWeekforSequence = 0;
+    ChargingTargetStruct chargingTargets[] = 1;
+  }
+
+  request struct EnableChargingRequest {
+    nullable epoch_s chargingEnabledUntil = 0;
+    amperage_ma minimumChargeCurrent = 1;
+    amperage_ma maximumChargeCurrent = 2;
+  }
+
+  request struct EnableDischargingRequest {
+    nullable epoch_s dischargingEnabledUntil = 0;
+    amperage_ma maximumDischargeCurrent = 1;
+  }
+
+  request struct SetTargetsRequest {
+    TargetDayOfWeekBitmap dayOfWeekforSequence = 0;
+    ChargingTargetStruct chargingTargets[] = 1;
+  }
+
+  request struct GetTargetsRequest {
+    TargetDayOfWeekBitmap daysToReturn = 0;
+  }
+
+  /** Allows a client to disable the EVSE from charging and discharging. */
+  timed command Disable(): DefaultSuccess = 1;
+  /** Allows a client to enable the EVSE to charge an EV. */
+  timed command EnableCharging(EnableChargingRequest): DefaultSuccess = 2;
+  /** Allows a client to enable the EVSE to discharge an EV. */
+  timed command EnableDischarging(EnableDischargingRequest): DefaultSuccess = 3;
+  /** Allows a client to put the EVSE into a self-diagnostics mode. */
+  timed command StartDiagnostics(): DefaultSuccess = 4;
+  /** Allows a client to set the user specified charging targets. */
+  timed command SetTargets(SetTargetsRequest): DefaultSuccess = 5;
+  /** Allows a client to retrieve the user specified charging targets. */
+  timed command GetTargets(GetTargetsRequest): GetTargetsResponse = 6;
+  /** Allows a client to clear all stored charging targets. */
+  timed command ClearTargets(): DefaultSuccess = 7;
+}
+
+endpoint 0 {
+  device type ma_rootdevice = 22, version 1;
+
+
+  server cluster Descriptor {
+    callback attribute deviceTypeList;
+    callback attribute serverList;
+    callback attribute clientList;
+    callback attribute partsList;
+    callback attribute generatedCommandList;
+    callback attribute acceptedCommandList;
+    callback attribute eventList;
+    callback attribute attributeList;
+    ram      attribute featureMap default = 0;
+    callback attribute clusterRevision;
+  }
+
+  server cluster AccessControl {
+    callback attribute acl;
+    callback attribute extension;
+    callback attribute subjectsPerAccessControlEntry;
+    callback attribute targetsPerAccessControlEntry;
+    callback attribute accessControlEntriesPerFabric;
+    callback attribute generatedCommandList;
+    callback attribute acceptedCommandList;
+    callback attribute eventList;
+    callback attribute attributeList;
+    ram      attribute featureMap default = 0;
+    callback attribute clusterRevision;
+  }
+
+  server cluster BasicInformation {
+    callback attribute dataModelRevision;
+    callback attribute vendorName;
+    callback attribute vendorID;
+    callback attribute productName;
+    callback attribute productID;
+    ram      attribute nodeLabel;
+    callback attribute location;
+    callback attribute hardwareVersion;
+    callback attribute hardwareVersionString;
+    callback attribute softwareVersion;
+    callback attribute softwareVersionString;
+    callback attribute capabilityMinima;
+    callback attribute specificationVersion;
+    callback attribute maxPathsPerInvoke;
+    callback attribute generatedCommandList;
+    callback attribute acceptedCommandList;
+    callback attribute eventList;
+    callback attribute attributeList;
+    ram      attribute featureMap default = 0;
+    ram      attribute clusterRevision default = 3;
+  }
+
+  server cluster LocalizationConfiguration {
+    ram      attribute activeLocale;
+    callback attribute supportedLocales;
+    callback attribute generatedCommandList;
+    callback attribute acceptedCommandList;
+    callback attribute eventList;
+    callback attribute attributeList;
+    ram      attribute featureMap default = 0;
+    ram      attribute clusterRevision default = 1;
+  }
+
+  server cluster TimeFormatLocalization {
+    ram      attribute hourFormat;
+    callback attribute generatedCommandList;
+    callback attribute acceptedCommandList;
+    callback attribute eventList;
+    callback attribute attributeList;
+    ram      attribute featureMap default = 0;
+    ram      attribute clusterRevision default = 1;
+  }
+
+  server cluster UnitLocalization {
+    callback attribute generatedCommandList;
+    callback attribute acceptedCommandList;
+    callback attribute eventList;
+    callback attribute attributeList;
+    ram      attribute featureMap default = 0;
+    ram      attribute clusterRevision default = 1;
+  }
+
+  server cluster GeneralCommissioning {
+    ram      attribute breadcrumb default = 0x0000000000000000;
+    callback attribute basicCommissioningInfo;
+    callback attribute regulatoryConfig;
+    callback attribute locationCapability;
+    callback attribute supportsConcurrentConnection;
+    callback attribute generatedCommandList;
+    callback attribute acceptedCommandList;
+    callback attribute eventList;
+    callback attribute attributeList;
+    ram      attribute featureMap default = 0;
+    ram      attribute clusterRevision default = 1;
+
+    handle command ArmFailSafe;
+    handle command ArmFailSafeResponse;
+    handle command SetRegulatoryConfig;
+    handle command SetRegulatoryConfigResponse;
+    handle command CommissioningComplete;
+    handle command CommissioningCompleteResponse;
+  }
+
+  server cluster NetworkCommissioning {
+    ram      attribute maxNetworks;
+    callback attribute networks;
+    ram      attribute interfaceEnabled;
+    ram      attribute lastNetworkingStatus;
+    ram      attribute lastNetworkID;
+    ram      attribute lastConnectErrorValue;
+    callback attribute generatedCommandList;
+    callback attribute acceptedCommandList;
+    callback attribute eventList;
+    callback attribute attributeList;
+    ram      attribute featureMap default = 0;
+    ram      attribute clusterRevision default = 1;
+  }
+
+  server cluster GeneralDiagnostics {
+    callback attribute networkInterfaces;
+    callback attribute rebootCount;
+    ram      attribute testEventTriggersEnabled;
+    callback attribute generatedCommandList;
+    callback attribute acceptedCommandList;
+    callback attribute eventList;
+    callback attribute attributeList;
+    ram      attribute featureMap default = 0;
+    ram      attribute clusterRevision default = 1;
+
+    handle command TestEventTrigger;
+    handle command TimeSnapshot;
+    handle command TimeSnapshotResponse;
+  }
+
+  server cluster AdministratorCommissioning {
+    callback attribute windowStatus;
+    callback attribute adminFabricIndex;
+    callback attribute adminVendorId;
+    callback attribute generatedCommandList;
+    callback attribute acceptedCommandList;
+    callback attribute eventList;
+    callback attribute attributeList;
+    ram      attribute featureMap default = 0;
+    ram      attribute clusterRevision default = 1;
+
+    handle command OpenCommissioningWindow;
+    handle command RevokeCommissioning;
+  }
+
+  server cluster OperationalCredentials {
+    callback attribute NOCs;
+    callback attribute fabrics;
+    callback attribute supportedFabrics;
+    callback attribute commissionedFabrics;
+    callback attribute trustedRootCertificates;
+    callback attribute currentFabricIndex;
+    callback attribute generatedCommandList;
+    callback attribute acceptedCommandList;
+    callback attribute eventList;
+    callback attribute attributeList;
+    ram      attribute featureMap default = 0;
+    ram      attribute clusterRevision default = 1;
+
+    handle command AttestationRequest;
+    handle command AttestationResponse;
+    handle command CertificateChainRequest;
+    handle command CertificateChainResponse;
+    handle command CSRRequest;
+    handle command CSRResponse;
+    handle command AddNOC;
+    handle command UpdateNOC;
+    handle command NOCResponse;
+    handle command UpdateFabricLabel;
+    handle command RemoveFabric;
+    handle command AddTrustedRootCertificate;
+  }
+
+  server cluster GroupKeyManagement {
+    callback attribute groupKeyMap;
+    callback attribute groupTable;
+    callback attribute maxGroupsPerFabric;
+    callback attribute maxGroupKeysPerFabric;
+    callback attribute generatedCommandList;
+    callback attribute acceptedCommandList;
+    callback attribute eventList;
+    callback attribute attributeList;
+    callback attribute featureMap;
+    callback attribute clusterRevision;
+
+    handle command KeySetWrite;
+    handle command KeySetRead;
+    handle command KeySetReadResponse;
+    handle command KeySetRemove;
+    handle command KeySetReadAllIndices;
+    handle command KeySetReadAllIndicesResponse;
+  }
+}
+endpoint 1 {
+  device type ma_lightsensor = 262, version 1;
+
+
+  server cluster Identify {
+    ram      attribute identifyTime default = 0x0;
+    ram      attribute identifyType default = 0x00;
+    callback attribute generatedCommandList;
+    callback attribute acceptedCommandList;
+    callback attribute eventList;
+    callback attribute attributeList;
+    ram      attribute featureMap default = 0;
+    ram      attribute clusterRevision default = 4;
+
+    handle command Identify;
+    handle command TriggerEffect;
+  }
+
+  server cluster Descriptor {
+    callback attribute deviceTypeList;
+    callback attribute serverList;
+    callback attribute clientList;
+    callback attribute partsList;
+    callback attribute generatedCommandList;
+    callback attribute acceptedCommandList;
+    callback attribute eventList;
+    callback attribute attributeList;
+    ram      attribute featureMap default = 0;
+    callback attribute clusterRevision;
+  }
+
+  server cluster EnergyEvse {
+    callback attribute state;
+    callback attribute supplyState;
+    callback attribute faultState;
+    callback attribute chargingEnabledUntil default = 0;
+    callback attribute dischargingEnabledUntil default = 0;
+    callback attribute circuitCapacity default = 0;
+    callback attribute minimumChargeCurrent default = 6000;
+    callback attribute maximumChargeCurrent default = 0;
+    callback attribute maximumDischargeCurrent default = 0;
+    callback attribute userMaximumChargeCurrent default = 0;
+    callback attribute randomizationDelayWindow default = 600;
+    callback attribute numberOfWeeklyTargets default = 0;
+    callback attribute numberOfDailyTargets default = 1;
+    callback attribute nextChargeStartTime;
+    callback attribute nextChargeTargetTime;
+    callback attribute nextChargeRequiredEnergy;
+    callback attribute nextChargeTargetSoC;
+    callback attribute approximateEVEfficiency default = 0xFFFF;
+    callback attribute stateOfCharge;
+    callback attribute batteryCapacity;
+    callback attribute vehicleID;
+    callback attribute sessionID default = 0;
+    callback attribute sessionDuration default = 0;
+    callback attribute sessionEnergyCharged default = 0;
+    callback attribute sessionEnergyDischarged default = 0;
+    callback attribute generatedCommandList;
+    callback attribute acceptedCommandList;
+    callback attribute eventList;
+    callback attribute attributeList;
+    ram      attribute featureMap default = 1;
+    ram      attribute clusterRevision default = 2;
+  }
+}
+
+
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
new file mode 100644
index 00000000000000..2acf948abce45c
--- /dev/null
+++ b/examples/energy-management-app/energy-management-common/energy-management-app.zap
@@ -0,0 +1,3307 @@
+{
+  "fileFormat": 2,
+  "featureLevel": 99,
+  "creator": "zap",
+  "keyValuePairs": [
+    {
+      "key": "commandDiscovery",
+      "value": "1"
+    },
+    {
+      "key": "defaultResponsePolicy",
+      "value": "always"
+    },
+    {
+      "key": "manufacturerCodes",
+      "value": "0x1002"
+    }
+  ],
+  "package": [
+    {
+      "pathRelativity": "relativeToZap",
+      "path": "../../../src/app/zap-templates/zcl/zcl.json",
+      "type": "zcl-properties",
+      "category": "matter",
+      "version": 1,
+      "description": "Matter SDK ZCL data"
+    },
+    {
+      "pathRelativity": "relativeToZap",
+      "path": "../../../src/app/zap-templates/app-templates.json",
+      "type": "gen-templates-json",
+      "version": "chip-v1"
+    }
+  ],
+  "endpointTypes": [
+    {
+      "id": 1,
+      "name": "Anonymous Endpoint Type",
+      "deviceTypeRef": {
+        "code": 22,
+        "profileId": 259,
+        "label": "MA-rootdevice",
+        "name": "MA-rootdevice"
+      },
+      "deviceTypes": [
+        {
+          "code": 22,
+          "profileId": 259,
+          "label": "MA-rootdevice",
+          "name": "MA-rootdevice"
+        }
+      ],
+      "deviceVersions": [
+        1
+      ],
+      "deviceIdentifiers": [
+        22
+      ],
+      "deviceTypeName": "MA-rootdevice",
+      "deviceTypeCode": 22,
+      "deviceTypeProfileId": 259,
+      "clusters": [
+        {
+          "name": "Descriptor",
+          "code": 29,
+          "mfgCode": null,
+          "define": "DESCRIPTOR_CLUSTER",
+          "side": "server",
+          "enabled": 1,
+          "attributes": [
+            {
+              "name": "DeviceTypeList",
+              "code": 0,
+              "mfgCode": null,
+              "side": "server",
+              "type": "array",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "ServerList",
+              "code": 1,
+              "mfgCode": null,
+              "side": "server",
+              "type": "array",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "ClientList",
+              "code": 2,
+              "mfgCode": null,
+              "side": "server",
+              "type": "array",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "PartsList",
+              "code": 3,
+              "mfgCode": null,
+              "side": "server",
+              "type": "array",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": null,
+              "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": null,
+              "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": null,
+              "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": null,
+              "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": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "FeatureMap",
+              "code": 65532,
+              "mfgCode": null,
+              "side": "server",
+              "type": "bitmap32",
+              "included": 1,
+              "storageOption": "RAM",
+              "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": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            }
+          ]
+        },
+        {
+          "name": "Access Control",
+          "code": 31,
+          "mfgCode": null,
+          "define": "ACCESS_CONTROL_CLUSTER",
+          "side": "server",
+          "enabled": 1,
+          "attributes": [
+            {
+              "name": "ACL",
+              "code": 0,
+              "mfgCode": null,
+              "side": "server",
+              "type": "array",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "Extension",
+              "code": 1,
+              "mfgCode": null,
+              "side": "server",
+              "type": "array",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "SubjectsPerAccessControlEntry",
+              "code": 2,
+              "mfgCode": null,
+              "side": "server",
+              "type": "int16u",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "TargetsPerAccessControlEntry",
+              "code": 3,
+              "mfgCode": null,
+              "side": "server",
+              "type": "int16u",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "AccessControlEntriesPerFabric",
+              "code": 4,
+              "mfgCode": null,
+              "side": "server",
+              "type": "int16u",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": null,
+              "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": null,
+              "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": null,
+              "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": null,
+              "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": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "FeatureMap",
+              "code": 65532,
+              "mfgCode": null,
+              "side": "server",
+              "type": "bitmap32",
+              "included": 1,
+              "storageOption": "RAM",
+              "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": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            }
+          ]
+        },
+        {
+          "name": "Basic Information",
+          "code": 40,
+          "mfgCode": null,
+          "define": "BASIC_INFORMATION_CLUSTER",
+          "side": "server",
+          "enabled": 1,
+          "attributes": [
+            {
+              "name": "DataModelRevision",
+              "code": 0,
+              "mfgCode": null,
+              "side": "server",
+              "type": "int16u",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "VendorName",
+              "code": 1,
+              "mfgCode": null,
+              "side": "server",
+              "type": "char_string",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "VendorID",
+              "code": 2,
+              "mfgCode": null,
+              "side": "server",
+              "type": "vendor_id",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "ProductName",
+              "code": 3,
+              "mfgCode": null,
+              "side": "server",
+              "type": "char_string",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "ProductID",
+              "code": 4,
+              "mfgCode": null,
+              "side": "server",
+              "type": "int16u",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "NodeLabel",
+              "code": 5,
+              "mfgCode": null,
+              "side": "server",
+              "type": "char_string",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "Location",
+              "code": 6,
+              "mfgCode": null,
+              "side": "server",
+              "type": "char_string",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "HardwareVersion",
+              "code": 7,
+              "mfgCode": null,
+              "side": "server",
+              "type": "int16u",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "HardwareVersionString",
+              "code": 8,
+              "mfgCode": null,
+              "side": "server",
+              "type": "char_string",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "SoftwareVersion",
+              "code": 9,
+              "mfgCode": null,
+              "side": "server",
+              "type": "int32u",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "SoftwareVersionString",
+              "code": 10,
+              "mfgCode": null,
+              "side": "server",
+              "type": "char_string",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "CapabilityMinima",
+              "code": 19,
+              "mfgCode": null,
+              "side": "server",
+              "type": "CapabilityMinimaStruct",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "SpecificationVersion",
+              "code": 21,
+              "mfgCode": null,
+              "side": "server",
+              "type": "int32u",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "MaxPathsPerInvoke",
+              "code": 22,
+              "mfgCode": null,
+              "side": "server",
+              "type": "int16u",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "GeneratedCommandList",
+              "code": 65528,
+              "mfgCode": null,
+              "side": "server",
+              "type": "array",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "AcceptedCommandList",
+              "code": 65529,
+              "mfgCode": null,
+              "side": "server",
+              "type": "array",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "EventList",
+              "code": 65530,
+              "mfgCode": null,
+              "side": "server",
+              "type": "array",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "AttributeList",
+              "code": 65531,
+              "mfgCode": null,
+              "side": "server",
+              "type": "array",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 1,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "FeatureMap",
+              "code": 65532,
+              "mfgCode": null,
+              "side": "server",
+              "type": "bitmap32",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 1,
+              "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": 1,
+              "bounded": 0,
+              "defaultValue": "3",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            }
+          ]
+        },
+        {
+          "name": "Localization Configuration",
+          "code": 43,
+          "mfgCode": null,
+          "define": "LOCALIZATION_CONFIGURATION_CLUSTER",
+          "side": "server",
+          "enabled": 1,
+          "attributes": [
+            {
+              "name": "ActiveLocale",
+              "code": 0,
+              "mfgCode": null,
+              "side": "server",
+              "type": "char_string",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "SupportedLocales",
+              "code": 1,
+              "mfgCode": null,
+              "side": "server",
+              "type": "array",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": null,
+              "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": null,
+              "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": null,
+              "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": null,
+              "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": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "FeatureMap",
+              "code": 65532,
+              "mfgCode": null,
+              "side": "server",
+              "type": "bitmap32",
+              "included": 1,
+              "storageOption": "RAM",
+              "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": "Time Format Localization",
+          "code": 44,
+          "mfgCode": null,
+          "define": "TIME_FORMAT_LOCALIZATION_CLUSTER",
+          "side": "server",
+          "enabled": 1,
+          "attributes": [
+            {
+              "name": "HourFormat",
+              "code": 0,
+              "mfgCode": null,
+              "side": "server",
+              "type": "HourFormatEnum",
+              "included": 1,
+              "storageOption": "RAM",
+              "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": null,
+              "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": null,
+              "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": null,
+              "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": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "FeatureMap",
+              "code": 65532,
+              "mfgCode": null,
+              "side": "server",
+              "type": "bitmap32",
+              "included": 1,
+              "storageOption": "RAM",
+              "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": "Unit Localization",
+          "code": 45,
+          "mfgCode": null,
+          "define": "UNIT_LOCALIZATION_CLUSTER",
+          "side": "server",
+          "enabled": 1,
+          "attributes": [
+            {
+              "name": "GeneratedCommandList",
+              "code": 65528,
+              "mfgCode": null,
+              "side": "server",
+              "type": "array",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": null,
+              "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": null,
+              "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": null,
+              "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": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "FeatureMap",
+              "code": 65532,
+              "mfgCode": null,
+              "side": "server",
+              "type": "bitmap32",
+              "included": 1,
+              "storageOption": "RAM",
+              "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": "General Commissioning",
+          "code": 48,
+          "mfgCode": null,
+          "define": "GENERAL_COMMISSIONING_CLUSTER",
+          "side": "server",
+          "enabled": 1,
+          "commands": [
+            {
+              "name": "ArmFailSafe",
+              "code": 0,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "ArmFailSafeResponse",
+              "code": 1,
+              "mfgCode": null,
+              "source": "server",
+              "isIncoming": 0,
+              "isEnabled": 1
+            },
+            {
+              "name": "SetRegulatoryConfig",
+              "code": 2,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "SetRegulatoryConfigResponse",
+              "code": 3,
+              "mfgCode": null,
+              "source": "server",
+              "isIncoming": 0,
+              "isEnabled": 1
+            },
+            {
+              "name": "CommissioningComplete",
+              "code": 4,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "CommissioningCompleteResponse",
+              "code": 5,
+              "mfgCode": null,
+              "source": "server",
+              "isIncoming": 0,
+              "isEnabled": 1
+            }
+          ],
+          "attributes": [
+            {
+              "name": "Breadcrumb",
+              "code": 0,
+              "mfgCode": null,
+              "side": "server",
+              "type": "int64u",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0x0000000000000000",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "BasicCommissioningInfo",
+              "code": 1,
+              "mfgCode": null,
+              "side": "server",
+              "type": "BasicCommissioningInfo",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "RegulatoryConfig",
+              "code": 2,
+              "mfgCode": null,
+              "side": "server",
+              "type": "RegulatoryLocationTypeEnum",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "LocationCapability",
+              "code": 3,
+              "mfgCode": null,
+              "side": "server",
+              "type": "RegulatoryLocationTypeEnum",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "SupportsConcurrentConnection",
+              "code": 4,
+              "mfgCode": null,
+              "side": "server",
+              "type": "boolean",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": null,
+              "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": null,
+              "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": null,
+              "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": null,
+              "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": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "FeatureMap",
+              "code": 65532,
+              "mfgCode": null,
+              "side": "server",
+              "type": "bitmap32",
+              "included": 1,
+              "storageOption": "RAM",
+              "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": "Network Commissioning",
+          "code": 49,
+          "mfgCode": null,
+          "define": "NETWORK_COMMISSIONING_CLUSTER",
+          "side": "server",
+          "enabled": 1,
+          "attributes": [
+            {
+              "name": "MaxNetworks",
+              "code": 0,
+              "mfgCode": null,
+              "side": "server",
+              "type": "int8u",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "Networks",
+              "code": 1,
+              "mfgCode": null,
+              "side": "server",
+              "type": "array",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "InterfaceEnabled",
+              "code": 4,
+              "mfgCode": null,
+              "side": "server",
+              "type": "boolean",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "LastNetworkingStatus",
+              "code": 5,
+              "mfgCode": null,
+              "side": "server",
+              "type": "NetworkCommissioningStatusEnum",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "LastNetworkID",
+              "code": 6,
+              "mfgCode": null,
+              "side": "server",
+              "type": "octet_string",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "LastConnectErrorValue",
+              "code": 7,
+              "mfgCode": null,
+              "side": "server",
+              "type": "int32s",
+              "included": 1,
+              "storageOption": "RAM",
+              "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": null,
+              "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": null,
+              "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": null,
+              "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": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "FeatureMap",
+              "code": 65532,
+              "mfgCode": null,
+              "side": "server",
+              "type": "bitmap32",
+              "included": 1,
+              "storageOption": "RAM",
+              "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": "General Diagnostics",
+          "code": 51,
+          "mfgCode": null,
+          "define": "GENERAL_DIAGNOSTICS_CLUSTER",
+          "side": "server",
+          "enabled": 1,
+          "commands": [
+            {
+              "name": "TestEventTrigger",
+              "code": 0,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "TimeSnapshot",
+              "code": 1,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "TimeSnapshotResponse",
+              "code": 2,
+              "mfgCode": null,
+              "source": "server",
+              "isIncoming": 0,
+              "isEnabled": 1
+            }
+          ],
+          "attributes": [
+            {
+              "name": "NetworkInterfaces",
+              "code": 0,
+              "mfgCode": null,
+              "side": "server",
+              "type": "array",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "RebootCount",
+              "code": 1,
+              "mfgCode": null,
+              "side": "server",
+              "type": "int16u",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "TestEventTriggersEnabled",
+              "code": 8,
+              "mfgCode": null,
+              "side": "server",
+              "type": "boolean",
+              "included": 1,
+              "storageOption": "RAM",
+              "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": null,
+              "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": null,
+              "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": null,
+              "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": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "FeatureMap",
+              "code": 65532,
+              "mfgCode": null,
+              "side": "server",
+              "type": "bitmap32",
+              "included": 1,
+              "storageOption": "RAM",
+              "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": "Administrator Commissioning",
+          "code": 60,
+          "mfgCode": null,
+          "define": "ADMINISTRATOR_COMMISSIONING_CLUSTER",
+          "side": "server",
+          "enabled": 1,
+          "commands": [
+            {
+              "name": "OpenCommissioningWindow",
+              "code": 0,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "RevokeCommissioning",
+              "code": 2,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            }
+          ],
+          "attributes": [
+            {
+              "name": "WindowStatus",
+              "code": 0,
+              "mfgCode": null,
+              "side": "server",
+              "type": "CommissioningWindowStatusEnum",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "AdminFabricIndex",
+              "code": 1,
+              "mfgCode": null,
+              "side": "server",
+              "type": "fabric_idx",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "AdminVendorId",
+              "code": 2,
+              "mfgCode": null,
+              "side": "server",
+              "type": "vendor_id",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": null,
+              "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": null,
+              "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": null,
+              "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": null,
+              "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": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "FeatureMap",
+              "code": 65532,
+              "mfgCode": null,
+              "side": "server",
+              "type": "bitmap32",
+              "included": 1,
+              "storageOption": "RAM",
+              "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": "Operational Credentials",
+          "code": 62,
+          "mfgCode": null,
+          "define": "OPERATIONAL_CREDENTIALS_CLUSTER",
+          "side": "server",
+          "enabled": 1,
+          "commands": [
+            {
+              "name": "AttestationRequest",
+              "code": 0,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "AttestationResponse",
+              "code": 1,
+              "mfgCode": null,
+              "source": "server",
+              "isIncoming": 0,
+              "isEnabled": 1
+            },
+            {
+              "name": "CertificateChainRequest",
+              "code": 2,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "CertificateChainResponse",
+              "code": 3,
+              "mfgCode": null,
+              "source": "server",
+              "isIncoming": 0,
+              "isEnabled": 1
+            },
+            {
+              "name": "CSRRequest",
+              "code": 4,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "CSRResponse",
+              "code": 5,
+              "mfgCode": null,
+              "source": "server",
+              "isIncoming": 0,
+              "isEnabled": 1
+            },
+            {
+              "name": "AddNOC",
+              "code": 6,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "UpdateNOC",
+              "code": 7,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "NOCResponse",
+              "code": 8,
+              "mfgCode": null,
+              "source": "server",
+              "isIncoming": 0,
+              "isEnabled": 1
+            },
+            {
+              "name": "UpdateFabricLabel",
+              "code": 9,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "RemoveFabric",
+              "code": 10,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "AddTrustedRootCertificate",
+              "code": 11,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            }
+          ],
+          "attributes": [
+            {
+              "name": "NOCs",
+              "code": 0,
+              "mfgCode": null,
+              "side": "server",
+              "type": "array",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "Fabrics",
+              "code": 1,
+              "mfgCode": null,
+              "side": "server",
+              "type": "array",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "SupportedFabrics",
+              "code": 2,
+              "mfgCode": null,
+              "side": "server",
+              "type": "int8u",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "CommissionedFabrics",
+              "code": 3,
+              "mfgCode": null,
+              "side": "server",
+              "type": "int8u",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "TrustedRootCertificates",
+              "code": 4,
+              "mfgCode": null,
+              "side": "server",
+              "type": "array",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "CurrentFabricIndex",
+              "code": 5,
+              "mfgCode": null,
+              "side": "server",
+              "type": "int8u",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": null,
+              "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": null,
+              "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": null,
+              "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": null,
+              "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": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "FeatureMap",
+              "code": 65532,
+              "mfgCode": null,
+              "side": "server",
+              "type": "bitmap32",
+              "included": 1,
+              "storageOption": "RAM",
+              "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": "Group Key Management",
+          "code": 63,
+          "mfgCode": null,
+          "define": "GROUP_KEY_MANAGEMENT_CLUSTER",
+          "side": "server",
+          "enabled": 1,
+          "commands": [
+            {
+              "name": "KeySetWrite",
+              "code": 0,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "KeySetRead",
+              "code": 1,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "KeySetReadResponse",
+              "code": 2,
+              "mfgCode": null,
+              "source": "server",
+              "isIncoming": 0,
+              "isEnabled": 1
+            },
+            {
+              "name": "KeySetRemove",
+              "code": 3,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "KeySetReadAllIndices",
+              "code": 4,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "KeySetReadAllIndicesResponse",
+              "code": 5,
+              "mfgCode": null,
+              "source": "server",
+              "isIncoming": 0,
+              "isEnabled": 1
+            }
+          ],
+          "attributes": [
+            {
+              "name": "GroupKeyMap",
+              "code": 0,
+              "mfgCode": null,
+              "side": "server",
+              "type": "array",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "GroupTable",
+              "code": 1,
+              "mfgCode": null,
+              "side": "server",
+              "type": "array",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "MaxGroupsPerFabric",
+              "code": 2,
+              "mfgCode": null,
+              "side": "server",
+              "type": "int16u",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "MaxGroupKeysPerFabric",
+              "code": 3,
+              "mfgCode": null,
+              "side": "server",
+              "type": "int16u",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": null,
+              "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": null,
+              "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": null,
+              "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": null,
+              "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": null,
+              "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": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "ClusterRevision",
+              "code": 65533,
+              "mfgCode": null,
+              "side": "server",
+              "type": "int16u",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            }
+          ]
+        }
+      ]
+    },
+    {
+      "id": 2,
+      "name": "Anonymous Endpoint Type",
+      "deviceTypeRef": {
+        "code": 262,
+        "profileId": 259,
+        "label": "MA-lightsensor",
+        "name": "MA-lightsensor"
+      },
+      "deviceTypes": [
+        {
+          "code": 262,
+          "profileId": 259,
+          "label": "MA-lightsensor",
+          "name": "MA-lightsensor"
+        }
+      ],
+      "deviceVersions": [
+        1
+      ],
+      "deviceIdentifiers": [
+        262
+      ],
+      "deviceTypeName": "MA-lightsensor",
+      "deviceTypeCode": 262,
+      "deviceTypeProfileId": 259,
+      "clusters": [
+        {
+          "name": "Identify",
+          "code": 3,
+          "mfgCode": null,
+          "define": "IDENTIFY_CLUSTER",
+          "side": "server",
+          "enabled": 1,
+          "commands": [
+            {
+              "name": "Identify",
+              "code": 0,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "TriggerEffect",
+              "code": 64,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            }
+          ],
+          "attributes": [
+            {
+              "name": "IdentifyTime",
+              "code": 0,
+              "mfgCode": null,
+              "side": "server",
+              "type": "int16u",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0x0",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "IdentifyType",
+              "code": 1,
+              "mfgCode": null,
+              "side": "server",
+              "type": "IdentifyTypeEnum",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0x00",
+              "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": null,
+              "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": null,
+              "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": null,
+              "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": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "FeatureMap",
+              "code": 65532,
+              "mfgCode": null,
+              "side": "server",
+              "type": "bitmap32",
+              "included": 1,
+              "storageOption": "RAM",
+              "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": "4",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            }
+          ]
+        },
+        {
+          "name": "Descriptor",
+          "code": 29,
+          "mfgCode": null,
+          "define": "DESCRIPTOR_CLUSTER",
+          "side": "server",
+          "enabled": 1,
+          "attributes": [
+            {
+              "name": "DeviceTypeList",
+              "code": 0,
+              "mfgCode": null,
+              "side": "server",
+              "type": "array",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "ServerList",
+              "code": 1,
+              "mfgCode": null,
+              "side": "server",
+              "type": "array",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "ClientList",
+              "code": 2,
+              "mfgCode": null,
+              "side": "server",
+              "type": "array",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "PartsList",
+              "code": 3,
+              "mfgCode": null,
+              "side": "server",
+              "type": "array",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": null,
+              "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": null,
+              "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": null,
+              "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": null,
+              "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": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "FeatureMap",
+              "code": 65532,
+              "mfgCode": null,
+              "side": "server",
+              "type": "bitmap32",
+              "included": 1,
+              "storageOption": "RAM",
+              "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": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            }
+          ]
+        },
+        {
+          "name": "Energy EVSE",
+          "code": 153,
+          "mfgCode": null,
+          "define": "ENERGY_EVSE_CLUSTER",
+          "side": "server",
+          "enabled": 1,
+          "apiMaturity": "provisional",
+          "attributes": [
+            {
+              "name": "State",
+              "code": 0,
+              "mfgCode": null,
+              "side": "server",
+              "type": "StateEnum",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "SupplyState",
+              "code": 1,
+              "mfgCode": null,
+              "side": "server",
+              "type": "SupplyStateEnum",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "FaultState",
+              "code": 2,
+              "mfgCode": null,
+              "side": "server",
+              "type": "FaultStateEnum",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "ChargingEnabledUntil",
+              "code": 3,
+              "mfgCode": null,
+              "side": "server",
+              "type": "epoch_s",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "DischargingEnabledUntil",
+              "code": 4,
+              "mfgCode": null,
+              "side": "server",
+              "type": "epoch_s",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "CircuitCapacity",
+              "code": 5,
+              "mfgCode": null,
+              "side": "server",
+              "type": "amperage_ma",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "MinimumChargeCurrent",
+              "code": 6,
+              "mfgCode": null,
+              "side": "server",
+              "type": "amperage_ma",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "6000",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "MaximumChargeCurrent",
+              "code": 7,
+              "mfgCode": null,
+              "side": "server",
+              "type": "amperage_ma",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "MaximumDischargeCurrent",
+              "code": 8,
+              "mfgCode": null,
+              "side": "server",
+              "type": "amperage_ma",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "UserMaximumChargeCurrent",
+              "code": 9,
+              "mfgCode": null,
+              "side": "server",
+              "type": "amperage_ma",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "RandomizationDelayWindow",
+              "code": 10,
+              "mfgCode": null,
+              "side": "server",
+              "type": "elapsed_s",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "600",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "NumberOfWeeklyTargets",
+              "code": 33,
+              "mfgCode": null,
+              "side": "server",
+              "type": "int8u",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "NumberOfDailyTargets",
+              "code": 34,
+              "mfgCode": null,
+              "side": "server",
+              "type": "int8u",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "1",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "NextChargeStartTime",
+              "code": 35,
+              "mfgCode": null,
+              "side": "server",
+              "type": "epoch_s",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "NextChargeTargetTime",
+              "code": 36,
+              "mfgCode": null,
+              "side": "server",
+              "type": "epoch_s",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "NextChargeRequiredEnergy",
+              "code": 37,
+              "mfgCode": null,
+              "side": "server",
+              "type": "energy_mwh",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "NextChargeTargetSoC",
+              "code": 38,
+              "mfgCode": null,
+              "side": "server",
+              "type": "percent",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "ApproximateEVEfficiency",
+              "code": 39,
+              "mfgCode": null,
+              "side": "server",
+              "type": "int16u",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0xFFFF",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "StateOfCharge",
+              "code": 48,
+              "mfgCode": null,
+              "side": "server",
+              "type": "percent",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "BatteryCapacity",
+              "code": 49,
+              "mfgCode": null,
+              "side": "server",
+              "type": "energy_mwh",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "VehicleID",
+              "code": 50,
+              "mfgCode": null,
+              "side": "server",
+              "type": "char_string",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "SessionID",
+              "code": 64,
+              "mfgCode": null,
+              "side": "server",
+              "type": "int32u",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "SessionDuration",
+              "code": 65,
+              "mfgCode": null,
+              "side": "server",
+              "type": "elapsed_s",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "SessionEnergyCharged",
+              "code": 66,
+              "mfgCode": null,
+              "side": "server",
+              "type": "energy_mwh",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "SessionEnergyDischarged",
+              "code": 67,
+              "mfgCode": null,
+              "side": "server",
+              "type": "energy_mwh",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0",
+              "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": null,
+              "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": null,
+              "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": null,
+              "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": null,
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "FeatureMap",
+              "code": 65532,
+              "mfgCode": null,
+              "side": "server",
+              "type": "bitmap32",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "1",
+              "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": "2",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            }
+          ]
+        }
+      ]
+    }
+  ],
+  "endpoints": [
+    {
+      "endpointTypeName": "Anonymous Endpoint Type",
+      "endpointTypeIndex": 0,
+      "profileId": 259,
+      "endpointId": 0,
+      "networkId": 0
+    },
+    {
+      "endpointTypeName": "Anonymous Endpoint Type",
+      "endpointTypeIndex": 1,
+      "profileId": 259,
+      "endpointId": 1,
+      "networkId": 0
+    }
+  ],
+  "log": []
+}
\ No newline at end of file
diff --git a/examples/energy-management-app/energy-management-common/include/EVSEManufacturerImpl.h b/examples/energy-management-app/energy-management-common/include/EVSEManufacturerImpl.h
new file mode 100644
index 00000000000000..34e9027e626ad5
--- /dev/null
+++ b/examples/energy-management-app/energy-management-common/include/EVSEManufacturerImpl.h
@@ -0,0 +1,52 @@
+/*
+ *
+ *    Copyright (c) 2023 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 <EnergyEvseManager.h>
+
+using chip::Protocols::InteractionModel::Status;
+namespace chip {
+namespace app {
+namespace Clusters {
+namespace EnergyEvse {
+
+/**
+ * The EVSEManufacturer example class
+ */
+
+class EVSEManufacturer
+{
+public:
+    /**
+     * @brief   Called at start up to apply hardware settings
+     */
+    CHIP_ERROR Init(EnergyEvseManager * aInstance);
+
+    /**
+     * @brief   Called at shutdown
+     */
+    CHIP_ERROR Shutdown(EnergyEvseManager * aInstance);
+
+private:
+};
+
+} // namespace EnergyEvse
+} // namespace Clusters
+} // namespace app
+} // namespace chip
diff --git a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h
new file mode 100644
index 00000000000000..09cb1deae4bc02
--- /dev/null
+++ b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h
@@ -0,0 +1,194 @@
+/*
+ *
+ *    Copyright (c) 2023 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 "app/clusters/energy-evse-server/energy-evse-server.h"
+
+#include <app/util/af.h>
+#include <app/util/config.h>
+#include <cstring>
+
+using chip::Protocols::InteractionModel::Status;
+namespace chip {
+namespace app {
+namespace Clusters {
+namespace EnergyEvse {
+
+/**
+ * The application delegate.
+ */
+
+class EnergyEvseDelegate : public EnergyEvse::Delegate
+{
+public:
+    /**
+     * @brief   Called when EVSE cluster receives Disable command
+     */
+    Status Disable() override;
+
+    /**
+     * @brief   Called when EVSE cluster receives EnableCharging command
+     *
+     * @param chargingEnabledUntil
+     * @param minimumChargeCurrent (in mA)
+     * @param maximumChargeCurrent (in mA)
+     */
+    Status EnableCharging(const chip::app::DataModel::Nullable<uint32_t> & chargingEnabledUntil,
+                          const uint64_t & minimumChargeCurrent, const uint64_t & maximumChargeCurrent) override;
+
+    /**
+     * @brief   Called when EVSE cluster receives EnableDischarging command
+     *
+     * @param dischargingEnabledUntil
+     * @param maximumChargeCurrent (in mA)
+     */
+    Status EnableDischarging(const chip::app::DataModel::Nullable<uint32_t> & dischargingEnabledUntil,
+                             const uint64_t & maximumDischargeCurrent) override;
+
+    /**
+     * @brief    Called when EVSE cluster receives StartDiagnostics command
+     */
+    Status StartDiagnostics() override;
+
+    // -----------------------------------------------------------------
+    // Internal API to allow an EVSE to change its internal state etc
+    // TODO Status hwRegisterEvseHardwareCallback(Callback);
+    Status hwSetMaxHardwareCurrentLimit(int64_t currentmA);
+    Status hwSetCircuitCapacity(int64_t currentmA);
+    Status hwSetCableAssemblyLimit(int64_t currentmA);
+    Status hwSetState(StateEnum state);
+    Status hwSetFault(FaultStateEnum fault);
+
+    // ------------------------------------------------------------------
+    // Get attribute methods
+    StateEnum GetState() override;
+    CHIP_ERROR SetState(StateEnum);
+
+    SupplyStateEnum GetSupplyState() override;
+    CHIP_ERROR SetSupplyState(SupplyStateEnum);
+
+    FaultStateEnum GetFaultState() override;
+    CHIP_ERROR SetFaultState(FaultStateEnum);
+
+    DataModel::Nullable<uint32_t> GetChargingEnabledUntil() override;
+    CHIP_ERROR SetChargingEnabledUntil(uint32_t);
+
+    DataModel::Nullable<uint32_t> GetDischargingEnabledUntil() override;
+    CHIP_ERROR SetDischargingEnabledUntil(uint32_t);
+
+    int64_t GetCircuitCapacity() override;
+    CHIP_ERROR SetCircuitCapacity(int64_t);
+
+    int64_t GetMinimumChargeCurrent() override;
+    CHIP_ERROR SetMinimumChargeCurrent(int64_t);
+
+    int64_t GetMaximumChargeCurrent() override;
+    CHIP_ERROR SetMaximumChargeCurrent(int64_t);
+
+    int64_t GetMaximumDischargeCurrent() override;
+    CHIP_ERROR SetMaximumDischargeCurrent(int64_t);
+
+    int64_t GetUserMaximumChargeCurrent() override;
+    CHIP_ERROR SetUserMaximumChargeCurrent(int64_t) override;
+
+    uint32_t GetRandomizationDelayWindow() override;
+    CHIP_ERROR SetRandomizationDelayWindow(uint32_t) override;
+
+    /* PREF attributes */
+    uint8_t GetNumberOfWeeklyTargets() override;
+    uint8_t GetNumberOfDailyTargets() override;
+    DataModel::Nullable<uint32_t> GetNextChargeStartTime() override;
+    DataModel::Nullable<uint32_t> GetNextChargeTargetTime() override;
+    DataModel::Nullable<int64_t> GetNextChargeRequiredEnergy() override;
+    DataModel::Nullable<chip::Percent> GetNextChargeTargetSoC() override;
+
+    DataModel::Nullable<uint16_t> GetApproximateEVEfficiency() override;
+    CHIP_ERROR SetApproximateEVEfficiency(uint16_t) override;
+
+    /* SOC attributes */
+    DataModel::Nullable<chip::Percent> GetStateOfCharge() override;
+    DataModel::Nullable<int64_t> GetBatteryCapacity() override;
+    /* PNC attributes*/
+    char * GetVehicleID() override;
+    /* Session SESS attributes */
+    DataModel::Nullable<uint32_t> GetSessionID() override;
+    DataModel::Nullable<uint32_t> GetSessionDuration() override;
+    DataModel::Nullable<int64_t> GetSessionEnergyCharged() override;
+    DataModel::Nullable<int64_t> GetSessionEnergyDischarged() override;
+
+private:
+    /* Constants */
+    static constexpr int MAX_CURRENT_LOWER_BOUND             = 0;
+    static constexpr int MAX_CURRENT_UPPER_BOUND             = 80000;
+    static constexpr int DEFAULT_MIN_CHARGE_CURRENT          = 6000;  /* 6A */
+    static constexpr int DEFAULT_USER_MAXIMUM_CHARGE_CURRENT = 80000; /* 80A */
+    static constexpr int DEFAULT_RANDOMIZATION_DELAY_WINDOW  = 600;   /* 600s */
+
+    /* private variables for controlling the hardware - these are not attributes */
+    int64_t mMaxHardwareCurrentLimit                = 0; /* Hardware current limit in mA */
+    int64_t mCableAssemblyCurrentLimit              = 0; /* Cable limit detected when cable is plugged in, in mA */
+    int64_t mMaximumChargingCurrentLimitFromCommand = 0; /* Value of current maximum limit when charging enabled */
+    int64_t mMinimumChargingCurrentLimitFromCommand = 0; /* Value of current minimum limit when charging enabled */
+    int64_t mActualChargingCurrentLimit             = 0;
+    StateEnum mHwState                              = StateEnum::kNotPluggedIn; /* Hardware state */
+
+    /**
+     * @brief Helper function to work out the charge limit based on conditions and settings
+     */
+    Status ComputeMaxChargeCurrentLimit();
+
+    /* Attributes */
+    StateEnum mState             = StateEnum::kNotPluggedIn;
+    SupplyStateEnum mSupplyState = SupplyStateEnum::kDisabled;
+    FaultStateEnum mFaultState   = FaultStateEnum::kNoError;
+    DataModel::Nullable<uint32_t> mChargingEnabledUntil;    // TODO Default to 0 to indicate disabled
+    DataModel::Nullable<uint32_t> mDischargingEnabledUntil; // TODO Default to 0 to indicate disabled
+    int64_t mCircuitCapacity           = 0;
+    int64_t mMinimumChargeCurrent      = DEFAULT_MIN_CHARGE_CURRENT;
+    int64_t mMaximumChargeCurrent      = 0;
+    int64_t mMaximumDischargeCurrent   = 0;
+    int64_t mUserMaximumChargeCurrent  = DEFAULT_USER_MAXIMUM_CHARGE_CURRENT; // TODO update spec
+    uint32_t mRandomizationDelayWindow = DEFAULT_RANDOMIZATION_DELAY_WINDOW;
+    /* PREF attributes */
+    uint8_t mNumberOfWeeklyTargets = 0;
+    uint8_t mNumberOfDailyTargets  = 1;
+    DataModel::Nullable<uint32_t> mNextChargeStartTime;
+    DataModel::Nullable<uint32_t> mNextChargeTargetTime;
+    DataModel::Nullable<int64_t> mNextChargeRequiredEnergy;
+    DataModel::Nullable<chip::Percent> mNextChargeTargetSoC;
+    DataModel::Nullable<uint16_t> mApproximateEVEfficiency;
+
+    /* SOC attributes */
+    DataModel::Nullable<chip::Percent> mStateOfCharge;
+    DataModel::Nullable<int64_t> mBatteryCapacity;
+
+    /* PNC attributes*/
+    char * mVehicleID;
+
+    /* Session SESS attributes */
+    DataModel::Nullable<uint32_t> mSessionID;
+    DataModel::Nullable<uint32_t> mSessionDuration;
+    DataModel::Nullable<int64_t> mSessionEnergyCharged;
+    DataModel::Nullable<int64_t> mSessionEnergyDischarged;
+};
+
+} // namespace EnergyEvse
+} // namespace Clusters
+} // namespace app
+} // namespace chip
diff --git a/examples/energy-management-app/energy-management-common/include/EnergyEvseManager.h b/examples/energy-management-app/energy-management-common/include/EnergyEvseManager.h
new file mode 100644
index 00000000000000..034da67e7de01d
--- /dev/null
+++ b/examples/energy-management-app/energy-management-common/include/EnergyEvseManager.h
@@ -0,0 +1,60 @@
+/*
+ *
+ *    Copyright (c) 2023 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 <EnergyEvseDelegateImpl.h>
+#include <app/clusters/energy-evse-server/energy-evse-server.h>
+#include <app/util/af-types.h>
+#include <lib/core/CHIPError.h>
+
+namespace chip {
+namespace app {
+namespace Clusters {
+
+using namespace chip::app::Clusters::EnergyEvse;
+class EnergyEvseManager : public Instance
+{
+public:
+    EnergyEvseManager(EndpointId aEndpointId, EnergyEvseDelegate & aDelegate) :
+        EnergyEvse::Instance(aEndpointId, aDelegate), mEndpointId(aEndpointId)
+    {
+        mInstance = this;
+        mDelegate = &aDelegate;
+    }
+
+    // Delete copy constructor and assignment operator.
+    EnergyEvseManager(const EnergyEvseManager &)             = delete;
+    EnergyEvseManager(const EnergyEvseManager &&)            = delete;
+    EnergyEvseManager & operator=(const EnergyEvseManager &) = delete;
+
+    CHIP_ERROR Init();
+    void Shutdown();
+
+    EnergyEvse::Instance * GetInstance() { return mInstance; };
+    EnergyEvseDelegate * GetDelegate() { return mDelegate; };
+
+private:
+    EnergyEvse::Instance * mInstance;
+    EndpointId mEndpointId;
+    EnergyEvseDelegate * mDelegate;
+};
+
+} // namespace Clusters
+} // namespace app
+} // namespace chip
diff --git a/examples/energy-management-app/energy-management-common/include/EnergyManagementManager.h b/examples/energy-management-app/energy-management-common/include/EnergyManagementManager.h
new file mode 100644
index 00000000000000..3dac6f579c609e
--- /dev/null
+++ b/examples/energy-management-app/energy-management-common/include/EnergyManagementManager.h
@@ -0,0 +1,26 @@
+/*
+ *
+ *    Copyright (c) 2023 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 <stdbool.h>
+#include <stdint.h>
+
+#include <functional>
+
+#include <lib/core/CHIPError.h>
diff --git a/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp b/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp
new file mode 100644
index 00000000000000..f24cb286363b59
--- /dev/null
+++ b/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp
@@ -0,0 +1,51 @@
+/*
+ *
+ *    Copyright (c) 2023 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 <EVSEManufacturerImpl.h>
+#include <EnergyEvseManager.h>
+
+using namespace chip::app;
+using namespace chip::app::Clusters;
+using namespace chip::app::Clusters::EnergyEvse;
+
+CHIP_ERROR EVSEManufacturer::Init(EnergyEvseManager * aInstance)
+{
+    /* Manufacturers should modify this to do any custom initialisation */
+
+    /* Register callbacks */
+    // TODO EnergyEvseManager::GetInstance()->GetDelegate()->RegisterCallbacks();
+
+    /* Set the EVSE Hardware Maximum current limit */
+    // For Manufacturer to specify the hardware capability in mA
+    aInstance->GetDelegate()->hwSetMaxHardwareCurrentLimit(32000);
+
+    // For Manufacturer to specify the CircuitCapacity (e.g. from DIP switches)
+    aInstance->GetDelegate()->hwSetCircuitCapacity(20000);
+
+    /* For now let's pretend the EV is plugged in, and asking for demand */
+    aInstance->GetDelegate()->hwSetState(StateEnum::kPluggedInDemand);
+    aInstance->GetDelegate()->hwSetCableAssemblyLimit(63000);
+
+    return CHIP_NO_ERROR;
+}
+
+CHIP_ERROR EVSEManufacturer::Shutdown(EnergyEvseManager * aInstance)
+{
+
+    return CHIP_NO_ERROR;
+}
\ No newline at end of file
diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
new file mode 100644
index 00000000000000..ece556ecaf3be5
--- /dev/null
+++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
@@ -0,0 +1,711 @@
+/*
+ *
+ *    Copyright (c) 2023 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 <EnergyEvseDelegateImpl.h>
+#include <app-common/zap-generated/attributes/Accessors.h>
+#include <app-common/zap-generated/cluster-objects.h>
+
+using namespace chip;
+using chip::Protocols::InteractionModel::Status;
+
+using namespace chip::app;
+using namespace chip::app::DataModel;
+using namespace chip::app::Clusters;
+using namespace chip::app::Clusters::EnergyEvse;
+using namespace chip::app::Clusters::EnergyEvse::Attributes;
+
+/**
+ * @brief   Called when EVSE cluster receives Disable command
+ */
+Status EnergyEvseDelegate::Disable()
+{
+    ChipLogProgress(AppServer, "EnergyEvseDelegate::Disable()");
+
+    /* update State */
+    switch (mHwState)
+    {
+    case StateEnum::kNotPluggedIn:
+        SetState(StateEnum::kNotPluggedIn);
+        break;
+
+    case StateEnum::kPluggedInNoDemand:
+        SetState(StateEnum::kPluggedInNoDemand);
+        break;
+
+    case StateEnum::kPluggedInDemand:
+        SetState(StateEnum::kPluggedInDemand);
+        break;
+
+    default:
+        ChipLogError(AppServer, "Unexpected EVSE hardware state\n");
+        SetState(StateEnum::kFault);
+        break;
+    }
+
+    /* update SupplyState */
+    SetSupplyState(SupplyStateEnum::kDisabled);
+
+    /* update ChargingEnabledUntil & DischargingEnabledUntil to show 0 */
+    SetChargingEnabledUntil(0);
+    SetDischargingEnabledUntil(0);
+
+    /* update MinimumChargeCurrent & MaximumChargeCurrent to 0 */
+    SetMinimumChargeCurrent(0);
+    SetMaximumChargeCurrent(0);
+
+    /* update MaximumDischargeCurrent to 0 */
+    SetMaximumDischargeCurrent(0);
+
+    // TODO: Generate events
+
+    return Status::Success;
+}
+
+/**
+ * @brief   Called when EVSE cluster receives EnableCharging command
+ *
+ * @param chargingEnabledUntil (can be null to indefinite charging)
+ * @param minimumChargeCurrent (in mA)
+ * @param maximumChargeCurrent (in mA)
+ */
+Status EnergyEvseDelegate::EnableCharging(const chip::app::DataModel::Nullable<uint32_t> & chargingEnabledUntil,
+                                          const uint64_t & minimumChargeCurrent, const uint64_t & maximumChargeCurrent)
+{
+    ChipLogProgress(AppServer, "EnergyEvseDelegate::EnableCharging()");
+
+    if (maximumChargeCurrent < MAX_CURRENT_LOWER_BOUND || maximumChargeCurrent > MAX_CURRENT_UPPER_BOUND)
+    {
+        ChipLogError(NotSpecified, "Maximum Current outside limits");
+        return Status::ConstraintError;
+    }
+
+    if (minimumChargeCurrent < MAX_CURRENT_LOWER_BOUND || minimumChargeCurrent > MAX_CURRENT_UPPER_BOUND)
+    {
+        ChipLogError(NotSpecified, "Maximum Current outside limits");
+        return Status::ConstraintError;
+    }
+
+    if (minimumChargeCurrent > maximumChargeCurrent)
+    {
+        ChipLogError(NotSpecified, "Minium Current > Maximum Current!");
+        return Status::ConstraintError;
+    }
+
+    if (chargingEnabledUntil.IsNull())
+    {
+        /* Charging enabled indefinitely */
+        ChipLogError(NotSpecified, "Charging enabled indefinitely")
+    }
+    else
+    {
+        /* check chargingEnabledUntil is in the future */
+        ChipLogError(NotSpecified, "Charging enabled until: %d", chargingEnabledUntil.Value());
+        // TODO
+        // if (checkChargingEnabled)
+    }
+
+    /* Check current state isn't already enabled */
+
+    /* If charging is already enabled, check that the parameters may have
+       changed, these may override an existing charging command */
+    switch (mHwState)
+    {
+    case StateEnum::kNotPluggedIn:
+        SetState(StateEnum::kNotPluggedIn);
+        break;
+
+    case StateEnum::kPluggedInNoDemand:
+        SetState(StateEnum::kPluggedInNoDemand);
+        break;
+
+    case StateEnum::kPluggedInDemand:
+        /* If the EVSE is asking for demand then enable charging */
+        SetState(StateEnum::kPluggedInCharging);
+        break;
+
+    default:
+        ChipLogError(AppServer, "Unexpected EVSE hardware state\n");
+        SetState(StateEnum::kFault);
+        break;
+    }
+
+    /* update SupplyState */
+    SetSupplyState(SupplyStateEnum::kChargingEnabled);
+
+    /* If it looks ok, store the min & max charging current */
+    mMaximumChargingCurrentLimitFromCommand = maximumChargeCurrent;
+    SetMinimumChargeCurrent(minimumChargeCurrent);
+    // TODO persist these to KVS
+
+    // TODO: Generate events
+
+    return this->ComputeMaxChargeCurrentLimit();
+}
+
+/**
+ * @brief   Called when EVSE cluster receives EnableDischarging command
+ *
+ * @param dischargingEnabledUntil (can be null to indefinite discharging)
+ * @param maximumChargeCurrent (in mA)
+ */
+Status EnergyEvseDelegate::EnableDischarging(const chip::app::DataModel::Nullable<uint32_t> & dischargingEnabledUntil,
+                                             const uint64_t & maximumDischargeCurrent)
+{
+    ChipLogProgress(AppServer, "EnergyEvseDelegate::EnableDischarging() called.");
+
+    /* update SupplyState */
+    SetSupplyState(SupplyStateEnum::kDischargingEnabled);
+
+    // TODO: Generate events
+
+    return Status::Success;
+}
+
+/**
+ * @brief    Called when EVSE cluster receives StartDiagnostics command
+ */
+Status EnergyEvseDelegate::StartDiagnostics()
+{
+    /* For EVSE manufacturers to customize */
+    ChipLogProgress(AppServer, "EnergyEvseDelegate::StartDiagnostics()");
+
+    /* update SupplyState */
+    SetSupplyState(SupplyStateEnum::kDisabledDiagnostics);
+
+    // TODO: Generate events
+
+    return Status::Success;
+}
+
+/* ---------------------------------------------------------------------------
+ * FUNCTIONS BELOW:
+ *    - EVSE Hardware interface
+ *
+ *  RegisterEvseHardwareCallback( callbackType, callbackFnc )
+ *  SetMaxHardwareCurrentLimit( currentmA )
+ *  SetCircuitCapacity( currentmA )
+ *  SetCableAssemblyLimit( currentmA )
+ *  SetState( EVSEStateEnum )
+ *  SetFault
+ *
+ */
+
+/**
+ * @brief    Called by EVSE Hardware to register a callback
+ *
+ * @param    Callback function
+ */
+#if 0
+Status EnergyEvseDelegate::hwRegisterEvseHardwareCallback(int Callback) // TODO
+{
+    // TODO
+    return CHIP_NO_ERROR;
+}
+#endif
+/**
+ * @brief    Called by EVSE Hardware to notify the delegate of the maximum
+ *           current limit supported by the hardware.
+ *
+ *           This is normally called at start-up.
+ *
+ * @param    currentmA
+ */
+Status EnergyEvseDelegate::hwSetMaxHardwareCurrentLimit(int64_t currentmA)
+{
+    if (currentmA < MAX_CURRENT_LOWER_BOUND || currentmA > MAX_CURRENT_UPPER_BOUND)
+    {
+        return Status::ConstraintError;
+    }
+
+    /* there is no attribute to store this so store in private variable */
+    mMaxHardwareCurrentLimit = currentmA;
+
+    return this->ComputeMaxChargeCurrentLimit();
+}
+
+/**
+ * @brief    Called by EVSE Hardware to notify the delegate of maximum electrician
+ *           set current limit.
+ *
+ *           This is normally called at start-up when reading from DIP-switch
+ *           settings.
+ *
+ * @param    currentmA
+ */
+Status EnergyEvseDelegate::hwSetCircuitCapacity(int64_t currentmA)
+{
+    if (currentmA < MAX_CURRENT_LOWER_BOUND || currentmA > MAX_CURRENT_UPPER_BOUND)
+    {
+        return Status::ConstraintError;
+    }
+
+    mCircuitCapacity = currentmA;
+    MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, CircuitCapacity::Id);
+
+    return this->ComputeMaxChargeCurrentLimit();
+}
+
+/**
+ * @brief    Called by EVSE Hardware to notify the delegate of the cable assembly
+ *           current limit.
+ *
+ *           This is normally called when the EV is plugged into the EVSE and the
+ *           PP voltage is measured by the EVSE. A pull-up resistor in the cable
+ *           causes a voltage drop. Different current limits can be indicated
+ *           using different resistors, which results in different voltages
+ *           measured by the EVSE.
+ *
+ * @param    currentmA
+ */
+Status EnergyEvseDelegate::hwSetCableAssemblyLimit(int64_t currentmA)
+{
+    if (currentmA < MAX_CURRENT_LOWER_BOUND || currentmA > MAX_CURRENT_UPPER_BOUND)
+    {
+        return Status::ConstraintError;
+    }
+
+    /* there is no attribute to store this so store in private variable */
+    mCableAssemblyCurrentLimit = currentmA;
+
+    return this->ComputeMaxChargeCurrentLimit();
+}
+
+/**
+ * @brief    Called by EVSE Hardware to indicate a fault
+ *
+ * @param    StateEnum
+ */
+Status EnergyEvseDelegate::hwSetState(StateEnum state)
+{
+    /* the only allowed states that the EVSE hardware can set are:
+     *  kNotPluggedIn
+     *  kPluggedInNoDemand
+     *  kPluggedInDemand
+     */
+    switch (state)
+    {
+    case StateEnum::kNotPluggedIn:
+        // TODO - work out logic here
+        mHwState = state;
+        break;
+    case StateEnum::kPluggedInNoDemand:
+        // TODO - work out logic here
+        mHwState = state;
+        break;
+    case StateEnum::kPluggedInDemand:
+        // TODO - work out logic here
+        mHwState = state;
+        break;
+
+    default:
+        /* All other states should be managed by the Delegate */
+        // TODO (assert?)
+        break;
+    }
+
+    return Status::Success;
+}
+
+/**
+ * @brief    Called by EVSE Hardware to indicate a fault
+ *
+ * @param    FaultStateEnum
+ */
+Status EnergyEvseDelegate::hwSetFault(FaultStateEnum fault)
+{
+    ChipLogProgress(AppServer, "EnergyEvseDelegate::Fault()");
+
+    if (fault == FaultStateEnum::kNoError)
+    {
+        /* Update State to previous state */
+        // TODO: need to work out the logic here!
+
+        /* Update SupplyState to previous state */
+    }
+    else
+    {
+        /* Update State & SupplyState */
+        SetState(StateEnum::kFault);
+        SetSupplyState(SupplyStateEnum::kDisabledError);
+    }
+
+    /* Update FaultState */
+    SetFaultState(fault);
+
+    // TODO: Generate events
+
+    return Status::Success;
+}
+
+/* ---------------------------------------------------------------------------
+ * Functions below are private helper functions internal to the delegate
+ */
+
+/**
+ *  @brief   Called to compute the safe charging current limit
+ */
+Status EnergyEvseDelegate::ComputeMaxChargeCurrentLimit()
+{
+    int64_t oldValue;
+    /* mActualChargingCurrentLimit is the minimum of:
+     *   - MaxHardwareCurrentLimit (of the hardware)
+     *   - CircuitCapacity (set by the electrician - less than the hardware)
+     *   - CableAssemblyLimit (detected when the cable is inserted)
+     *   - MaximumChargeCurrent (from charging command)
+     *   - UserMaximumChargeCurrent (could dynamically change)
+     */
+
+    oldValue                    = mActualChargingCurrentLimit;
+    mActualChargingCurrentLimit = mMaxHardwareCurrentLimit;
+    mActualChargingCurrentLimit = min(mActualChargingCurrentLimit, mCircuitCapacity);
+    mActualChargingCurrentLimit = min(mActualChargingCurrentLimit, mCableAssemblyCurrentLimit);
+    mActualChargingCurrentLimit = min(mActualChargingCurrentLimit, mMaximumChargingCurrentLimitFromCommand);
+    mActualChargingCurrentLimit = min(mActualChargingCurrentLimit, mUserMaximumChargeCurrent);
+
+    /* Set the actual max charging current attribute */
+    mMaximumChargeCurrent = mActualChargingCurrentLimit;
+
+    if (oldValue != mMaximumChargeCurrent)
+    {
+        ChipLogDetail(AppServer, "MaximumChargeCurrent updated to %" PRId64, mMaximumChargeCurrent);
+        MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, MaximumChargeCurrent::Id);
+
+        /* Call the EV Charger hardware current limit callback */
+        // TODO
+    }
+    return Status::Success;
+}
+
+/**
+ * Attribute methods
+ */
+/* State */
+StateEnum EnergyEvseDelegate::GetState()
+{
+    return mState;
+}
+CHIP_ERROR EnergyEvseDelegate::SetState(StateEnum newValue)
+{
+    StateEnum oldValue = mState;
+    if (newValue >= StateEnum::kUnknownEnumValue)
+    {
+        return CHIP_IM_GLOBAL_STATUS(ConstraintError);
+    }
+
+    mState = newValue;
+    if (oldValue != mState)
+    {
+        ChipLogDetail(AppServer, "State updated to %d", (int) mState);
+        MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, State::Id);
+    }
+
+    return CHIP_NO_ERROR;
+}
+
+/* SupplyState */
+SupplyStateEnum EnergyEvseDelegate::GetSupplyState()
+{
+    return mSupplyState;
+}
+CHIP_ERROR EnergyEvseDelegate::SetSupplyState(SupplyStateEnum newValue)
+{
+    SupplyStateEnum oldValue = mSupplyState;
+
+    if (newValue >= SupplyStateEnum::kUnknownEnumValue)
+    {
+        return CHIP_IM_GLOBAL_STATUS(ConstraintError);
+    }
+
+    mSupplyState = newValue;
+    if (oldValue != mSupplyState)
+    {
+        ChipLogDetail(AppServer, "SupplyState updated to %d", (int) mSupplyState);
+        MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, SupplyState::Id);
+    }
+    return CHIP_NO_ERROR;
+}
+
+/* FaultState */
+FaultStateEnum EnergyEvseDelegate::GetFaultState()
+{
+    return mFaultState;
+}
+CHIP_ERROR EnergyEvseDelegate::SetFaultState(FaultStateEnum newValue)
+{
+    FaultStateEnum oldValue = mFaultState;
+
+    if (newValue >= FaultStateEnum::kUnknownEnumValue)
+    {
+        return CHIP_IM_GLOBAL_STATUS(ConstraintError);
+    }
+
+    mFaultState = newValue;
+    if (oldValue != mFaultState)
+    {
+        ChipLogDetail(AppServer, "FaultState updated to %d", (int) mFaultState);
+        MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, FaultState::Id);
+    }
+    return CHIP_NO_ERROR;
+}
+
+/* ChargingEnabledUntil */
+DataModel::Nullable<uint32_t> EnergyEvseDelegate::GetChargingEnabledUntil()
+{
+    return mChargingEnabledUntil;
+}
+CHIP_ERROR EnergyEvseDelegate::SetChargingEnabledUntil(uint32_t newValue)
+{
+    DataModel::Nullable<uint32_t> oldValue = mChargingEnabledUntil;
+
+    mChargingEnabledUntil = MakeNullable(newValue);
+    if ((oldValue.IsNull()) || (oldValue.Value() != newValue))
+    {
+        ChipLogDetail(AppServer, "ChargingEnabledUntil updated to %d", mChargingEnabledUntil.Value());
+        MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, ChargingEnabledUntil::Id);
+    }
+    return CHIP_NO_ERROR;
+}
+/* DischargingEnabledUntil */
+DataModel::Nullable<uint32_t> EnergyEvseDelegate::GetDischargingEnabledUntil()
+{
+    return mDischargingEnabledUntil;
+}
+CHIP_ERROR EnergyEvseDelegate::SetDischargingEnabledUntil(uint32_t newValue)
+{
+    DataModel::Nullable<uint32_t> oldValue = mDischargingEnabledUntil;
+
+    mDischargingEnabledUntil = MakeNullable(newValue);
+    if ((oldValue.IsNull()) || (oldValue.Value() != newValue))
+    {
+        ChipLogDetail(AppServer, "DischargingEnabledUntil updated to %d", mDischargingEnabledUntil.Value());
+        MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, DischargingEnabledUntil::Id);
+    }
+    return CHIP_NO_ERROR;
+}
+/* CircuitCapacity */
+int64_t EnergyEvseDelegate::GetCircuitCapacity()
+{
+    return mCircuitCapacity;
+}
+CHIP_ERROR EnergyEvseDelegate::SetCircuitCapacity(int64_t newValue)
+{
+    int64_t oldValue = mCircuitCapacity;
+
+    if (newValue >= kMaximumChargeCurrent)
+    {
+        return CHIP_IM_GLOBAL_STATUS(ConstraintError);
+    }
+
+    mCircuitCapacity = newValue;
+    if (oldValue != mCircuitCapacity)
+    {
+        ChipLogDetail(AppServer, "CircuitCapacity updated to %" PRId64, mCircuitCapacity);
+        MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, CircuitCapacity::Id);
+    }
+    return CHIP_NO_ERROR;
+}
+/* MinimumChargeCurrent */
+int64_t EnergyEvseDelegate::GetMinimumChargeCurrent()
+{
+    return mMinimumChargeCurrent;
+}
+CHIP_ERROR EnergyEvseDelegate::SetMinimumChargeCurrent(int64_t newValue)
+{
+    int64_t oldValue = mMinimumChargeCurrent;
+
+    if (newValue >= kMaximumChargeCurrent)
+    {
+        return CHIP_IM_GLOBAL_STATUS(ConstraintError);
+    }
+
+    mMinimumChargeCurrent = newValue;
+    if (oldValue != mMinimumChargeCurrent)
+    {
+        ChipLogDetail(AppServer, "MinimumChargeCurrent updated to %" PRId64, mMinimumChargeCurrent);
+        MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, MinimumChargeCurrent::Id);
+    }
+    return CHIP_NO_ERROR;
+}
+
+/* MaximumChargeCurrent */
+int64_t EnergyEvseDelegate::GetMaximumChargeCurrent()
+{
+    return mMaximumChargeCurrent;
+}
+CHIP_ERROR EnergyEvseDelegate::SetMaximumChargeCurrent(int64_t newValue)
+{
+    int64_t oldValue = mMaximumChargeCurrent;
+
+    if (newValue >= kMaximumChargeCurrent)
+    {
+        return CHIP_IM_GLOBAL_STATUS(ConstraintError);
+    }
+
+    mMaximumChargeCurrent = newValue;
+    if (oldValue != mMaximumChargeCurrent)
+    {
+        ChipLogDetail(AppServer, "MaximumChargeCurrent updated to %" PRId64, mMaximumChargeCurrent);
+        MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, MaximumChargeCurrent::Id);
+    }
+    return CHIP_NO_ERROR;
+}
+/* MaximumDischargeCurrent */
+int64_t EnergyEvseDelegate::GetMaximumDischargeCurrent()
+{
+    return mMaximumDischargeCurrent;
+}
+CHIP_ERROR EnergyEvseDelegate::SetMaximumDischargeCurrent(int64_t newValue)
+{
+    int64_t oldValue = mMaximumDischargeCurrent;
+
+    if (newValue >= kMaximumChargeCurrent)
+    {
+        return CHIP_IM_GLOBAL_STATUS(ConstraintError);
+    }
+
+    mMaximumDischargeCurrent = newValue;
+    if (oldValue != mMaximumDischargeCurrent)
+    {
+        ChipLogDetail(AppServer, "MaximumDischargeCurrent updated to %" PRId64, mMaximumDischargeCurrent);
+        MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, MaximumDischargeCurrent::Id);
+    }
+    return CHIP_NO_ERROR;
+}
+/* UserMaximumChargeCurrent */
+int64_t EnergyEvseDelegate::GetUserMaximumChargeCurrent()
+{
+    return mUserMaximumChargeCurrent;
+}
+CHIP_ERROR EnergyEvseDelegate::SetUserMaximumChargeCurrent(int64_t newValue)
+{
+    if ((newValue < 0) || (newValue > kMaximumChargeCurrent))
+    {
+        return CHIP_IM_GLOBAL_STATUS(ConstraintError);
+    }
+
+    int64_t oldValue          = mUserMaximumChargeCurrent;
+    mUserMaximumChargeCurrent = newValue;
+    if (oldValue != newValue)
+    {
+        ChipLogDetail(AppServer, "UserMaximumChargeCurrent updated to %" PRId64, mUserMaximumChargeCurrent);
+        MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, UserMaximumChargeCurrent::Id);
+    }
+
+    return CHIP_NO_ERROR;
+}
+/* RandomizationDelayWindow */
+uint32_t EnergyEvseDelegate::GetRandomizationDelayWindow()
+{
+    return mRandomizationDelayWindow;
+}
+CHIP_ERROR EnergyEvseDelegate::SetRandomizationDelayWindow(uint32_t newValue)
+{
+    uint32_t oldValue = mRandomizationDelayWindow;
+    if (newValue > kMaxRandomizationDelayWindow)
+    {
+        return CHIP_IM_GLOBAL_STATUS(ConstraintError);
+    }
+
+    mRandomizationDelayWindow = newValue;
+    if (oldValue != newValue)
+    {
+        ChipLogDetail(AppServer, "RandomizationDelayWindow updated to %d", mRandomizationDelayWindow);
+        MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, RandomizationDelayWindow::Id);
+    }
+    return CHIP_NO_ERROR;
+}
+
+/* PREF attributes */
+uint8_t EnergyEvseDelegate::GetNumberOfWeeklyTargets()
+{
+    return mNumberOfWeeklyTargets;
+}
+uint8_t EnergyEvseDelegate::GetNumberOfDailyTargets()
+{
+    return mNumberOfDailyTargets;
+}
+DataModel::Nullable<uint32_t> EnergyEvseDelegate::GetNextChargeStartTime()
+{
+    return mNextChargeStartTime;
+}
+DataModel::Nullable<uint32_t> EnergyEvseDelegate::GetNextChargeTargetTime()
+{
+    return mNextChargeTargetTime;
+}
+DataModel::Nullable<int64_t> EnergyEvseDelegate::GetNextChargeRequiredEnergy()
+{
+    return mNextChargeRequiredEnergy;
+}
+DataModel::Nullable<chip::Percent> EnergyEvseDelegate::GetNextChargeTargetSoC()
+{
+    return mNextChargeTargetSoC;
+}
+
+/* ApproximateEVEfficiency */
+DataModel::Nullable<uint16_t> EnergyEvseDelegate::GetApproximateEVEfficiency()
+{
+    return mApproximateEVEfficiency;
+}
+CHIP_ERROR EnergyEvseDelegate::SetApproximateEVEfficiency(uint16_t newValue)
+{
+    DataModel::Nullable<uint16_t> oldValue = mApproximateEVEfficiency;
+
+    mApproximateEVEfficiency = MakeNullable(newValue);
+    if ((oldValue.IsNull()) || (oldValue.Value() != newValue))
+    {
+        ChipLogDetail(AppServer, "ApproximateEVEfficiency updated to %d", mApproximateEVEfficiency.Value());
+        MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, ApproximateEVEfficiency::Id);
+    }
+
+    return CHIP_NO_ERROR;
+}
+
+/* SOC attributes */
+DataModel::Nullable<chip::Percent> EnergyEvseDelegate::GetStateOfCharge()
+{
+    return mStateOfCharge;
+}
+DataModel::Nullable<int64_t> EnergyEvseDelegate::GetBatteryCapacity()
+{
+    return mBatteryCapacity;
+}
+
+/* PNC attributes*/
+char * EnergyEvseDelegate::GetVehicleID()
+{
+    // TODO handle this properly
+    return mVehicleID;
+}
+
+/* Session SESS attributes */
+DataModel::Nullable<uint32_t> EnergyEvseDelegate::GetSessionID()
+{
+    return mSessionID;
+}
+DataModel::Nullable<uint32_t> EnergyEvseDelegate::GetSessionDuration()
+{
+    return mSessionDuration;
+}
+DataModel::Nullable<int64_t> EnergyEvseDelegate::GetSessionEnergyCharged()
+{
+    return mSessionEnergyCharged;
+}
+DataModel::Nullable<int64_t> EnergyEvseDelegate::GetSessionEnergyDischarged()
+{
+    return mSessionEnergyDischarged;
+}
\ No newline at end of file
diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp
new file mode 100644
index 00000000000000..c9d3a0eb5329a3
--- /dev/null
+++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp
@@ -0,0 +1,39 @@
+/*
+ *
+ *    Copyright (c) 2023 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 <EnergyEvseManager.h>
+
+using namespace chip::app;
+using namespace chip::app::Clusters;
+using namespace chip::app::Clusters::EnergyEvse;
+
+void EnergyEvseManager::Shutdown()
+{
+    GetInstance()->Instance::Shutdown();
+    // TODO  delete mDelegate;
+    // TODO  delete mInstance;
+}
+
+CHIP_ERROR EnergyEvseManager::Init()
+{
+    // TODO - add custom initialization
+    GetInstance()->Instance::Init();
+    return CHIP_NO_ERROR;
+}
+
+void MatterEnergyEvsePluginServerInitCallback() {}
\ No newline at end of file
diff --git a/examples/energy-management-app/energy-management-common/src/EnergyManagementManager.cpp b/examples/energy-management-app/energy-management-common/src/EnergyManagementManager.cpp
new file mode 100644
index 00000000000000..884a5bcf5b65ce
--- /dev/null
+++ b/examples/energy-management-app/energy-management-common/src/EnergyManagementManager.cpp
@@ -0,0 +1,18 @@
+/*
+ *
+ *    Copyright (c) 2023 Project CHIP Authors
+ *    Copyright (c) 2019 Google LLC.
+ *    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.
+ */
diff --git a/examples/energy-management-app/linux/.gn b/examples/energy-management-app/linux/.gn
new file mode 100644
index 00000000000000..5d1ce757507582
--- /dev/null
+++ b/examples/energy-management-app/linux/.gn
@@ -0,0 +1,25 @@
+# Copyright (c) 2020 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.
+
+import("//build_overrides/build.gni")
+
+# The location of the build configuration file.
+buildconfig = "${build_root}/config/BUILDCONFIG.gn"
+
+# CHIP uses angle bracket includes.
+check_system_includes = true
+
+default_args = {
+  import("//args.gni")
+}
diff --git a/examples/energy-management-app/linux/BUILD.gn b/examples/energy-management-app/linux/BUILD.gn
new file mode 100644
index 00000000000000..84a856584202c1
--- /dev/null
+++ b/examples/energy-management-app/linux/BUILD.gn
@@ -0,0 +1,125 @@
+# 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.
+
+import("//build_overrides/chip.gni")
+
+import("${chip_root}/build/chip/tools.gni")
+import("${chip_root}/src/app/common_flags.gni")
+import("${chip_root}/third_party/imgui/imgui.gni")
+
+assert(chip_build_tools)
+
+import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")
+
+if (chip_enable_pw_rpc) {
+  import("//build_overrides/pigweed.gni")
+  import("$dir_pw_build/target_types.gni")
+}
+
+config("includes") {
+  include_dirs = [
+    ".",
+    "include",
+  ]
+}
+
+executable("chip-energy-management-app") {
+  sources = [
+    "${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/EVSEManufacturerImpl.cpp",
+    "include/CHIPProjectAppConfig.h",
+    "main.cpp",
+  ]
+
+  deps = [
+    "${chip_root}/examples/energy-management-app/energy-management-common",
+    "${chip_root}/examples/platform/linux:app-main",
+    "${chip_root}/src/lib",
+  ]
+
+  if (chip_examples_enable_imgui_ui) {
+    deps += [
+      "${chip_root}/examples/common/imgui_ui",
+      "${chip_root}/examples/common/imgui_ui/windows:occupancy_sensing",
+      "${chip_root}/examples/common/imgui_ui/windows:qrcode",
+    ]
+  }
+
+  include_dirs = [
+   "include",
+   "${chip_root}/examples/energy-management-app/energy-management-common/include"
+  ]
+
+  if (chip_enable_pw_rpc) {
+    defines = [
+      "PW_RPC_ENABLED",
+      "PW_RPC_ATTRIBUTE_SERVICE=1",
+      "PW_RPC_BUTTON_SERVICE=1",
+      "PW_RPC_DESCRIPTOR_SERVICE=1",
+      "PW_RPC_DEVICE_SERVICE=1",
+      "PW_RPC_ELEC_SERVICE=1",
+      "PW_RPC_EVSE_SERVICE=1",
+      "PW_RPC_LIGHTING_SERVICE=1",
+      "PW_RPC_TRACING_SERVICE=1",
+    ]
+
+    sources += [
+      "${chip_root}/examples/platform/linux/Rpc.cpp",
+      "${chip_root}/examples/platform/linux/system_rpc_server.cc",
+    ]
+
+    deps += [
+      "$dir_pw_hdlc:pw_rpc",
+      "$dir_pw_hdlc:rpc_channel_output",
+      "$dir_pw_log",
+      "$dir_pw_rpc:server",
+      "$dir_pw_rpc/system_server:facade",
+      "$dir_pw_stream:socket_stream",
+      "$dir_pw_stream:sys_io_stream",
+      "$dir_pw_sync:mutex",
+      "$dir_pw_trace",
+      "$dir_pw_trace_tokenized",
+      "$dir_pw_trace_tokenized:trace_rpc_service",
+      "${chip_root}/config/linux/lib/pw_rpc:pw_rpc",
+      "${chip_root}/examples/common/pigweed:attributes_service.nanopb_rpc",
+      "${chip_root}/examples/common/pigweed:button_service.nanopb_rpc",
+      "${chip_root}/examples/common/pigweed:elec_service.nanopb_rpc",
+      "${chip_root}/examples/common/pigweed:evse_service.nanopb_rpc",
+      "${chip_root}/examples/common/pigweed:descriptor_service.nanopb_rpc",
+      "${chip_root}/examples/common/pigweed:device_service.nanopb_rpc",
+      "${chip_root}/examples/common/pigweed:lighting_service.nanopb_rpc",
+      "${chip_root}/examples/common/pigweed:rpc_services",
+    ]
+
+    deps += pw_build_LINK_DEPS
+
+    include_dirs += [ "${chip_root}/examples/common" ]
+  } else {
+    # The system_rpc_server.cc file is in pigweed and doesn't compile with
+    # -Wconversion, remove check for RPC build only.
+    cflags = [ "-Wconversion" ]
+  }
+
+  output_dir = root_out_dir
+}
+
+group("linux") {
+  deps = [ ":chip-energy-management-app" ]
+}
+
+group("default") {
+  deps = [ ":linux" ]
+}
diff --git a/examples/energy-management-app/linux/README.md b/examples/energy-management-app/linux/README.md
new file mode 100644
index 00000000000000..2cd3e82527ff79
--- /dev/null
+++ b/examples/energy-management-app/linux/README.md
@@ -0,0 +1,143 @@
+# CHIP Linux Energy Management Example
+
+An example showing the use of CHIP on the Linux. The document will describe how
+to build and run CHIP Linux Energy Management Example on Raspberry Pi. This doc is tested
+on **Ubuntu for Raspberry Pi Server 20.04 LTS (aarch64)** and **Ubuntu for
+Raspberry Pi Desktop 20.10 (aarch64)**
+
+To cross-compile this example on x64 host and run on **NXP i.MX 8M Mini**
+**EVK**, see the associated
+[README document](../../../docs/guides/nxp_imx8m_linux_examples.md) for details.
+
+<hr>
+
+-   [CHIP Linux Energy Management Example](#chip-linux-energy-management-example)
+    -   [Building](#building)
+    -   [Commandline Arguments](#commandline-arguments)
+    -   [Running the Complete Example on Raspberry Pi 4](#running-the-complete-example-on-raspberry-pi-4)
+    -   [Running RPC console](#running-rpc-console)
+    -   [Device Tracing](#device-tracing)
+
+<hr>
+
+## Building
+
+-   Install tool chain
+
+          $ sudo apt-get install git gcc g++ python pkg-config libssl-dev libdbus-1-dev libglib2.0-dev ninja-build python3-venv python3-dev unzip
+
+-   Build the example application:
+
+          $ cd ~/connectedhomeip/examples/energy-management-app/linux
+          $ git submodule update --init
+          $ source third_party/connectedhomeip/scripts/activate.sh
+          $ gn gen out/debug
+          $ ninja -C out/debug
+
+-   To delete generated executable, libraries and object files use:
+
+          $ cd ~/connectedhomeip/examples/energy-management-app/linux
+          $ rm -rf out/
+
+-   Build the example with pigweed RPC
+
+          $ cd ~/connectedhomeip/examples/energy-management-app/linux
+          $ git submodule update --init
+          $ source third_party/connectedhomeip/scripts/activate.sh
+          $ gn gen out/debug --args='import("//with_pw_rpc.gni")'
+          $ ninja -C out/debug
+
+## Commandline arguments
+
+-   `--wifi`
+
+    Enables WiFi management feature. Required for WiFi commissioning.
+
+-   `--thread`
+
+    Enables Thread management feature, requires ot-br-posix dbus daemon running.
+    Required for Thread commissioning.
+
+-   `--ble-device <interface id>`
+
+    Use specific bluetooth interface for BLE advertisement and connections.
+
+    `interface id`: the number after `hci` when listing BLE interfaces by
+    `hciconfig` command, for example, `--ble-device 1` means using `hci1`
+    interface. Default: `0`.
+
+## Running the Complete Example on Raspberry Pi 4
+
+> If you want to test Echo protocol, please enable Echo handler
+>
+>     gn gen out/debug --args='chip_app_use_echo=true'
+>     ninja -C out/debug
+
+-   Prerequisites
+
+    1. A Raspberry Pi 4 board
+    2. A USB Bluetooth Dongle, Ubuntu desktop will send Bluetooth advertisement,
+       which will block CHIP from connecting via BLE. On Ubuntu server, you need
+       to install `pi-bluetooth` via APT.
+    3. Ubuntu 20.04 or newer image for ARM64 platform.
+
+-   Building
+
+    Follow [Building](#building) section of this document.
+
+-   Running
+
+    -   [Optional] Plug USB Bluetooth dongle
+
+        -   Plug USB Bluetooth dongle and find its bluetooth device number. The
+            number after `hci` is the bluetooth device number, `1` in this
+            example.
+
+                  $ hciconfig
+                  hci1:	Type: Primary  Bus: USB
+                      BD Address: 00:1A:7D:AA:BB:CC  ACL MTU: 310:10  SCO MTU: 64:8
+                      UP RUNNING PSCAN ISCAN
+                      RX bytes:20942 acl:1023 sco:0 events:1140 errors:0
+                      TX bytes:16559 acl:1011 sco:0 commands:121 errors:0
+
+                  hci0:	Type: Primary  Bus: UART
+                      BD Address: B8:27:EB:AA:BB:CC  ACL MTU: 1021:8  SCO MTU: 64:1
+                      UP RUNNING PSCAN ISCAN
+                      RX bytes:8609495 acl:14 sco:0 events:217484 errors:0
+                      TX bytes:92185 acl:20 sco:0 commands:5259 errors:0
+
+        -   Run Linux Energy Management Example App
+
+                  $ cd ~/connectedhomeip/examples/energy-management-app/linux
+                  $ sudo out/debug/chip-energy-management-app --ble-device [bluetooth device number]
+                  # In this example, the device we want to use is hci1
+                  $ sudo out/debug/chip-energy-management-app --ble-device 1
+
+        -   Test the device using ChipDeviceController on your laptop /
+            workstation etc.
+
+## Running RPC Console
+
+-   As part of building the example with RPCs enabled the chip_rpc python
+    interactive console is installed into your venv. The python wheel files are
+    also created in the output folder: out/debug/chip_rpc_console_wheels. To
+    install the wheel files without rebuilding:
+    `pip3 install out/debug/chip_rpc_console_wheels/*.whl`
+
+-   To use the chip-rpc console after it has been installed run:
+    `chip-console -s localhost:33000 -o /<YourFolder>/pw_log.out`
+
+-   Then you can Get and Set the Energy Management using the RPCs:
+    `rpcs.chip.rpc.EnergyManagement.Get()`
+
+## Device Tracing
+
+Device tracing is available to analyze the device performance. To turn on
+tracing, build with RPC enabled. See [Building with RPC enabled](#building).
+
+Obtain tracing json file.
+
+```
+    $ ./{PIGWEED_REPO}/pw_trace_tokenized/py/pw_trace_tokenized/get_trace.py -s localhost:33000 \
+     -o {OUTPUT_FILE} -t {ELF_FILE} {PIGWEED_REPO}/pw_trace_tokenized/pw_trace_protos/trace_rpc.proto
+```
diff --git a/examples/energy-management-app/linux/args.gni b/examples/energy-management-app/linux/args.gni
new file mode 100644
index 00000000000000..479753404455c1
--- /dev/null
+++ b/examples/energy-management-app/linux/args.gni
@@ -0,0 +1,31 @@
+# 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.
+
+# CHIPProjectConfig.h
+
+import("//build_overrides/chip.gni")
+
+import("${chip_root}/config/standalone/args.gni")
+
+chip_device_project_config_include = "<CHIPProjectAppConfig.h>"
+chip_project_config_include = "<CHIPProjectAppConfig.h>"
+chip_system_project_config_include = "<SystemProjectConfig.h>"
+
+chip_project_config_include_dirs =
+    [ "${chip_root}/examples/energy-management-app/linux/include" ]
+chip_project_config_include_dirs += [ "${chip_root}/config/standalone" ]
+
+matter_enable_tracing_support = true
+
+chip_enable_read_client = false
\ No newline at end of file
diff --git a/examples/energy-management-app/linux/build_overrides b/examples/energy-management-app/linux/build_overrides
new file mode 120000
index 00000000000000..e578e73312ebd1
--- /dev/null
+++ b/examples/energy-management-app/linux/build_overrides
@@ -0,0 +1 @@
+../../build_overrides
\ No newline at end of file
diff --git a/examples/energy-management-app/linux/include/CHIPProjectAppConfig.h b/examples/energy-management-app/linux/include/CHIPProjectAppConfig.h
new file mode 100644
index 00000000000000..f22628d0f69def
--- /dev/null
+++ b/examples/energy-management-app/linux/include/CHIPProjectAppConfig.h
@@ -0,0 +1,49 @@
+/*
+ *
+ *    Copyright (c) 2020 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.
+ */
+
+/**
+ *    @file
+ *          Example project configuration file for CHIP.
+ *
+ *          This is a place to put application or project-specific overrides
+ *          to the default configuration values for general CHIP features.
+ *
+ */
+
+#pragma once
+
+// include the CHIPProjectConfig from config/standalone
+#include <CHIPProjectConfig.h>
+
+#define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY 0
+
+// Bulbs do not typically use this - enabled so we can use shell to discover commissioners
+#define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY_CLIENT 1
+
+#define CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY 1
+
+#define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONABLE_DEVICE_TYPE 1
+
+// TODO We don’t have one yet - but we’d need to change this
+#define CHIP_DEVICE_CONFIG_DEVICE_TYPE 257 // 0x0101 = 257 = Dimmable Bulb
+
+#define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONABLE_DEVICE_NAME 1
+
+#define CHIP_DEVICE_ENABLE_PORT_PARAMS 1
+
+#define CHIP_DEVICE_CONFIG_DEVICE_NAME "Test Energy Management"
diff --git a/examples/energy-management-app/linux/main.cpp b/examples/energy-management-app/linux/main.cpp
new file mode 100644
index 00000000000000..93c9866fd998dc
--- /dev/null
+++ b/examples/energy-management-app/linux/main.cpp
@@ -0,0 +1,97 @@
+/*
+ *
+ *    Copyright (c) 2023 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 <AppMain.h>
+#include <EVSEManufacturerImpl.h>
+#include <EnergyEvseManager.h>
+#include <EnergyManagementManager.h>
+
+#include <app-common/zap-generated/ids/Attributes.h>
+#include <app-common/zap-generated/ids/Clusters.h>
+#include <app/ConcreteAttributePath.h>
+#include <app/clusters/network-commissioning/network-commissioning.h>
+#include <app/server/Server.h>
+#include <lib/support/logging/CHIPLogging.h>
+#include <platform/Linux/NetworkCommissioningDriver.h>
+
+#define ENERGY_EVSE_ENDPOINT 1
+
+using namespace chip;
+using namespace chip::app;
+using namespace chip::app::Clusters;
+
+static EnergyEvseDelegate * gDelegate       = nullptr;
+static EnergyEvseManager * gInstance        = nullptr;
+static EVSEManufacturer * gEvseManufacturer = nullptr;
+
+void ApplicationInit()
+{
+    if ((gDelegate == nullptr) && (gInstance == nullptr))
+    {
+        gDelegate = new EnergyEvseDelegate();
+        if (gDelegate != nullptr)
+        {
+            gInstance = new EnergyEvseManager(EndpointId(ENERGY_EVSE_ENDPOINT), *gDelegate);
+            gInstance->Init(); /* Register Attribute & Command handlers */
+        }
+    }
+    else
+    {
+        ChipLogError(AppServer, "EVSE Instance or Delegate already exist.")
+    }
+
+    if (gEvseManufacturer == nullptr)
+    {
+        gEvseManufacturer = new EVSEManufacturer();
+        gEvseManufacturer->Init(gInstance);
+    }
+    else
+    {
+        ChipLogError(AppServer, "EVSEManufacturer already exists.")
+    }
+}
+
+void ApplicationShutdown()
+{
+    ChipLogDetail(AppServer, "Energy Management App: ApplicationShutdown()");
+
+    /* Shutdown the EVSEManufacturer*/
+    gEvseManufacturer->Shutdown(gInstance);
+
+    /* Shutdown the Instance - deregister attribute & command handler */
+    gInstance->Shutdown();
+
+    delete gEvseManufacturer;
+    delete gInstance;
+    delete gDelegate;
+    gEvseManufacturer = nullptr;
+    gInstance         = nullptr;
+    gDelegate         = nullptr;
+}
+
+int main(int argc, char * argv[])
+{
+    if (ChipLinuxAppInit(argc, argv) != 0)
+    {
+        return -1;
+    }
+
+    ChipLinuxAppMainLoop();
+
+    return 0;
+}
diff --git a/examples/energy-management-app/linux/third_party/connectedhomeip b/examples/energy-management-app/linux/third_party/connectedhomeip
new file mode 120000
index 00000000000000..11a54ed360106c
--- /dev/null
+++ b/examples/energy-management-app/linux/third_party/connectedhomeip
@@ -0,0 +1 @@
+../../../../
\ No newline at end of file
diff --git a/src/app/clusters/energy-evse-server/energy-evse-server.cpp b/src/app/clusters/energy-evse-server/energy-evse-server.cpp
new file mode 100644
index 00000000000000..8ba0b9c91136cf
--- /dev/null
+++ b/src/app/clusters/energy-evse-server/energy-evse-server.cpp
@@ -0,0 +1,330 @@
+/*
+ *    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.
+ */
+
+#include "energy-evse-server.h"
+
+#include <app/AttributeAccessInterface.h>
+#include <app/ConcreteAttributePath.h>
+#include <app/InteractionModelEngine.h>
+#include <app/util/attribute-storage.h>
+
+using namespace chip;
+using namespace chip::app;
+using namespace chip::app::Clusters;
+using namespace chip::app::Clusters::EnergyEvse;
+using namespace chip::app::Clusters::EnergyEvse::Attributes;
+using chip::Protocols::InteractionModel::Status;
+
+namespace chip {
+namespace app {
+namespace Clusters {
+namespace EnergyEvse {
+
+Instance::Instance(EndpointId aEndpointId, Delegate & aDelegate) :
+    AttributeAccessInterface(MakeOptional(aEndpointId), Id), CommandHandlerInterface(MakeOptional(aEndpointId), Id),
+    mDelegate(aDelegate), mEndpointId(aEndpointId)
+{
+    /* set the base class delegates endpointId */
+    mDelegate.SetEndpointId(aEndpointId);
+}
+
+Instance::~Instance()
+{
+    Shutdown();
+}
+
+CHIP_ERROR Instance::Init()
+{
+    registerAttributeAccessOverride(this);
+    InteractionModelEngine::GetInstance()->RegisterCommandHandler(this);
+    return CHIP_NO_ERROR;
+}
+
+void Instance::Shutdown()
+{
+    unregisterAttributeAccessOverride(this);
+    InteractionModelEngine::GetInstance()->UnregisterCommandHandler(this);
+}
+
+bool Instance::HasFeature(Feature aFeature) const
+{
+    return mFeature.Has(aFeature);
+}
+
+// AttributeAccessInterface
+CHIP_ERROR Instance::Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder)
+{
+    switch (aPath.mAttributeId)
+    {
+    case State::Id:
+        return aEncoder.Encode(mDelegate.GetState());
+    case SupplyState::Id:
+        return aEncoder.Encode(mDelegate.GetSupplyState());
+    case FaultState::Id:
+        return aEncoder.Encode(mDelegate.GetFaultState());
+    case ChargingEnabledUntil::Id:
+        return aEncoder.Encode(mDelegate.GetChargingEnabledUntil());
+    case DischargingEnabledUntil::Id:
+        /* V2X */
+        return aEncoder.Encode(mDelegate.GetDischargingEnabledUntil());
+    case CircuitCapacity::Id:
+        return aEncoder.Encode(mDelegate.GetCircuitCapacity());
+    case MinimumChargeCurrent::Id:
+        return aEncoder.Encode(mDelegate.GetMinimumChargeCurrent());
+    case MaximumChargeCurrent::Id:
+        return aEncoder.Encode(mDelegate.GetMaximumChargeCurrent());
+    case MaximumDischargeCurrent::Id:
+        /* V2X */
+        return aEncoder.Encode(mDelegate.GetMaximumDischargeCurrent());
+    case UserMaximumChargeCurrent::Id:
+        /* PREF */
+        return aEncoder.Encode(mDelegate.GetUserMaximumChargeCurrent());
+    case RandomizationDelayWindow::Id:
+        /* Optional */
+        return aEncoder.Encode(mDelegate.GetRandomizationDelayWindow());
+
+    /* PREF attributes */
+    case NumberOfWeeklyTargets::Id:
+        return aEncoder.Encode(mDelegate.GetNumberOfWeeklyTargets());
+    case NumberOfDailyTargets::Id:
+        return aEncoder.Encode(mDelegate.GetNumberOfDailyTargets());
+    case NextChargeStartTime::Id:
+        return aEncoder.Encode(mDelegate.GetNextChargeStartTime());
+    case NextChargeTargetTime::Id:
+        return aEncoder.Encode(mDelegate.GetNextChargeTargetTime());
+
+    case NextChargeRequiredEnergy::Id:
+        return aEncoder.Encode(mDelegate.GetNextChargeRequiredEnergy());
+    case NextChargeTargetSoC::Id:
+        return aEncoder.Encode(mDelegate.GetNextChargeTargetSoC());
+    case ApproximateEVEfficiency::Id:
+        return aEncoder.Encode(mDelegate.GetApproximateEVEfficiency());
+
+    /* SOC attributes */
+    case StateOfCharge::Id:
+        return aEncoder.Encode(mDelegate.GetStateOfCharge());
+    case BatteryCapacity::Id:
+        return aEncoder.Encode(mDelegate.GetBatteryCapacity());
+
+    /* PNC attributes*/
+    case VehicleID::Id:
+        // TODO return aEncoder.Encode(mDelegate.GetVehicleID());
+
+    /* Session SESS attributes */
+    case SessionID::Id:
+        return aEncoder.Encode(mDelegate.GetSessionID());
+    case SessionDuration::Id:
+        return aEncoder.Encode(mDelegate.GetSessionDuration());
+    case SessionEnergyCharged::Id:
+        return aEncoder.Encode(mDelegate.GetSessionEnergyCharged());
+    case SessionEnergyDischarged::Id:
+        return aEncoder.Encode(mDelegate.GetSessionEnergyDischarged());
+    }
+    /* Allow all other unhandled attributes to fall through to Ember */
+    return CHIP_NO_ERROR;
+}
+
+CHIP_ERROR Instance::Write(const ConcreteDataAttributePath & aPath, AttributeValueDecoder & aDecoder)
+{
+    switch (aPath.mAttributeId)
+    {
+    case UserMaximumChargeCurrent::Id: {
+        int64_t newValue;
+        ReturnErrorOnFailure(aDecoder.Decode(newValue));
+        ReturnErrorOnFailure(mDelegate.SetUserMaximumChargeCurrent(newValue));
+        return CHIP_NO_ERROR;
+    }
+    case RandomizationDelayWindow::Id: {
+        uint32_t newValue;
+        ReturnErrorOnFailure(aDecoder.Decode(newValue));
+        ReturnErrorOnFailure(mDelegate.SetRandomizationDelayWindow(newValue));
+        return CHIP_NO_ERROR;
+    }
+    case ApproximateEVEfficiency::Id: {
+        uint16_t newValue;
+        ReturnErrorOnFailure(aDecoder.Decode(newValue));
+        ReturnErrorOnFailure(mDelegate.SetApproximateEVEfficiency(newValue));
+        return CHIP_NO_ERROR;
+    }
+
+    default:
+        // Unknown attribute; return error.  None of the other attributes for
+        // this cluster are writable, so should not be ending up in this code to
+        // start with.
+        return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
+    }
+    return CHIP_NO_ERROR;
+}
+
+// CommandHandlerInterface
+
+CHIP_ERROR Instance::EnumerateAcceptedCommands(const ConcreteClusterPath & cluster, CommandIdCallback callback, void * context)
+{
+    using namespace Commands;
+
+    for (auto && id : {
+             Disable::Id,
+             EnableCharging::Id,
+             EnableDischarging::Id,
+             StartDiagnostics::Id,
+             SetTargets::Id,
+             GetTargets::Id,
+             ClearTargets::Id,
+         })
+    {
+        if (callback(id, context) == Loop::Break)
+        {
+            return CHIP_NO_ERROR;
+        }
+    }
+
+    return CHIP_NO_ERROR;
+}
+
+void Instance::InvokeCommand(HandlerContext & handlerContext)
+{
+    using namespace Commands;
+
+    switch (handlerContext.mRequestPath.mCommandId)
+    {
+    case Disable::Id:
+        HandleCommand<Disable::DecodableType>(
+            handlerContext, [this](HandlerContext & ctx, const auto & commandData) { HandleDisable(ctx, commandData); });
+        return;
+    case EnableCharging::Id:
+        HandleCommand<EnableCharging::DecodableType>(
+            handlerContext, [this](HandlerContext & ctx, const auto & commandData) { HandleEnableCharging(ctx, commandData); });
+        return;
+    case EnableDischarging::Id:
+        HandleCommand<EnableDischarging::DecodableType>(
+            handlerContext, [this](HandlerContext & ctx, const auto & commandData) { HandleEnableDischarging(ctx, commandData); });
+        return;
+    case StartDiagnostics::Id:
+        HandleCommand<StartDiagnostics::DecodableType>(
+            handlerContext, [this](HandlerContext & ctx, const auto & commandData) { HandleStartDiagnostics(ctx, commandData); });
+        return;
+    case SetTargets::Id:
+        HandleCommand<SetTargets::DecodableType>(
+            handlerContext, [this](HandlerContext & ctx, const auto & commandData) { HandleSetTargets(ctx, commandData); });
+        return;
+    case GetTargets::Id:
+        HandleCommand<GetTargets::DecodableType>(
+            handlerContext, [this](HandlerContext & ctx, const auto & commandData) { HandleGetTargets(ctx, commandData); });
+        return;
+    case ClearTargets::Id:
+        HandleCommand<ClearTargets::DecodableType>(
+            handlerContext, [this](HandlerContext & ctx, const auto & commandData) { HandleClearTargets(ctx, commandData); });
+        return;
+    }
+}
+
+void Instance::HandleDisable(HandlerContext & ctx, const Commands::Disable::DecodableType & commandData)
+{
+    // No parameters for this command
+    // Call the delegate
+    Status status = mDelegate.Disable();
+
+    ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status);
+}
+
+void Instance::HandleEnableCharging(HandlerContext & ctx, const Commands::EnableCharging::DecodableType & commandData)
+{
+    auto & chargingEnabledUntil = commandData.chargingEnabledUntil;
+    auto & minimumChargeCurrent = commandData.minimumChargeCurrent;
+    auto & maximumChargeCurrent = commandData.maximumChargeCurrent;
+
+    if ((minimumChargeCurrent < 0) || (minimumChargeCurrent > kMaximumChargeCurrent))
+    {
+        ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError);
+        return;
+    }
+
+    if ((maximumChargeCurrent < 0) || (maximumChargeCurrent > kMaximumChargeCurrent))
+    {
+        ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError);
+        return;
+    }
+
+    if (minimumChargeCurrent > maximumChargeCurrent)
+    {
+        ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError);
+        return;
+    }
+
+    // Call the delegate
+    Status status = mDelegate.EnableCharging(chargingEnabledUntil, minimumChargeCurrent, maximumChargeCurrent);
+
+    ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status);
+}
+
+void Instance::HandleEnableDischarging(HandlerContext & ctx, const Commands::EnableDischarging::DecodableType & commandData)
+{
+
+    auto & dischargingEnabledUntil = commandData.dischargingEnabledUntil;
+    auto & maximumDischargeCurrent = commandData.maximumDischargeCurrent;
+
+    if ((maximumDischargeCurrent < 0) || (maximumDischargeCurrent > kMaximumChargeCurrent))
+    {
+        ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError);
+        return;
+    }
+
+    // Call the delegate
+    Status status = mDelegate.EnableDischarging(dischargingEnabledUntil, maximumDischargeCurrent);
+
+    ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status);
+}
+void Instance::HandleStartDiagnostics(HandlerContext & ctx, const Commands::StartDiagnostics::DecodableType & commandData)
+{
+    // No parameters for this command
+    // Call the delegate
+    Status status = mDelegate.StartDiagnostics();
+
+    ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status);
+}
+
+void Instance::HandleSetTargets(HandlerContext & ctx, const Commands::SetTargets::DecodableType & commandData)
+{
+    // Call the delegate
+    // TODO
+    // Status status = mDelegate.SetTargets();
+    Status status = Status::UnsupportedCommand;
+
+    ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status);
+}
+void Instance::HandleGetTargets(HandlerContext & ctx, const Commands::GetTargets::DecodableType & commandData)
+{
+    // Call the delegate
+    // TODO
+    // Status status = mDelegate.GetTargets();
+    Status status = Status::UnsupportedCommand;
+
+    ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status);
+}
+void Instance::HandleClearTargets(HandlerContext & ctx, const Commands::ClearTargets::DecodableType & commandData)
+{
+    // Call the delegate
+    // TODO
+    // Status status = mDelegate.ClearTargets();
+    Status status = Status::UnsupportedCommand;
+
+    ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status);
+}
+
+} // namespace EnergyEvse
+} // namespace Clusters
+} // namespace app
+} // namespace chip
diff --git a/src/app/clusters/energy-evse-server/energy-evse-server.h b/src/app/clusters/energy-evse-server/energy-evse-server.h
new file mode 100644
index 00000000000000..9ae79a9c90215d
--- /dev/null
+++ b/src/app/clusters/energy-evse-server/energy-evse-server.h
@@ -0,0 +1,164 @@
+/*
+ *
+ *    Copyright (c) 2023 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 <app-common/zap-generated/cluster-objects.h>
+#include <app/AttributeAccessInterface.h>
+#include <app/CommandHandlerInterface.h>
+#include <app/ConcreteAttributePath.h>
+#include <app/InteractionModelEngine.h>
+#include <app/MessageDef/StatusIB.h>
+#include <app/reporting/reporting.h>
+#include <app/util/attribute-storage.h>
+#include <lib/core/CHIPError.h>
+
+namespace chip {
+namespace app {
+namespace Clusters {
+namespace EnergyEvse {
+
+// Spec-defined constraints
+constexpr int64_t kMinimumChargeCurrent         = 0;
+constexpr int64_t kMaximumChargeCurrent         = 80000;
+constexpr uint32_t kMaxRandomizationDelayWindow = 86400;
+
+using chip::Protocols::InteractionModel::Status;
+/** @brief
+ *    Defines methods for implementing application-specific logic for the EVSE Management Cluster.
+ */
+class Delegate
+{
+public:
+    virtual ~Delegate() = default;
+
+    void SetEndpointId(EndpointId aEndpoint) { mEndpointId = aEndpoint; }
+
+    /**
+     * @brief Delegate should implement a handler to disable the EVSE.
+     * It should report Status::Success if successful and may
+     * return other Status codes if it fails
+     */
+    virtual Status Disable() = 0;
+
+    /**
+     * @brief Delegate should implement a handler to enable EVSE Charging.
+     * It should report Status::Success if successful and may
+     * return other Status codes if it fails
+     */
+    virtual Status EnableCharging(const chip::app::DataModel::Nullable<uint32_t> & enableChargeTime,
+                                  const uint64_t & minimumChargeCurrent, const uint64_t & maximumChargeCurrent) = 0;
+
+    /**
+     * @brief Delegate should implement a handler to enable EVSE Discharging.
+     * It should report Status::Success if successful and may
+     * return other Status codes if it fails
+     */
+    virtual Status EnableDischarging(const chip::app::DataModel::Nullable<uint32_t> & enableDischargeTime,
+                                     const uint64_t & maximumDischargeCurrent) = 0;
+
+    /**
+     * @brief Delegate should implement a handler to enable EVSE Diagnostics.
+     * It should report Status::Success if successful and may
+     * return other Status codes if it fails
+     */
+    virtual Status StartDiagnostics() = 0;
+
+    // ------------------------------------------------------------------
+    // Get attribute methods
+    virtual StateEnum GetState()                                       = 0;
+    virtual SupplyStateEnum GetSupplyState()                           = 0;
+    virtual FaultStateEnum GetFaultState()                             = 0;
+    virtual DataModel::Nullable<uint32_t> GetChargingEnabledUntil()    = 0;
+    virtual DataModel::Nullable<uint32_t> GetDischargingEnabledUntil() = 0;
+    virtual int64_t GetCircuitCapacity()                               = 0;
+    virtual int64_t GetMinimumChargeCurrent()                          = 0;
+    virtual int64_t GetMaximumChargeCurrent()                          = 0;
+    virtual int64_t GetMaximumDischargeCurrent()                       = 0;
+    virtual int64_t GetUserMaximumChargeCurrent()                      = 0;
+    virtual uint32_t GetRandomizationDelayWindow()                     = 0;
+    /* PREF attributes */
+    virtual uint8_t GetNumberOfWeeklyTargets()                          = 0;
+    virtual uint8_t GetNumberOfDailyTargets()                           = 0;
+    virtual DataModel::Nullable<uint32_t> GetNextChargeStartTime()      = 0;
+    virtual DataModel::Nullable<uint32_t> GetNextChargeTargetTime()     = 0;
+    virtual DataModel::Nullable<int64_t> GetNextChargeRequiredEnergy()  = 0;
+    virtual DataModel::Nullable<chip::Percent> GetNextChargeTargetSoC() = 0;
+    virtual DataModel::Nullable<uint16_t> GetApproximateEVEfficiency()  = 0;
+
+    /* SOC attributes */
+    virtual DataModel::Nullable<chip::Percent> GetStateOfCharge() = 0;
+    virtual DataModel::Nullable<int64_t> GetBatteryCapacity()     = 0;
+
+    /* PNC attributes*/
+    // TODO make nullable
+    virtual char * GetVehicleID() = 0;
+
+    /* Session SESS attributes */
+    virtual DataModel::Nullable<uint32_t> GetSessionID()              = 0;
+    virtual DataModel::Nullable<uint32_t> GetSessionDuration()        = 0;
+    virtual DataModel::Nullable<int64_t> GetSessionEnergyCharged()    = 0;
+    virtual DataModel::Nullable<int64_t> GetSessionEnergyDischarged() = 0;
+
+    // ------------------------------------------------------------------
+    // Set attribute methods
+    virtual CHIP_ERROR SetUserMaximumChargeCurrent(int64_t aNewValue)  = 0;
+    virtual CHIP_ERROR SetRandomizationDelayWindow(uint32_t aNewValue) = 0;
+    virtual CHIP_ERROR SetApproximateEVEfficiency(uint16_t aNewValue)  = 0;
+
+protected:
+    EndpointId mEndpointId = 0;
+};
+
+class Instance : public AttributeAccessInterface, public CommandHandlerInterface
+{
+public:
+    Instance(EndpointId aEndpointId, Delegate & aDelegate);
+    ~Instance();
+
+    CHIP_ERROR Init();
+    void Shutdown();
+
+    bool HasFeature(Feature aFeature) const;
+
+private:
+    Delegate & mDelegate;
+    EndpointId mEndpointId;
+    BitMask<Feature> mFeature;
+
+    // AttributeAccessInterface
+    CHIP_ERROR Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override;
+    CHIP_ERROR Write(const ConcreteDataAttributePath & aPath, AttributeValueDecoder & aDecoder) override;
+
+    // CommandHandlerInterface
+    void InvokeCommand(HandlerContext & handlerContext) override;
+    CHIP_ERROR EnumerateAcceptedCommands(const ConcreteClusterPath & cluster, CommandIdCallback callback, void * context) override;
+
+    void HandleDisable(HandlerContext & ctx, const Commands::Disable::DecodableType & commandData);
+    void HandleEnableCharging(HandlerContext & ctx, const Commands::EnableCharging::DecodableType & commandData);
+    void HandleEnableDischarging(HandlerContext & ctx, const Commands::EnableDischarging::DecodableType & commandData);
+    void HandleStartDiagnostics(HandlerContext & ctx, const Commands::StartDiagnostics::DecodableType & commandData);
+    void HandleSetTargets(HandlerContext & ctx, const Commands::SetTargets::DecodableType & commandData);
+    void HandleGetTargets(HandlerContext & ctx, const Commands::GetTargets::DecodableType & commandData);
+    void HandleClearTargets(HandlerContext & ctx, const Commands::ClearTargets::DecodableType & commandData);
+};
+
+} // namespace EnergyEvse
+} // namespace Clusters
+} // namespace app
+} // namespace chip

From f27b036c88cb4321986c6bfa00a1a7941a863ccb Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Mon, 4 Dec 2023 10:50:00 +0000
Subject: [PATCH 07/80] Tidied up old comments.

---
 .../src/EnergyEvseManager.cpp                       | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp
index c9d3a0eb5329a3..75bda18d5a5151 100644
--- a/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp
+++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp
@@ -22,18 +22,15 @@ using namespace chip::app;
 using namespace chip::app::Clusters;
 using namespace chip::app::Clusters::EnergyEvse;
 
-void EnergyEvseManager::Shutdown()
-{
-    GetInstance()->Instance::Shutdown();
-    // TODO  delete mDelegate;
-    // TODO  delete mInstance;
-}
-
 CHIP_ERROR EnergyEvseManager::Init()
 {
-    // TODO - add custom initialization
     GetInstance()->Instance::Init();
     return CHIP_NO_ERROR;
 }
 
+void EnergyEvseManager::Shutdown()
+{
+    GetInstance()->Instance::Shutdown();
+}
+
 void MatterEnergyEvsePluginServerInitCallback() {}
\ No newline at end of file

From c0651fee40e2d3bb8613105b63826c8248c3a337 Mon Sep 17 00:00:00 2001
From: "Restyled.io" <commits@restyled.io>
Date: Mon, 4 Dec 2023 10:52:49 +0000
Subject: [PATCH 08/80] Restyled by whitespace

---
 .../energy-management-common/src/EVSEManufacturerImpl.cpp       | 2 +-
 .../energy-management-common/src/EnergyEvseDelegateImpl.cpp     | 2 +-
 .../energy-management-common/src/EnergyEvseManager.cpp          | 2 +-
 src/app/zap-templates/common/override.js                        | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp b/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp
index f24cb286363b59..68c7c31541bff3 100644
--- a/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp
+++ b/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp
@@ -48,4 +48,4 @@ CHIP_ERROR EVSEManufacturer::Shutdown(EnergyEvseManager * aInstance)
 {
 
     return CHIP_NO_ERROR;
-}
\ No newline at end of file
+}
diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
index ece556ecaf3be5..bf8159416537a5 100644
--- a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
+++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
@@ -708,4 +708,4 @@ DataModel::Nullable<int64_t> EnergyEvseDelegate::GetSessionEnergyCharged()
 DataModel::Nullable<int64_t> EnergyEvseDelegate::GetSessionEnergyDischarged()
 {
     return mSessionEnergyDischarged;
-}
\ No newline at end of file
+}
diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp
index 75bda18d5a5151..d9eb5ce0a7ac7d 100644
--- a/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp
+++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp
@@ -33,4 +33,4 @@ void EnergyEvseManager::Shutdown()
     GetInstance()->Instance::Shutdown();
 }
 
-void MatterEnergyEvsePluginServerInitCallback() {}
\ No newline at end of file
+void MatterEnergyEvsePluginServerInitCallback() {}
diff --git a/src/app/zap-templates/common/override.js b/src/app/zap-templates/common/override.js
index 098af41e5154e2..6930a0479f0fb7 100644
--- a/src/app/zap-templates/common/override.js
+++ b/src/app/zap-templates/common/override.js
@@ -78,7 +78,7 @@ function atomicType(arg)
   case 'amperage_ma':
   case 'voltage_mv':
   case 'energy_mwh':
-    return 'int64_t';    
+    return 'int64_t';
   case 'epoch_us':
   case 'systime_us':
   case 'posix_ms':

From 557f7c5dde6d8020913615c3084f06768df96e81 Mon Sep 17 00:00:00 2001
From: "Restyled.io" <commits@restyled.io>
Date: Mon, 4 Dec 2023 10:52:55 +0000
Subject: [PATCH 09/80] Restyled by gn

---
 .../energy-management-common/BUILD.gn                  |  3 ++-
 examples/energy-management-app/linux/BUILD.gn          | 10 +++++-----
 examples/energy-management-app/linux/args.gni          |  2 +-
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/examples/energy-management-app/energy-management-common/BUILD.gn b/examples/energy-management-app/energy-management-common/BUILD.gn
index 8c681d70500ccc..7c2040c1a4dc37 100644
--- a/examples/energy-management-app/energy-management-common/BUILD.gn
+++ b/examples/energy-management-app/energy-management-common/BUILD.gn
@@ -23,6 +23,7 @@ config("config") {
 chip_data_model("energy-management-common") {
   zap_file = "energy-management-app.zap"
 
-  zap_pregenerated_dir = "${chip_root}/zzz_generated/energy-management-app/zap-generated"
+  zap_pregenerated_dir =
+      "${chip_root}/zzz_generated/energy-management-app/zap-generated"
   is_server = true
 }
diff --git a/examples/energy-management-app/linux/BUILD.gn b/examples/energy-management-app/linux/BUILD.gn
index 84a856584202c1..8597caabfc35b9 100644
--- a/examples/energy-management-app/linux/BUILD.gn
+++ b/examples/energy-management-app/linux/BUILD.gn
@@ -36,10 +36,10 @@ config("includes") {
 
 executable("chip-energy-management-app") {
   sources = [
+    "${chip_root}/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.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/EnergyManagementManager.cpp",
-    "${chip_root}/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp",
     "include/CHIPProjectAppConfig.h",
     "main.cpp",
   ]
@@ -59,8 +59,8 @@ executable("chip-energy-management-app") {
   }
 
   include_dirs = [
-   "include",
-   "${chip_root}/examples/energy-management-app/energy-management-common/include"
+    "include",
+    "${chip_root}/examples/energy-management-app/energy-management-common/include",
   ]
 
   if (chip_enable_pw_rpc) {
@@ -96,10 +96,10 @@ executable("chip-energy-management-app") {
       "${chip_root}/config/linux/lib/pw_rpc:pw_rpc",
       "${chip_root}/examples/common/pigweed:attributes_service.nanopb_rpc",
       "${chip_root}/examples/common/pigweed:button_service.nanopb_rpc",
-      "${chip_root}/examples/common/pigweed:elec_service.nanopb_rpc",
-      "${chip_root}/examples/common/pigweed:evse_service.nanopb_rpc",
       "${chip_root}/examples/common/pigweed:descriptor_service.nanopb_rpc",
       "${chip_root}/examples/common/pigweed:device_service.nanopb_rpc",
+      "${chip_root}/examples/common/pigweed:elec_service.nanopb_rpc",
+      "${chip_root}/examples/common/pigweed:evse_service.nanopb_rpc",
       "${chip_root}/examples/common/pigweed:lighting_service.nanopb_rpc",
       "${chip_root}/examples/common/pigweed:rpc_services",
     ]
diff --git a/examples/energy-management-app/linux/args.gni b/examples/energy-management-app/linux/args.gni
index 479753404455c1..cca4c8f39e09fe 100644
--- a/examples/energy-management-app/linux/args.gni
+++ b/examples/energy-management-app/linux/args.gni
@@ -28,4 +28,4 @@ chip_project_config_include_dirs += [ "${chip_root}/config/standalone" ]
 
 matter_enable_tracing_support = true
 
-chip_enable_read_client = false
\ No newline at end of file
+chip_enable_read_client = false

From 67635336132ce455b81edee3bbd35a1cdac9b966 Mon Sep 17 00:00:00 2001
From: "Restyled.io" <commits@restyled.io>
Date: Mon, 4 Dec 2023 10:53:08 +0000
Subject: [PATCH 10/80] Restyled by prettier-markdown

---
 examples/energy-management-app/linux/README.md | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/examples/energy-management-app/linux/README.md b/examples/energy-management-app/linux/README.md
index 2cd3e82527ff79..9671ab073b12a8 100644
--- a/examples/energy-management-app/linux/README.md
+++ b/examples/energy-management-app/linux/README.md
@@ -1,9 +1,9 @@
 # CHIP Linux Energy Management Example
 
 An example showing the use of CHIP on the Linux. The document will describe how
-to build and run CHIP Linux Energy Management Example on Raspberry Pi. This doc is tested
-on **Ubuntu for Raspberry Pi Server 20.04 LTS (aarch64)** and **Ubuntu for
-Raspberry Pi Desktop 20.10 (aarch64)**
+to build and run CHIP Linux Energy Management Example on Raspberry Pi. This doc
+is tested on **Ubuntu for Raspberry Pi Server 20.04 LTS (aarch64)** and **Ubuntu
+for Raspberry Pi Desktop 20.10 (aarch64)**
 
 To cross-compile this example on x64 host and run on **NXP i.MX 8M Mini**
 **EVK**, see the associated

From 53fa295651a0470f380b24aa3b07438b7dbce9eb Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Tue, 5 Dec 2023 16:48:04 +0000
Subject: [PATCH 11/80] Added copy of files to all-clusters-app linux BUILD.gn
 and did basic test with chip-tool

---
 .../all-clusters-app.matter                   | 215 ++++++
 .../all-clusters-common/all-clusters-app.zap  | 510 ++++++++++++-
 .../include/EnergyEvseDelegateImpl.h          | 194 +++++
 .../include/EnergyEvseManager.h               |  60 ++
 .../src/EnergyEvseDelegateImpl.cpp            | 711 ++++++++++++++++++
 .../src/EnergyEvseManager.cpp                 |  36 +
 .../src/energy-evse-stub.cpp                  |  36 +
 examples/all-clusters-app/linux/BUILD.gn      |   3 +
 8 files changed, 1764 insertions(+), 1 deletion(-)
 create mode 100644 examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h
 create mode 100644 examples/all-clusters-app/all-clusters-common/include/EnergyEvseManager.h
 create mode 100644 examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
 create mode 100644 examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp
 create mode 100644 examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp

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 15cef48f6500c6..3f9f4287a39d05 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
@@ -3636,6 +3636,187 @@ cluster ActivatedCarbonFilterMonitoring = 114 {
   command ResetCondition(): DefaultSuccess = 0;
 }
 
+/** Electric Vehicle Supply Equipment (EVSE) is equipment used to charge an Electric Vehicle (EV) or Plug-In Hybrid Electric Vehicle. This cluster provides an interface to the functionality of Electric Vehicle Supply Equipment (EVSE) management. */
+provisional cluster EnergyEvse = 153 {
+  revision 1; // NOTE: Default/not specifically set
+
+  enum EnergyTransferStoppedReasonEnum : enum8 {
+    kEVStopped = 0;
+    kEVSEStopped = 1;
+    kOther = 2;
+  }
+
+  enum FaultStateEnum : enum8 {
+    kNoError = 0;
+    kMeterFailure = 1;
+    kOverVoltage = 2;
+    kUnderVoltage = 3;
+    kOverCurrent = 4;
+    kContactWetFailure = 5;
+    kContactDryFailure = 6;
+    kGroundFault = 7;
+    kPowerLoss = 8;
+    kPowerQuality = 9;
+    kPilotShortCircuit = 10;
+    kEmergencyStop = 11;
+    kEVDisconnected = 12;
+    kWrongPowerSupply = 13;
+    kLiveNeutralSwap = 14;
+    kOverTemperature = 15;
+    kOther = 255;
+  }
+
+  enum StateEnum : enum8 {
+    kNotPluggedIn = 0;
+    kPluggedInNoDemand = 1;
+    kPluggedInDemand = 2;
+    kPluggedInCharging = 3;
+    kPluggedInDischarging = 4;
+    kSessionEnding = 5;
+    kFault = 6;
+  }
+
+  enum SupplyStateEnum : enum8 {
+    kDisabled = 0;
+    kChargingEnabled = 1;
+    kDischargingEnabled = 2;
+    kDisabledError = 3;
+    kDisabledDiagnostics = 4;
+  }
+
+  bitmap Feature : bitmap32 {
+    kChargingPreferences = 0x1;
+    kSoCReporting = 0x2;
+    kPlugAndCharge = 0x4;
+    kRFID = 0x8;
+    kV2X = 0x10;
+  }
+
+  bitmap TargetDayOfWeekBitmap : bitmap8 {
+    kSunday = 0x1;
+    kMonday = 0x2;
+    kTuesday = 0x4;
+    kWednesday = 0x8;
+    kThursday = 0x10;
+    kFriday = 0x20;
+    kSaturday = 0x40;
+  }
+
+  struct ChargingTargetStruct {
+    int16u targetTime = 0;
+    optional percent targetSoC = 1;
+    optional energy_mwh addedEnergy = 2;
+  }
+
+  info event EVConnected = 0 {
+    int32u sessionID = 0;
+  }
+
+  info event EVNotDetected = 1 {
+    int32u sessionID = 0;
+    StateEnum state = 1;
+    elapsed_s sessionDuration = 2;
+    energy_mwh sessionEnergyCharged = 3;
+    optional energy_mwh sessionEnergyDischarged = 4;
+  }
+
+  info event EnergyTransferStarted = 2 {
+    int32u sessionID = 0;
+    StateEnum state = 1;
+    amperage_ma maximumCurrent = 2;
+  }
+
+  info event EnergyTransferStopped = 3 {
+    int32u sessionID = 0;
+    StateEnum state = 1;
+    EnergyTransferStoppedReasonEnum reason = 2;
+    energy_mwh energyTransferred = 4;
+  }
+
+  critical event Fault = 4 {
+    int32u sessionID = 0;
+    StateEnum state = 1;
+    FaultStateEnum faultStatePreviousState = 2;
+    FaultStateEnum faultStateCurrentState = 4;
+  }
+
+  info event RFID = 5 {
+    octet_string uid = 0;
+  }
+
+  readonly attribute nullable StateEnum state = 0;
+  readonly attribute SupplyStateEnum supplyState = 1;
+  readonly attribute FaultStateEnum faultState = 2;
+  readonly attribute nullable epoch_s chargingEnabledUntil = 3;
+  readonly attribute optional nullable epoch_s dischargingEnabledUntil = 4;
+  readonly attribute amperage_ma circuitCapacity = 5;
+  readonly attribute amperage_ma minimumChargeCurrent = 6;
+  readonly attribute amperage_ma maximumChargeCurrent = 7;
+  readonly attribute optional amperage_ma maximumDischargeCurrent = 8;
+  attribute access(write: manage) optional amperage_ma userMaximumChargeCurrent = 9;
+  attribute access(write: manage) optional elapsed_s randomizationDelayWindow = 10;
+  readonly attribute optional int8u numberOfWeeklyTargets = 33;
+  readonly attribute optional int8u numberOfDailyTargets = 34;
+  readonly attribute optional nullable epoch_s nextChargeStartTime = 35;
+  readonly attribute optional nullable epoch_s nextChargeTargetTime = 36;
+  readonly attribute optional nullable energy_mwh nextChargeRequiredEnergy = 37;
+  readonly attribute optional nullable percent nextChargeTargetSoC = 38;
+  attribute access(write: manage) optional nullable int16u approximateEVEfficiency = 39;
+  readonly attribute optional nullable percent stateOfCharge = 48;
+  readonly attribute optional nullable energy_mwh batteryCapacity = 49;
+  readonly attribute optional nullable char_string<32> vehicleID = 50;
+  readonly attribute nullable int32u sessionID = 64;
+  readonly attribute elapsed_s sessionDuration = 65;
+  readonly attribute energy_mwh sessionEnergyCharged = 66;
+  readonly attribute optional energy_mwh sessionEnergyDischarged = 67;
+  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;
+
+  response struct GetTargetsResponse = 0 {
+    TargetDayOfWeekBitmap dayOfWeekforSequence = 0;
+    ChargingTargetStruct chargingTargets[] = 1;
+  }
+
+  request struct EnableChargingRequest {
+    nullable epoch_s chargingEnabledUntil = 0;
+    amperage_ma minimumChargeCurrent = 1;
+    amperage_ma maximumChargeCurrent = 2;
+  }
+
+  request struct EnableDischargingRequest {
+    nullable epoch_s dischargingEnabledUntil = 0;
+    amperage_ma maximumDischargeCurrent = 1;
+  }
+
+  request struct SetTargetsRequest {
+    TargetDayOfWeekBitmap dayOfWeekforSequence = 0;
+    ChargingTargetStruct chargingTargets[] = 1;
+  }
+
+  request struct GetTargetsRequest {
+    TargetDayOfWeekBitmap daysToReturn = 0;
+  }
+
+  /** Allows a client to disable the EVSE from charging and discharging. */
+  timed command Disable(): DefaultSuccess = 1;
+  /** Allows a client to enable the EVSE to charge an EV. */
+  timed command EnableCharging(EnableChargingRequest): DefaultSuccess = 2;
+  /** Allows a client to enable the EVSE to discharge an EV. */
+  timed command EnableDischarging(EnableDischargingRequest): DefaultSuccess = 3;
+  /** Allows a client to put the EVSE into a self-diagnostics mode. */
+  timed command StartDiagnostics(): DefaultSuccess = 4;
+  /** Allows a client to set the user specified charging targets. */
+  timed command SetTargets(SetTargetsRequest): DefaultSuccess = 5;
+  /** Allows a client to retrieve the user specified charging targets. */
+  timed command GetTargets(GetTargetsRequest): GetTargetsResponse = 6;
+  /** Allows a client to clear all stored charging targets. */
+  timed command ClearTargets(): DefaultSuccess = 7;
+}
+
 /** Provides an interface for controlling and adjusting automatic window coverings. */
 cluster WindowCovering = 258 {
   revision 5;
@@ -6952,6 +7133,40 @@ endpoint 1 {
     handle command ResetCondition;
   }
 
+  server cluster EnergyEvse {
+    callback attribute state;
+    callback attribute supplyState;
+    callback attribute faultState;
+    callback attribute chargingEnabledUntil default = 0;
+    callback attribute dischargingEnabledUntil default = 0;
+    callback attribute circuitCapacity default = 0;
+    callback attribute minimumChargeCurrent default = 6000;
+    callback attribute maximumChargeCurrent default = 0;
+    callback attribute maximumDischargeCurrent default = 0;
+    callback attribute userMaximumChargeCurrent default = 0;
+    callback attribute randomizationDelayWindow default = 600;
+    callback attribute numberOfWeeklyTargets default = 0;
+    callback attribute numberOfDailyTargets default = 1;
+    callback attribute nextChargeStartTime;
+    callback attribute nextChargeTargetTime;
+    callback attribute nextChargeRequiredEnergy;
+    callback attribute nextChargeTargetSoC;
+    callback attribute approximateEVEfficiency default = 0xFFFF;
+    callback attribute stateOfCharge;
+    callback attribute batteryCapacity;
+    callback attribute vehicleID;
+    callback attribute sessionID default = 0;
+    callback attribute sessionDuration default = 0;
+    callback attribute sessionEnergyCharged default = 0;
+    callback attribute sessionEnergyDischarged default = 0;
+    callback attribute generatedCommandList;
+    callback attribute acceptedCommandList;
+    callback attribute eventList;
+    callback attribute attributeList;
+    ram      attribute featureMap default = 0;
+    ram      attribute clusterRevision default = 2;
+  }
+
   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 84ef5e05e26b4c..b60a91d69be820 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
@@ -11524,6 +11524,513 @@
             }
           ]
         },
+        {
+          "name": "Energy EVSE",
+          "code": 153,
+          "mfgCode": null,
+          "define": "ENERGY_EVSE_CLUSTER",
+          "side": "server",
+          "enabled": 1,
+          "apiMaturity": "provisional",
+          "attributes": [
+            {
+              "name": "State",
+              "code": 0,
+              "mfgCode": null,
+              "side": "server",
+              "type": "StateEnum",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "SupplyState",
+              "code": 1,
+              "mfgCode": null,
+              "side": "server",
+              "type": "SupplyStateEnum",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "FaultState",
+              "code": 2,
+              "mfgCode": null,
+              "side": "server",
+              "type": "FaultStateEnum",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "ChargingEnabledUntil",
+              "code": 3,
+              "mfgCode": null,
+              "side": "server",
+              "type": "epoch_s",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "DischargingEnabledUntil",
+              "code": 4,
+              "mfgCode": null,
+              "side": "server",
+              "type": "epoch_s",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "CircuitCapacity",
+              "code": 5,
+              "mfgCode": null,
+              "side": "server",
+              "type": "amperage_ma",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "MinimumChargeCurrent",
+              "code": 6,
+              "mfgCode": null,
+              "side": "server",
+              "type": "amperage_ma",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "6000",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "MaximumChargeCurrent",
+              "code": 7,
+              "mfgCode": null,
+              "side": "server",
+              "type": "amperage_ma",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "MaximumDischargeCurrent",
+              "code": 8,
+              "mfgCode": null,
+              "side": "server",
+              "type": "amperage_ma",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "UserMaximumChargeCurrent",
+              "code": 9,
+              "mfgCode": null,
+              "side": "server",
+              "type": "amperage_ma",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "RandomizationDelayWindow",
+              "code": 10,
+              "mfgCode": null,
+              "side": "server",
+              "type": "elapsed_s",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "600",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "NumberOfWeeklyTargets",
+              "code": 33,
+              "mfgCode": null,
+              "side": "server",
+              "type": "int8u",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "NumberOfDailyTargets",
+              "code": 34,
+              "mfgCode": null,
+              "side": "server",
+              "type": "int8u",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "1",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "NextChargeStartTime",
+              "code": 35,
+              "mfgCode": null,
+              "side": "server",
+              "type": "epoch_s",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "NextChargeTargetTime",
+              "code": 36,
+              "mfgCode": null,
+              "side": "server",
+              "type": "epoch_s",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "NextChargeRequiredEnergy",
+              "code": 37,
+              "mfgCode": null,
+              "side": "server",
+              "type": "energy_mwh",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "NextChargeTargetSoC",
+              "code": 38,
+              "mfgCode": null,
+              "side": "server",
+              "type": "percent",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "ApproximateEVEfficiency",
+              "code": 39,
+              "mfgCode": null,
+              "side": "server",
+              "type": "int16u",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0xFFFF",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "StateOfCharge",
+              "code": 48,
+              "mfgCode": null,
+              "side": "server",
+              "type": "percent",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "BatteryCapacity",
+              "code": 49,
+              "mfgCode": null,
+              "side": "server",
+              "type": "energy_mwh",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "VehicleID",
+              "code": 50,
+              "mfgCode": null,
+              "side": "server",
+              "type": "char_string",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "SessionID",
+              "code": 64,
+              "mfgCode": null,
+              "side": "server",
+              "type": "int32u",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "SessionDuration",
+              "code": 65,
+              "mfgCode": null,
+              "side": "server",
+              "type": "elapsed_s",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "SessionEnergyCharged",
+              "code": 66,
+              "mfgCode": null,
+              "side": "server",
+              "type": "energy_mwh",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "SessionEnergyDischarged",
+              "code": 67,
+              "mfgCode": null,
+              "side": "server",
+              "type": "energy_mwh",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0",
+              "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": "RAM",
+              "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": "2",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            }
+          ]
+        },
         {
           "name": "Window Covering",
           "code": 258,
@@ -21724,5 +22231,6 @@
       "endpointId": 65534,
       "networkId": 0
     }
-  ]
+  ],
+  "log": []
 }
\ No newline at end of file
diff --git a/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h b/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h
new file mode 100644
index 00000000000000..09cb1deae4bc02
--- /dev/null
+++ b/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h
@@ -0,0 +1,194 @@
+/*
+ *
+ *    Copyright (c) 2023 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 "app/clusters/energy-evse-server/energy-evse-server.h"
+
+#include <app/util/af.h>
+#include <app/util/config.h>
+#include <cstring>
+
+using chip::Protocols::InteractionModel::Status;
+namespace chip {
+namespace app {
+namespace Clusters {
+namespace EnergyEvse {
+
+/**
+ * The application delegate.
+ */
+
+class EnergyEvseDelegate : public EnergyEvse::Delegate
+{
+public:
+    /**
+     * @brief   Called when EVSE cluster receives Disable command
+     */
+    Status Disable() override;
+
+    /**
+     * @brief   Called when EVSE cluster receives EnableCharging command
+     *
+     * @param chargingEnabledUntil
+     * @param minimumChargeCurrent (in mA)
+     * @param maximumChargeCurrent (in mA)
+     */
+    Status EnableCharging(const chip::app::DataModel::Nullable<uint32_t> & chargingEnabledUntil,
+                          const uint64_t & minimumChargeCurrent, const uint64_t & maximumChargeCurrent) override;
+
+    /**
+     * @brief   Called when EVSE cluster receives EnableDischarging command
+     *
+     * @param dischargingEnabledUntil
+     * @param maximumChargeCurrent (in mA)
+     */
+    Status EnableDischarging(const chip::app::DataModel::Nullable<uint32_t> & dischargingEnabledUntil,
+                             const uint64_t & maximumDischargeCurrent) override;
+
+    /**
+     * @brief    Called when EVSE cluster receives StartDiagnostics command
+     */
+    Status StartDiagnostics() override;
+
+    // -----------------------------------------------------------------
+    // Internal API to allow an EVSE to change its internal state etc
+    // TODO Status hwRegisterEvseHardwareCallback(Callback);
+    Status hwSetMaxHardwareCurrentLimit(int64_t currentmA);
+    Status hwSetCircuitCapacity(int64_t currentmA);
+    Status hwSetCableAssemblyLimit(int64_t currentmA);
+    Status hwSetState(StateEnum state);
+    Status hwSetFault(FaultStateEnum fault);
+
+    // ------------------------------------------------------------------
+    // Get attribute methods
+    StateEnum GetState() override;
+    CHIP_ERROR SetState(StateEnum);
+
+    SupplyStateEnum GetSupplyState() override;
+    CHIP_ERROR SetSupplyState(SupplyStateEnum);
+
+    FaultStateEnum GetFaultState() override;
+    CHIP_ERROR SetFaultState(FaultStateEnum);
+
+    DataModel::Nullable<uint32_t> GetChargingEnabledUntil() override;
+    CHIP_ERROR SetChargingEnabledUntil(uint32_t);
+
+    DataModel::Nullable<uint32_t> GetDischargingEnabledUntil() override;
+    CHIP_ERROR SetDischargingEnabledUntil(uint32_t);
+
+    int64_t GetCircuitCapacity() override;
+    CHIP_ERROR SetCircuitCapacity(int64_t);
+
+    int64_t GetMinimumChargeCurrent() override;
+    CHIP_ERROR SetMinimumChargeCurrent(int64_t);
+
+    int64_t GetMaximumChargeCurrent() override;
+    CHIP_ERROR SetMaximumChargeCurrent(int64_t);
+
+    int64_t GetMaximumDischargeCurrent() override;
+    CHIP_ERROR SetMaximumDischargeCurrent(int64_t);
+
+    int64_t GetUserMaximumChargeCurrent() override;
+    CHIP_ERROR SetUserMaximumChargeCurrent(int64_t) override;
+
+    uint32_t GetRandomizationDelayWindow() override;
+    CHIP_ERROR SetRandomizationDelayWindow(uint32_t) override;
+
+    /* PREF attributes */
+    uint8_t GetNumberOfWeeklyTargets() override;
+    uint8_t GetNumberOfDailyTargets() override;
+    DataModel::Nullable<uint32_t> GetNextChargeStartTime() override;
+    DataModel::Nullable<uint32_t> GetNextChargeTargetTime() override;
+    DataModel::Nullable<int64_t> GetNextChargeRequiredEnergy() override;
+    DataModel::Nullable<chip::Percent> GetNextChargeTargetSoC() override;
+
+    DataModel::Nullable<uint16_t> GetApproximateEVEfficiency() override;
+    CHIP_ERROR SetApproximateEVEfficiency(uint16_t) override;
+
+    /* SOC attributes */
+    DataModel::Nullable<chip::Percent> GetStateOfCharge() override;
+    DataModel::Nullable<int64_t> GetBatteryCapacity() override;
+    /* PNC attributes*/
+    char * GetVehicleID() override;
+    /* Session SESS attributes */
+    DataModel::Nullable<uint32_t> GetSessionID() override;
+    DataModel::Nullable<uint32_t> GetSessionDuration() override;
+    DataModel::Nullable<int64_t> GetSessionEnergyCharged() override;
+    DataModel::Nullable<int64_t> GetSessionEnergyDischarged() override;
+
+private:
+    /* Constants */
+    static constexpr int MAX_CURRENT_LOWER_BOUND             = 0;
+    static constexpr int MAX_CURRENT_UPPER_BOUND             = 80000;
+    static constexpr int DEFAULT_MIN_CHARGE_CURRENT          = 6000;  /* 6A */
+    static constexpr int DEFAULT_USER_MAXIMUM_CHARGE_CURRENT = 80000; /* 80A */
+    static constexpr int DEFAULT_RANDOMIZATION_DELAY_WINDOW  = 600;   /* 600s */
+
+    /* private variables for controlling the hardware - these are not attributes */
+    int64_t mMaxHardwareCurrentLimit                = 0; /* Hardware current limit in mA */
+    int64_t mCableAssemblyCurrentLimit              = 0; /* Cable limit detected when cable is plugged in, in mA */
+    int64_t mMaximumChargingCurrentLimitFromCommand = 0; /* Value of current maximum limit when charging enabled */
+    int64_t mMinimumChargingCurrentLimitFromCommand = 0; /* Value of current minimum limit when charging enabled */
+    int64_t mActualChargingCurrentLimit             = 0;
+    StateEnum mHwState                              = StateEnum::kNotPluggedIn; /* Hardware state */
+
+    /**
+     * @brief Helper function to work out the charge limit based on conditions and settings
+     */
+    Status ComputeMaxChargeCurrentLimit();
+
+    /* Attributes */
+    StateEnum mState             = StateEnum::kNotPluggedIn;
+    SupplyStateEnum mSupplyState = SupplyStateEnum::kDisabled;
+    FaultStateEnum mFaultState   = FaultStateEnum::kNoError;
+    DataModel::Nullable<uint32_t> mChargingEnabledUntil;    // TODO Default to 0 to indicate disabled
+    DataModel::Nullable<uint32_t> mDischargingEnabledUntil; // TODO Default to 0 to indicate disabled
+    int64_t mCircuitCapacity           = 0;
+    int64_t mMinimumChargeCurrent      = DEFAULT_MIN_CHARGE_CURRENT;
+    int64_t mMaximumChargeCurrent      = 0;
+    int64_t mMaximumDischargeCurrent   = 0;
+    int64_t mUserMaximumChargeCurrent  = DEFAULT_USER_MAXIMUM_CHARGE_CURRENT; // TODO update spec
+    uint32_t mRandomizationDelayWindow = DEFAULT_RANDOMIZATION_DELAY_WINDOW;
+    /* PREF attributes */
+    uint8_t mNumberOfWeeklyTargets = 0;
+    uint8_t mNumberOfDailyTargets  = 1;
+    DataModel::Nullable<uint32_t> mNextChargeStartTime;
+    DataModel::Nullable<uint32_t> mNextChargeTargetTime;
+    DataModel::Nullable<int64_t> mNextChargeRequiredEnergy;
+    DataModel::Nullable<chip::Percent> mNextChargeTargetSoC;
+    DataModel::Nullable<uint16_t> mApproximateEVEfficiency;
+
+    /* SOC attributes */
+    DataModel::Nullable<chip::Percent> mStateOfCharge;
+    DataModel::Nullable<int64_t> mBatteryCapacity;
+
+    /* PNC attributes*/
+    char * mVehicleID;
+
+    /* Session SESS attributes */
+    DataModel::Nullable<uint32_t> mSessionID;
+    DataModel::Nullable<uint32_t> mSessionDuration;
+    DataModel::Nullable<int64_t> mSessionEnergyCharged;
+    DataModel::Nullable<int64_t> mSessionEnergyDischarged;
+};
+
+} // namespace EnergyEvse
+} // namespace Clusters
+} // namespace app
+} // namespace chip
diff --git a/examples/all-clusters-app/all-clusters-common/include/EnergyEvseManager.h b/examples/all-clusters-app/all-clusters-common/include/EnergyEvseManager.h
new file mode 100644
index 00000000000000..034da67e7de01d
--- /dev/null
+++ b/examples/all-clusters-app/all-clusters-common/include/EnergyEvseManager.h
@@ -0,0 +1,60 @@
+/*
+ *
+ *    Copyright (c) 2023 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 <EnergyEvseDelegateImpl.h>
+#include <app/clusters/energy-evse-server/energy-evse-server.h>
+#include <app/util/af-types.h>
+#include <lib/core/CHIPError.h>
+
+namespace chip {
+namespace app {
+namespace Clusters {
+
+using namespace chip::app::Clusters::EnergyEvse;
+class EnergyEvseManager : public Instance
+{
+public:
+    EnergyEvseManager(EndpointId aEndpointId, EnergyEvseDelegate & aDelegate) :
+        EnergyEvse::Instance(aEndpointId, aDelegate), mEndpointId(aEndpointId)
+    {
+        mInstance = this;
+        mDelegate = &aDelegate;
+    }
+
+    // Delete copy constructor and assignment operator.
+    EnergyEvseManager(const EnergyEvseManager &)             = delete;
+    EnergyEvseManager(const EnergyEvseManager &&)            = delete;
+    EnergyEvseManager & operator=(const EnergyEvseManager &) = delete;
+
+    CHIP_ERROR Init();
+    void Shutdown();
+
+    EnergyEvse::Instance * GetInstance() { return mInstance; };
+    EnergyEvseDelegate * GetDelegate() { return mDelegate; };
+
+private:
+    EnergyEvse::Instance * mInstance;
+    EndpointId mEndpointId;
+    EnergyEvseDelegate * mDelegate;
+};
+
+} // namespace Clusters
+} // namespace app
+} // namespace chip
diff --git a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
new file mode 100644
index 00000000000000..bf8159416537a5
--- /dev/null
+++ b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
@@ -0,0 +1,711 @@
+/*
+ *
+ *    Copyright (c) 2023 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 <EnergyEvseDelegateImpl.h>
+#include <app-common/zap-generated/attributes/Accessors.h>
+#include <app-common/zap-generated/cluster-objects.h>
+
+using namespace chip;
+using chip::Protocols::InteractionModel::Status;
+
+using namespace chip::app;
+using namespace chip::app::DataModel;
+using namespace chip::app::Clusters;
+using namespace chip::app::Clusters::EnergyEvse;
+using namespace chip::app::Clusters::EnergyEvse::Attributes;
+
+/**
+ * @brief   Called when EVSE cluster receives Disable command
+ */
+Status EnergyEvseDelegate::Disable()
+{
+    ChipLogProgress(AppServer, "EnergyEvseDelegate::Disable()");
+
+    /* update State */
+    switch (mHwState)
+    {
+    case StateEnum::kNotPluggedIn:
+        SetState(StateEnum::kNotPluggedIn);
+        break;
+
+    case StateEnum::kPluggedInNoDemand:
+        SetState(StateEnum::kPluggedInNoDemand);
+        break;
+
+    case StateEnum::kPluggedInDemand:
+        SetState(StateEnum::kPluggedInDemand);
+        break;
+
+    default:
+        ChipLogError(AppServer, "Unexpected EVSE hardware state\n");
+        SetState(StateEnum::kFault);
+        break;
+    }
+
+    /* update SupplyState */
+    SetSupplyState(SupplyStateEnum::kDisabled);
+
+    /* update ChargingEnabledUntil & DischargingEnabledUntil to show 0 */
+    SetChargingEnabledUntil(0);
+    SetDischargingEnabledUntil(0);
+
+    /* update MinimumChargeCurrent & MaximumChargeCurrent to 0 */
+    SetMinimumChargeCurrent(0);
+    SetMaximumChargeCurrent(0);
+
+    /* update MaximumDischargeCurrent to 0 */
+    SetMaximumDischargeCurrent(0);
+
+    // TODO: Generate events
+
+    return Status::Success;
+}
+
+/**
+ * @brief   Called when EVSE cluster receives EnableCharging command
+ *
+ * @param chargingEnabledUntil (can be null to indefinite charging)
+ * @param minimumChargeCurrent (in mA)
+ * @param maximumChargeCurrent (in mA)
+ */
+Status EnergyEvseDelegate::EnableCharging(const chip::app::DataModel::Nullable<uint32_t> & chargingEnabledUntil,
+                                          const uint64_t & minimumChargeCurrent, const uint64_t & maximumChargeCurrent)
+{
+    ChipLogProgress(AppServer, "EnergyEvseDelegate::EnableCharging()");
+
+    if (maximumChargeCurrent < MAX_CURRENT_LOWER_BOUND || maximumChargeCurrent > MAX_CURRENT_UPPER_BOUND)
+    {
+        ChipLogError(NotSpecified, "Maximum Current outside limits");
+        return Status::ConstraintError;
+    }
+
+    if (minimumChargeCurrent < MAX_CURRENT_LOWER_BOUND || minimumChargeCurrent > MAX_CURRENT_UPPER_BOUND)
+    {
+        ChipLogError(NotSpecified, "Maximum Current outside limits");
+        return Status::ConstraintError;
+    }
+
+    if (minimumChargeCurrent > maximumChargeCurrent)
+    {
+        ChipLogError(NotSpecified, "Minium Current > Maximum Current!");
+        return Status::ConstraintError;
+    }
+
+    if (chargingEnabledUntil.IsNull())
+    {
+        /* Charging enabled indefinitely */
+        ChipLogError(NotSpecified, "Charging enabled indefinitely")
+    }
+    else
+    {
+        /* check chargingEnabledUntil is in the future */
+        ChipLogError(NotSpecified, "Charging enabled until: %d", chargingEnabledUntil.Value());
+        // TODO
+        // if (checkChargingEnabled)
+    }
+
+    /* Check current state isn't already enabled */
+
+    /* If charging is already enabled, check that the parameters may have
+       changed, these may override an existing charging command */
+    switch (mHwState)
+    {
+    case StateEnum::kNotPluggedIn:
+        SetState(StateEnum::kNotPluggedIn);
+        break;
+
+    case StateEnum::kPluggedInNoDemand:
+        SetState(StateEnum::kPluggedInNoDemand);
+        break;
+
+    case StateEnum::kPluggedInDemand:
+        /* If the EVSE is asking for demand then enable charging */
+        SetState(StateEnum::kPluggedInCharging);
+        break;
+
+    default:
+        ChipLogError(AppServer, "Unexpected EVSE hardware state\n");
+        SetState(StateEnum::kFault);
+        break;
+    }
+
+    /* update SupplyState */
+    SetSupplyState(SupplyStateEnum::kChargingEnabled);
+
+    /* If it looks ok, store the min & max charging current */
+    mMaximumChargingCurrentLimitFromCommand = maximumChargeCurrent;
+    SetMinimumChargeCurrent(minimumChargeCurrent);
+    // TODO persist these to KVS
+
+    // TODO: Generate events
+
+    return this->ComputeMaxChargeCurrentLimit();
+}
+
+/**
+ * @brief   Called when EVSE cluster receives EnableDischarging command
+ *
+ * @param dischargingEnabledUntil (can be null to indefinite discharging)
+ * @param maximumChargeCurrent (in mA)
+ */
+Status EnergyEvseDelegate::EnableDischarging(const chip::app::DataModel::Nullable<uint32_t> & dischargingEnabledUntil,
+                                             const uint64_t & maximumDischargeCurrent)
+{
+    ChipLogProgress(AppServer, "EnergyEvseDelegate::EnableDischarging() called.");
+
+    /* update SupplyState */
+    SetSupplyState(SupplyStateEnum::kDischargingEnabled);
+
+    // TODO: Generate events
+
+    return Status::Success;
+}
+
+/**
+ * @brief    Called when EVSE cluster receives StartDiagnostics command
+ */
+Status EnergyEvseDelegate::StartDiagnostics()
+{
+    /* For EVSE manufacturers to customize */
+    ChipLogProgress(AppServer, "EnergyEvseDelegate::StartDiagnostics()");
+
+    /* update SupplyState */
+    SetSupplyState(SupplyStateEnum::kDisabledDiagnostics);
+
+    // TODO: Generate events
+
+    return Status::Success;
+}
+
+/* ---------------------------------------------------------------------------
+ * FUNCTIONS BELOW:
+ *    - EVSE Hardware interface
+ *
+ *  RegisterEvseHardwareCallback( callbackType, callbackFnc )
+ *  SetMaxHardwareCurrentLimit( currentmA )
+ *  SetCircuitCapacity( currentmA )
+ *  SetCableAssemblyLimit( currentmA )
+ *  SetState( EVSEStateEnum )
+ *  SetFault
+ *
+ */
+
+/**
+ * @brief    Called by EVSE Hardware to register a callback
+ *
+ * @param    Callback function
+ */
+#if 0
+Status EnergyEvseDelegate::hwRegisterEvseHardwareCallback(int Callback) // TODO
+{
+    // TODO
+    return CHIP_NO_ERROR;
+}
+#endif
+/**
+ * @brief    Called by EVSE Hardware to notify the delegate of the maximum
+ *           current limit supported by the hardware.
+ *
+ *           This is normally called at start-up.
+ *
+ * @param    currentmA
+ */
+Status EnergyEvseDelegate::hwSetMaxHardwareCurrentLimit(int64_t currentmA)
+{
+    if (currentmA < MAX_CURRENT_LOWER_BOUND || currentmA > MAX_CURRENT_UPPER_BOUND)
+    {
+        return Status::ConstraintError;
+    }
+
+    /* there is no attribute to store this so store in private variable */
+    mMaxHardwareCurrentLimit = currentmA;
+
+    return this->ComputeMaxChargeCurrentLimit();
+}
+
+/**
+ * @brief    Called by EVSE Hardware to notify the delegate of maximum electrician
+ *           set current limit.
+ *
+ *           This is normally called at start-up when reading from DIP-switch
+ *           settings.
+ *
+ * @param    currentmA
+ */
+Status EnergyEvseDelegate::hwSetCircuitCapacity(int64_t currentmA)
+{
+    if (currentmA < MAX_CURRENT_LOWER_BOUND || currentmA > MAX_CURRENT_UPPER_BOUND)
+    {
+        return Status::ConstraintError;
+    }
+
+    mCircuitCapacity = currentmA;
+    MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, CircuitCapacity::Id);
+
+    return this->ComputeMaxChargeCurrentLimit();
+}
+
+/**
+ * @brief    Called by EVSE Hardware to notify the delegate of the cable assembly
+ *           current limit.
+ *
+ *           This is normally called when the EV is plugged into the EVSE and the
+ *           PP voltage is measured by the EVSE. A pull-up resistor in the cable
+ *           causes a voltage drop. Different current limits can be indicated
+ *           using different resistors, which results in different voltages
+ *           measured by the EVSE.
+ *
+ * @param    currentmA
+ */
+Status EnergyEvseDelegate::hwSetCableAssemblyLimit(int64_t currentmA)
+{
+    if (currentmA < MAX_CURRENT_LOWER_BOUND || currentmA > MAX_CURRENT_UPPER_BOUND)
+    {
+        return Status::ConstraintError;
+    }
+
+    /* there is no attribute to store this so store in private variable */
+    mCableAssemblyCurrentLimit = currentmA;
+
+    return this->ComputeMaxChargeCurrentLimit();
+}
+
+/**
+ * @brief    Called by EVSE Hardware to indicate a fault
+ *
+ * @param    StateEnum
+ */
+Status EnergyEvseDelegate::hwSetState(StateEnum state)
+{
+    /* the only allowed states that the EVSE hardware can set are:
+     *  kNotPluggedIn
+     *  kPluggedInNoDemand
+     *  kPluggedInDemand
+     */
+    switch (state)
+    {
+    case StateEnum::kNotPluggedIn:
+        // TODO - work out logic here
+        mHwState = state;
+        break;
+    case StateEnum::kPluggedInNoDemand:
+        // TODO - work out logic here
+        mHwState = state;
+        break;
+    case StateEnum::kPluggedInDemand:
+        // TODO - work out logic here
+        mHwState = state;
+        break;
+
+    default:
+        /* All other states should be managed by the Delegate */
+        // TODO (assert?)
+        break;
+    }
+
+    return Status::Success;
+}
+
+/**
+ * @brief    Called by EVSE Hardware to indicate a fault
+ *
+ * @param    FaultStateEnum
+ */
+Status EnergyEvseDelegate::hwSetFault(FaultStateEnum fault)
+{
+    ChipLogProgress(AppServer, "EnergyEvseDelegate::Fault()");
+
+    if (fault == FaultStateEnum::kNoError)
+    {
+        /* Update State to previous state */
+        // TODO: need to work out the logic here!
+
+        /* Update SupplyState to previous state */
+    }
+    else
+    {
+        /* Update State & SupplyState */
+        SetState(StateEnum::kFault);
+        SetSupplyState(SupplyStateEnum::kDisabledError);
+    }
+
+    /* Update FaultState */
+    SetFaultState(fault);
+
+    // TODO: Generate events
+
+    return Status::Success;
+}
+
+/* ---------------------------------------------------------------------------
+ * Functions below are private helper functions internal to the delegate
+ */
+
+/**
+ *  @brief   Called to compute the safe charging current limit
+ */
+Status EnergyEvseDelegate::ComputeMaxChargeCurrentLimit()
+{
+    int64_t oldValue;
+    /* mActualChargingCurrentLimit is the minimum of:
+     *   - MaxHardwareCurrentLimit (of the hardware)
+     *   - CircuitCapacity (set by the electrician - less than the hardware)
+     *   - CableAssemblyLimit (detected when the cable is inserted)
+     *   - MaximumChargeCurrent (from charging command)
+     *   - UserMaximumChargeCurrent (could dynamically change)
+     */
+
+    oldValue                    = mActualChargingCurrentLimit;
+    mActualChargingCurrentLimit = mMaxHardwareCurrentLimit;
+    mActualChargingCurrentLimit = min(mActualChargingCurrentLimit, mCircuitCapacity);
+    mActualChargingCurrentLimit = min(mActualChargingCurrentLimit, mCableAssemblyCurrentLimit);
+    mActualChargingCurrentLimit = min(mActualChargingCurrentLimit, mMaximumChargingCurrentLimitFromCommand);
+    mActualChargingCurrentLimit = min(mActualChargingCurrentLimit, mUserMaximumChargeCurrent);
+
+    /* Set the actual max charging current attribute */
+    mMaximumChargeCurrent = mActualChargingCurrentLimit;
+
+    if (oldValue != mMaximumChargeCurrent)
+    {
+        ChipLogDetail(AppServer, "MaximumChargeCurrent updated to %" PRId64, mMaximumChargeCurrent);
+        MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, MaximumChargeCurrent::Id);
+
+        /* Call the EV Charger hardware current limit callback */
+        // TODO
+    }
+    return Status::Success;
+}
+
+/**
+ * Attribute methods
+ */
+/* State */
+StateEnum EnergyEvseDelegate::GetState()
+{
+    return mState;
+}
+CHIP_ERROR EnergyEvseDelegate::SetState(StateEnum newValue)
+{
+    StateEnum oldValue = mState;
+    if (newValue >= StateEnum::kUnknownEnumValue)
+    {
+        return CHIP_IM_GLOBAL_STATUS(ConstraintError);
+    }
+
+    mState = newValue;
+    if (oldValue != mState)
+    {
+        ChipLogDetail(AppServer, "State updated to %d", (int) mState);
+        MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, State::Id);
+    }
+
+    return CHIP_NO_ERROR;
+}
+
+/* SupplyState */
+SupplyStateEnum EnergyEvseDelegate::GetSupplyState()
+{
+    return mSupplyState;
+}
+CHIP_ERROR EnergyEvseDelegate::SetSupplyState(SupplyStateEnum newValue)
+{
+    SupplyStateEnum oldValue = mSupplyState;
+
+    if (newValue >= SupplyStateEnum::kUnknownEnumValue)
+    {
+        return CHIP_IM_GLOBAL_STATUS(ConstraintError);
+    }
+
+    mSupplyState = newValue;
+    if (oldValue != mSupplyState)
+    {
+        ChipLogDetail(AppServer, "SupplyState updated to %d", (int) mSupplyState);
+        MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, SupplyState::Id);
+    }
+    return CHIP_NO_ERROR;
+}
+
+/* FaultState */
+FaultStateEnum EnergyEvseDelegate::GetFaultState()
+{
+    return mFaultState;
+}
+CHIP_ERROR EnergyEvseDelegate::SetFaultState(FaultStateEnum newValue)
+{
+    FaultStateEnum oldValue = mFaultState;
+
+    if (newValue >= FaultStateEnum::kUnknownEnumValue)
+    {
+        return CHIP_IM_GLOBAL_STATUS(ConstraintError);
+    }
+
+    mFaultState = newValue;
+    if (oldValue != mFaultState)
+    {
+        ChipLogDetail(AppServer, "FaultState updated to %d", (int) mFaultState);
+        MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, FaultState::Id);
+    }
+    return CHIP_NO_ERROR;
+}
+
+/* ChargingEnabledUntil */
+DataModel::Nullable<uint32_t> EnergyEvseDelegate::GetChargingEnabledUntil()
+{
+    return mChargingEnabledUntil;
+}
+CHIP_ERROR EnergyEvseDelegate::SetChargingEnabledUntil(uint32_t newValue)
+{
+    DataModel::Nullable<uint32_t> oldValue = mChargingEnabledUntil;
+
+    mChargingEnabledUntil = MakeNullable(newValue);
+    if ((oldValue.IsNull()) || (oldValue.Value() != newValue))
+    {
+        ChipLogDetail(AppServer, "ChargingEnabledUntil updated to %d", mChargingEnabledUntil.Value());
+        MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, ChargingEnabledUntil::Id);
+    }
+    return CHIP_NO_ERROR;
+}
+/* DischargingEnabledUntil */
+DataModel::Nullable<uint32_t> EnergyEvseDelegate::GetDischargingEnabledUntil()
+{
+    return mDischargingEnabledUntil;
+}
+CHIP_ERROR EnergyEvseDelegate::SetDischargingEnabledUntil(uint32_t newValue)
+{
+    DataModel::Nullable<uint32_t> oldValue = mDischargingEnabledUntil;
+
+    mDischargingEnabledUntil = MakeNullable(newValue);
+    if ((oldValue.IsNull()) || (oldValue.Value() != newValue))
+    {
+        ChipLogDetail(AppServer, "DischargingEnabledUntil updated to %d", mDischargingEnabledUntil.Value());
+        MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, DischargingEnabledUntil::Id);
+    }
+    return CHIP_NO_ERROR;
+}
+/* CircuitCapacity */
+int64_t EnergyEvseDelegate::GetCircuitCapacity()
+{
+    return mCircuitCapacity;
+}
+CHIP_ERROR EnergyEvseDelegate::SetCircuitCapacity(int64_t newValue)
+{
+    int64_t oldValue = mCircuitCapacity;
+
+    if (newValue >= kMaximumChargeCurrent)
+    {
+        return CHIP_IM_GLOBAL_STATUS(ConstraintError);
+    }
+
+    mCircuitCapacity = newValue;
+    if (oldValue != mCircuitCapacity)
+    {
+        ChipLogDetail(AppServer, "CircuitCapacity updated to %" PRId64, mCircuitCapacity);
+        MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, CircuitCapacity::Id);
+    }
+    return CHIP_NO_ERROR;
+}
+/* MinimumChargeCurrent */
+int64_t EnergyEvseDelegate::GetMinimumChargeCurrent()
+{
+    return mMinimumChargeCurrent;
+}
+CHIP_ERROR EnergyEvseDelegate::SetMinimumChargeCurrent(int64_t newValue)
+{
+    int64_t oldValue = mMinimumChargeCurrent;
+
+    if (newValue >= kMaximumChargeCurrent)
+    {
+        return CHIP_IM_GLOBAL_STATUS(ConstraintError);
+    }
+
+    mMinimumChargeCurrent = newValue;
+    if (oldValue != mMinimumChargeCurrent)
+    {
+        ChipLogDetail(AppServer, "MinimumChargeCurrent updated to %" PRId64, mMinimumChargeCurrent);
+        MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, MinimumChargeCurrent::Id);
+    }
+    return CHIP_NO_ERROR;
+}
+
+/* MaximumChargeCurrent */
+int64_t EnergyEvseDelegate::GetMaximumChargeCurrent()
+{
+    return mMaximumChargeCurrent;
+}
+CHIP_ERROR EnergyEvseDelegate::SetMaximumChargeCurrent(int64_t newValue)
+{
+    int64_t oldValue = mMaximumChargeCurrent;
+
+    if (newValue >= kMaximumChargeCurrent)
+    {
+        return CHIP_IM_GLOBAL_STATUS(ConstraintError);
+    }
+
+    mMaximumChargeCurrent = newValue;
+    if (oldValue != mMaximumChargeCurrent)
+    {
+        ChipLogDetail(AppServer, "MaximumChargeCurrent updated to %" PRId64, mMaximumChargeCurrent);
+        MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, MaximumChargeCurrent::Id);
+    }
+    return CHIP_NO_ERROR;
+}
+/* MaximumDischargeCurrent */
+int64_t EnergyEvseDelegate::GetMaximumDischargeCurrent()
+{
+    return mMaximumDischargeCurrent;
+}
+CHIP_ERROR EnergyEvseDelegate::SetMaximumDischargeCurrent(int64_t newValue)
+{
+    int64_t oldValue = mMaximumDischargeCurrent;
+
+    if (newValue >= kMaximumChargeCurrent)
+    {
+        return CHIP_IM_GLOBAL_STATUS(ConstraintError);
+    }
+
+    mMaximumDischargeCurrent = newValue;
+    if (oldValue != mMaximumDischargeCurrent)
+    {
+        ChipLogDetail(AppServer, "MaximumDischargeCurrent updated to %" PRId64, mMaximumDischargeCurrent);
+        MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, MaximumDischargeCurrent::Id);
+    }
+    return CHIP_NO_ERROR;
+}
+/* UserMaximumChargeCurrent */
+int64_t EnergyEvseDelegate::GetUserMaximumChargeCurrent()
+{
+    return mUserMaximumChargeCurrent;
+}
+CHIP_ERROR EnergyEvseDelegate::SetUserMaximumChargeCurrent(int64_t newValue)
+{
+    if ((newValue < 0) || (newValue > kMaximumChargeCurrent))
+    {
+        return CHIP_IM_GLOBAL_STATUS(ConstraintError);
+    }
+
+    int64_t oldValue          = mUserMaximumChargeCurrent;
+    mUserMaximumChargeCurrent = newValue;
+    if (oldValue != newValue)
+    {
+        ChipLogDetail(AppServer, "UserMaximumChargeCurrent updated to %" PRId64, mUserMaximumChargeCurrent);
+        MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, UserMaximumChargeCurrent::Id);
+    }
+
+    return CHIP_NO_ERROR;
+}
+/* RandomizationDelayWindow */
+uint32_t EnergyEvseDelegate::GetRandomizationDelayWindow()
+{
+    return mRandomizationDelayWindow;
+}
+CHIP_ERROR EnergyEvseDelegate::SetRandomizationDelayWindow(uint32_t newValue)
+{
+    uint32_t oldValue = mRandomizationDelayWindow;
+    if (newValue > kMaxRandomizationDelayWindow)
+    {
+        return CHIP_IM_GLOBAL_STATUS(ConstraintError);
+    }
+
+    mRandomizationDelayWindow = newValue;
+    if (oldValue != newValue)
+    {
+        ChipLogDetail(AppServer, "RandomizationDelayWindow updated to %d", mRandomizationDelayWindow);
+        MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, RandomizationDelayWindow::Id);
+    }
+    return CHIP_NO_ERROR;
+}
+
+/* PREF attributes */
+uint8_t EnergyEvseDelegate::GetNumberOfWeeklyTargets()
+{
+    return mNumberOfWeeklyTargets;
+}
+uint8_t EnergyEvseDelegate::GetNumberOfDailyTargets()
+{
+    return mNumberOfDailyTargets;
+}
+DataModel::Nullable<uint32_t> EnergyEvseDelegate::GetNextChargeStartTime()
+{
+    return mNextChargeStartTime;
+}
+DataModel::Nullable<uint32_t> EnergyEvseDelegate::GetNextChargeTargetTime()
+{
+    return mNextChargeTargetTime;
+}
+DataModel::Nullable<int64_t> EnergyEvseDelegate::GetNextChargeRequiredEnergy()
+{
+    return mNextChargeRequiredEnergy;
+}
+DataModel::Nullable<chip::Percent> EnergyEvseDelegate::GetNextChargeTargetSoC()
+{
+    return mNextChargeTargetSoC;
+}
+
+/* ApproximateEVEfficiency */
+DataModel::Nullable<uint16_t> EnergyEvseDelegate::GetApproximateEVEfficiency()
+{
+    return mApproximateEVEfficiency;
+}
+CHIP_ERROR EnergyEvseDelegate::SetApproximateEVEfficiency(uint16_t newValue)
+{
+    DataModel::Nullable<uint16_t> oldValue = mApproximateEVEfficiency;
+
+    mApproximateEVEfficiency = MakeNullable(newValue);
+    if ((oldValue.IsNull()) || (oldValue.Value() != newValue))
+    {
+        ChipLogDetail(AppServer, "ApproximateEVEfficiency updated to %d", mApproximateEVEfficiency.Value());
+        MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, ApproximateEVEfficiency::Id);
+    }
+
+    return CHIP_NO_ERROR;
+}
+
+/* SOC attributes */
+DataModel::Nullable<chip::Percent> EnergyEvseDelegate::GetStateOfCharge()
+{
+    return mStateOfCharge;
+}
+DataModel::Nullable<int64_t> EnergyEvseDelegate::GetBatteryCapacity()
+{
+    return mBatteryCapacity;
+}
+
+/* PNC attributes*/
+char * EnergyEvseDelegate::GetVehicleID()
+{
+    // TODO handle this properly
+    return mVehicleID;
+}
+
+/* Session SESS attributes */
+DataModel::Nullable<uint32_t> EnergyEvseDelegate::GetSessionID()
+{
+    return mSessionID;
+}
+DataModel::Nullable<uint32_t> EnergyEvseDelegate::GetSessionDuration()
+{
+    return mSessionDuration;
+}
+DataModel::Nullable<int64_t> EnergyEvseDelegate::GetSessionEnergyCharged()
+{
+    return mSessionEnergyCharged;
+}
+DataModel::Nullable<int64_t> EnergyEvseDelegate::GetSessionEnergyDischarged()
+{
+    return mSessionEnergyDischarged;
+}
diff --git a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp
new file mode 100644
index 00000000000000..d9eb5ce0a7ac7d
--- /dev/null
+++ b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp
@@ -0,0 +1,36 @@
+/*
+ *
+ *    Copyright (c) 2023 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 <EnergyEvseManager.h>
+
+using namespace chip::app;
+using namespace chip::app::Clusters;
+using namespace chip::app::Clusters::EnergyEvse;
+
+CHIP_ERROR EnergyEvseManager::Init()
+{
+    GetInstance()->Instance::Init();
+    return CHIP_NO_ERROR;
+}
+
+void EnergyEvseManager::Shutdown()
+{
+    GetInstance()->Instance::Shutdown();
+}
+
+void MatterEnergyEvsePluginServerInitCallback() {}
diff --git a/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp b/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp
new file mode 100644
index 00000000000000..a8b1444ae3148e
--- /dev/null
+++ b/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp
@@ -0,0 +1,36 @@
+/*
+ *
+ *    Copyright (c) 2023 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 <EnergyEvseManager.h>
+using namespace chip::app::Clusters;
+using namespace chip::app::Clusters::EnergyEvse;
+
+static EnergyEvseDelegate * gDelegate = nullptr;
+static EnergyEvseManager * gInstance  = nullptr;
+
+void emberAfEnergyEvseClusterInitCallback(chip::EndpointId endpointId)
+{
+    VerifyOrDie(endpointId == 1); // this cluster is only enabled for endpoint 1.
+    VerifyOrDie(gInstance == nullptr);
+    gDelegate = new EnergyEvseDelegate();
+    if (gDelegate != nullptr)
+    {
+        gInstance = new EnergyEvseManager(endpointId, *gDelegate);
+        gInstance->Init(); /* Register Attribute & Command handlers */
+    }
+}
diff --git a/examples/all-clusters-app/linux/BUILD.gn b/examples/all-clusters-app/linux/BUILD.gn
index cfe028c7af7cc5..ab44dc47fbf36d 100644
--- a/examples/all-clusters-app/linux/BUILD.gn
+++ b/examples/all-clusters-app/linux/BUILD.gn
@@ -27,6 +27,9 @@ source_set("chip-all-clusters-common") {
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/concentration-measurement-instances.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/dishwasher-alarm-stub.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/dishwasher-mode.cpp",
+    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp",
+    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp",
+    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/fan-stub.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/laundry-washer-controls-delegate-impl.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/laundry-washer-mode.cpp",

From e47f734751f74c8e25c2b83c2bd32e73fea17684 Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Tue, 5 Dec 2023 17:00:36 +0000
Subject: [PATCH 12/80] Fixed lint error (Remove PRId64)

---
 .../src/EnergyEvseDelegateImpl.cpp                   | 12 ++++++------
 .../src/EnergyEvseDelegateImpl.cpp                   | 12 ++++++------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
index bf8159416537a5..ac0dd611f803f2 100644
--- a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
+++ b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
@@ -382,7 +382,7 @@ Status EnergyEvseDelegate::ComputeMaxChargeCurrentLimit()
 
     if (oldValue != mMaximumChargeCurrent)
     {
-        ChipLogDetail(AppServer, "MaximumChargeCurrent updated to %" PRId64, mMaximumChargeCurrent);
+        ChipLogDetail(AppServer, "MaximumChargeCurrent updated to %ld", static_cast<long>(mMaximumChargeCurrent));
         MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, MaximumChargeCurrent::Id);
 
         /* Call the EV Charger hardware current limit callback */
@@ -514,7 +514,7 @@ CHIP_ERROR EnergyEvseDelegate::SetCircuitCapacity(int64_t newValue)
     mCircuitCapacity = newValue;
     if (oldValue != mCircuitCapacity)
     {
-        ChipLogDetail(AppServer, "CircuitCapacity updated to %" PRId64, mCircuitCapacity);
+        ChipLogDetail(AppServer, "CircuitCapacity updated to %ld", static_cast<long>(mCircuitCapacity));
         MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, CircuitCapacity::Id);
     }
     return CHIP_NO_ERROR;
@@ -536,7 +536,7 @@ CHIP_ERROR EnergyEvseDelegate::SetMinimumChargeCurrent(int64_t newValue)
     mMinimumChargeCurrent = newValue;
     if (oldValue != mMinimumChargeCurrent)
     {
-        ChipLogDetail(AppServer, "MinimumChargeCurrent updated to %" PRId64, mMinimumChargeCurrent);
+        ChipLogDetail(AppServer, "MinimumChargeCurrent updated to %ld", static_cast<long>(mMinimumChargeCurrent));
         MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, MinimumChargeCurrent::Id);
     }
     return CHIP_NO_ERROR;
@@ -559,7 +559,7 @@ CHIP_ERROR EnergyEvseDelegate::SetMaximumChargeCurrent(int64_t newValue)
     mMaximumChargeCurrent = newValue;
     if (oldValue != mMaximumChargeCurrent)
     {
-        ChipLogDetail(AppServer, "MaximumChargeCurrent updated to %" PRId64, mMaximumChargeCurrent);
+        ChipLogDetail(AppServer, "MaximumChargeCurrent updated to %ld", static_cast<long>(mMaximumChargeCurrent));
         MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, MaximumChargeCurrent::Id);
     }
     return CHIP_NO_ERROR;
@@ -581,7 +581,7 @@ CHIP_ERROR EnergyEvseDelegate::SetMaximumDischargeCurrent(int64_t newValue)
     mMaximumDischargeCurrent = newValue;
     if (oldValue != mMaximumDischargeCurrent)
     {
-        ChipLogDetail(AppServer, "MaximumDischargeCurrent updated to %" PRId64, mMaximumDischargeCurrent);
+        ChipLogDetail(AppServer, "MaximumDischargeCurrent updated to %ld", static_cast<long>(mMaximumDischargeCurrent));
         MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, MaximumDischargeCurrent::Id);
     }
     return CHIP_NO_ERROR;
@@ -602,7 +602,7 @@ CHIP_ERROR EnergyEvseDelegate::SetUserMaximumChargeCurrent(int64_t newValue)
     mUserMaximumChargeCurrent = newValue;
     if (oldValue != newValue)
     {
-        ChipLogDetail(AppServer, "UserMaximumChargeCurrent updated to %" PRId64, mUserMaximumChargeCurrent);
+        ChipLogDetail(AppServer, "UserMaximumChargeCurrent updated to %ld", static_cast<long>(mUserMaximumChargeCurrent));
         MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, UserMaximumChargeCurrent::Id);
     }
 
diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
index bf8159416537a5..ac0dd611f803f2 100644
--- a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
+++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
@@ -382,7 +382,7 @@ Status EnergyEvseDelegate::ComputeMaxChargeCurrentLimit()
 
     if (oldValue != mMaximumChargeCurrent)
     {
-        ChipLogDetail(AppServer, "MaximumChargeCurrent updated to %" PRId64, mMaximumChargeCurrent);
+        ChipLogDetail(AppServer, "MaximumChargeCurrent updated to %ld", static_cast<long>(mMaximumChargeCurrent));
         MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, MaximumChargeCurrent::Id);
 
         /* Call the EV Charger hardware current limit callback */
@@ -514,7 +514,7 @@ CHIP_ERROR EnergyEvseDelegate::SetCircuitCapacity(int64_t newValue)
     mCircuitCapacity = newValue;
     if (oldValue != mCircuitCapacity)
     {
-        ChipLogDetail(AppServer, "CircuitCapacity updated to %" PRId64, mCircuitCapacity);
+        ChipLogDetail(AppServer, "CircuitCapacity updated to %ld", static_cast<long>(mCircuitCapacity));
         MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, CircuitCapacity::Id);
     }
     return CHIP_NO_ERROR;
@@ -536,7 +536,7 @@ CHIP_ERROR EnergyEvseDelegate::SetMinimumChargeCurrent(int64_t newValue)
     mMinimumChargeCurrent = newValue;
     if (oldValue != mMinimumChargeCurrent)
     {
-        ChipLogDetail(AppServer, "MinimumChargeCurrent updated to %" PRId64, mMinimumChargeCurrent);
+        ChipLogDetail(AppServer, "MinimumChargeCurrent updated to %ld", static_cast<long>(mMinimumChargeCurrent));
         MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, MinimumChargeCurrent::Id);
     }
     return CHIP_NO_ERROR;
@@ -559,7 +559,7 @@ CHIP_ERROR EnergyEvseDelegate::SetMaximumChargeCurrent(int64_t newValue)
     mMaximumChargeCurrent = newValue;
     if (oldValue != mMaximumChargeCurrent)
     {
-        ChipLogDetail(AppServer, "MaximumChargeCurrent updated to %" PRId64, mMaximumChargeCurrent);
+        ChipLogDetail(AppServer, "MaximumChargeCurrent updated to %ld", static_cast<long>(mMaximumChargeCurrent));
         MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, MaximumChargeCurrent::Id);
     }
     return CHIP_NO_ERROR;
@@ -581,7 +581,7 @@ CHIP_ERROR EnergyEvseDelegate::SetMaximumDischargeCurrent(int64_t newValue)
     mMaximumDischargeCurrent = newValue;
     if (oldValue != mMaximumDischargeCurrent)
     {
-        ChipLogDetail(AppServer, "MaximumDischargeCurrent updated to %" PRId64, mMaximumDischargeCurrent);
+        ChipLogDetail(AppServer, "MaximumDischargeCurrent updated to %ld", static_cast<long>(mMaximumDischargeCurrent));
         MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, MaximumDischargeCurrent::Id);
     }
     return CHIP_NO_ERROR;
@@ -602,7 +602,7 @@ CHIP_ERROR EnergyEvseDelegate::SetUserMaximumChargeCurrent(int64_t newValue)
     mUserMaximumChargeCurrent = newValue;
     if (oldValue != newValue)
     {
-        ChipLogDetail(AppServer, "UserMaximumChargeCurrent updated to %" PRId64, mUserMaximumChargeCurrent);
+        ChipLogDetail(AppServer, "UserMaximumChargeCurrent updated to %ld", static_cast<long>(mUserMaximumChargeCurrent));
         MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, UserMaximumChargeCurrent::Id);
     }
 

From 7434ae8ac54a80b834911fc4dfc0add15fab1d77 Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Tue, 5 Dec 2023 18:46:17 +0000
Subject: [PATCH 13/80] Fix for Documentation Build and publish checker.

---
 docs/examples/index.md | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/docs/examples/index.md b/docs/examples/index.md
index 03835b1c41ca37..a8d8bed25d8314 100644
--- a/docs/examples/index.md
+++ b/docs/examples/index.md
@@ -78,6 +78,15 @@ chip-tool/README
 darwin-framework-tool/README
 ```
 
+## Energy Management example
+
+```{toctree}
+:glob:
+:maxdepth: 1
+
+energy-management-app/**/README
+```
+
 ## Java matter controller example
 
 ```{toctree}

From b88e826db79c61e60c9aac3c3142b59bb416fefa Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Tue, 5 Dec 2023 19:32:39 +0000
Subject: [PATCH 14/80] Updated all-clusters-app.zap after merge and regen_all

---
 .../all-clusters-common/all-clusters-app.zap              | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

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 b60a91d69be820..7381c038248a7c 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
@@ -11943,7 +11943,7 @@
               "storageOption": "External",
               "singleton": 0,
               "bounded": 0,
-              "defaultValue": "",
+              "defaultValue": null,
               "reportable": 1,
               "minInterval": 1,
               "maxInterval": 65534,
@@ -11959,7 +11959,7 @@
               "storageOption": "External",
               "singleton": 0,
               "bounded": 0,
-              "defaultValue": "",
+              "defaultValue": null,
               "reportable": 1,
               "minInterval": 1,
               "maxInterval": 65534,
@@ -11975,7 +11975,7 @@
               "storageOption": "External",
               "singleton": 0,
               "bounded": 0,
-              "defaultValue": "",
+              "defaultValue": null,
               "reportable": 1,
               "minInterval": 1,
               "maxInterval": 65534,
@@ -11991,7 +11991,7 @@
               "storageOption": "External",
               "singleton": 0,
               "bounded": 0,
-              "defaultValue": "",
+              "defaultValue": null,
               "reportable": 1,
               "minInterval": 1,
               "maxInterval": 65534,

From 8b927001c67519fda1cbd979ff0dfb513670597b Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Tue, 5 Dec 2023 19:48:46 +0000
Subject: [PATCH 15/80] Added Cluster to ESP32 CMakeLists.txt

---
 examples/all-clusters-app/esp32/main/CMakeLists.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/examples/all-clusters-app/esp32/main/CMakeLists.txt b/examples/all-clusters-app/esp32/main/CMakeLists.txt
index 2687ad0da28539..92f293f7cf5b57 100644
--- a/examples/all-clusters-app/esp32/main/CMakeLists.txt
+++ b/examples/all-clusters-app/esp32/main/CMakeLists.txt
@@ -72,6 +72,7 @@ set(SRC_DIRS_LIST
                       "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/icd-management-server"
                       "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/diagnostic-logs-server"
                       "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/occupancy-sensor-server"
+                      "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/energy-evse-server"
                       "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/ethernet-network-diagnostics-server"
                       "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/localization-configuration-server"
                       "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/time-format-localization-server"
@@ -84,7 +85,7 @@ set(SRC_DIRS_LIST
                       "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/temperature-control-server"
                       "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/time-synchronization-server"
                       "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/dishwasher-alarm-server"
-		      "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/laundry-washer-controls-server"
+                      "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/laundry-washer-controls-server"
                       "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/all-clusters-app/all-clusters-common/src"
 )
 

From a368a5dd1b0015714b30146c3a54235b8890397d Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Tue, 5 Dec 2023 19:49:10 +0000
Subject: [PATCH 16/80] Fixed ESP32 compile error caused by %d

---
 .../all-clusters-common/src/EnergyEvseDelegateImpl.cpp          | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
index ac0dd611f803f2..0e5aab43d485be 100644
--- a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
+++ b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
@@ -114,7 +114,7 @@ Status EnergyEvseDelegate::EnableCharging(const chip::app::DataModel::Nullable<u
     else
     {
         /* check chargingEnabledUntil is in the future */
-        ChipLogError(NotSpecified, "Charging enabled until: %d", chargingEnabledUntil.Value());
+        ChipLogError(NotSpecified, "Charging enabled until: %lu", static_cast<long unsigned int>(chargingEnabledUntil.Value()));
         // TODO
         // if (checkChargingEnabled)
     }

From c96744af97297751a7aabfedb8e5e86a30f2e635 Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Tue, 5 Dec 2023 22:18:45 +0000
Subject: [PATCH 17/80] Added missing source files to each build variant

---
 examples/all-clusters-app/ameba/chip_main.cmake     | 3 +++
 examples/all-clusters-app/asr/BUILD.gn              | 3 +++
 examples/all-clusters-app/cc13x2x7_26x2x7/BUILD.gn  | 3 +++
 examples/all-clusters-app/cc13x4_26x4/BUILD.gn      | 3 +++
 examples/all-clusters-app/infineon/psoc6/BUILD.gn   | 3 +++
 examples/all-clusters-app/linux/BUILD.gn            | 2 +-
 examples/all-clusters-app/mbed/CMakeLists.txt       | 3 +++
 examples/all-clusters-app/nrfconnect/CMakeLists.txt | 3 +++
 examples/all-clusters-app/nxp/mw320/BUILD.gn        | 3 +++
 examples/all-clusters-app/nxp/rt/rw61x/BUILD.gn     | 3 +++
 examples/all-clusters-app/openiotsdk/CMakeLists.txt | 3 +++
 examples/all-clusters-app/telink/CMakeLists.txt     | 3 +++
 examples/all-clusters-app/tizen/BUILD.gn            | 3 +++
 13 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/examples/all-clusters-app/ameba/chip_main.cmake b/examples/all-clusters-app/ameba/chip_main.cmake
index 07052e123757cd..f3c6a54854c475 100755
--- a/examples/all-clusters-app/ameba/chip_main.cmake
+++ b/examples/all-clusters-app/ameba/chip_main.cmake
@@ -156,6 +156,9 @@ list(
     ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp
     ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/air-quality-instance.cpp
     ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/concentration-measurement-instances.cpp
+    ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
+    ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp
+    ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp
     ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/fan-stub.cpp
     ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/laundry-washer-controls-delegate-impl.cpp
     ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/resource-monitoring-delegates.cpp
diff --git a/examples/all-clusters-app/asr/BUILD.gn b/examples/all-clusters-app/asr/BUILD.gn
index 9447bbe9d3c45d..822dc5a06a4dcd 100755
--- a/examples/all-clusters-app/asr/BUILD.gn
+++ b/examples/all-clusters-app/asr/BUILD.gn
@@ -74,6 +74,9 @@ asr_executable("clusters_app") {
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/air-quality-instance.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/concentration-measurement-instances.cpp",
+    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp",
+    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp",
+    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/fan-stub.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/resource-monitoring-delegates.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp",
diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/BUILD.gn b/examples/all-clusters-app/cc13x2x7_26x2x7/BUILD.gn
index 6c991abac181a1..e1ce42e563f03f 100644
--- a/examples/all-clusters-app/cc13x2x7_26x2x7/BUILD.gn
+++ b/examples/all-clusters-app/cc13x2x7_26x2x7/BUILD.gn
@@ -79,6 +79,9 @@ ti_simplelink_executable("all-clusters-app") {
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/binding-handler.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/concentration-measurement-instances.cpp",
+    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp",
+    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp",
+    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/fan-stub.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/resource-monitoring-delegates.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp",
diff --git a/examples/all-clusters-app/cc13x4_26x4/BUILD.gn b/examples/all-clusters-app/cc13x4_26x4/BUILD.gn
index 97ca8d972051a4..9b438da8e93fdf 100644
--- a/examples/all-clusters-app/cc13x4_26x4/BUILD.gn
+++ b/examples/all-clusters-app/cc13x4_26x4/BUILD.gn
@@ -79,6 +79,9 @@ ti_simplelink_executable("all-clusters-app") {
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/binding-handler.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/concentration-measurement-instances.cpp",
+    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp",
+    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp",
+    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/fan-stub.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/resource-monitoring-delegates.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp",
diff --git a/examples/all-clusters-app/infineon/psoc6/BUILD.gn b/examples/all-clusters-app/infineon/psoc6/BUILD.gn
index d61814767374d2..a236d788f51750 100644
--- a/examples/all-clusters-app/infineon/psoc6/BUILD.gn
+++ b/examples/all-clusters-app/infineon/psoc6/BUILD.gn
@@ -110,6 +110,9 @@ psoc6_executable("clusters_app") {
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/air-quality-instance.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/concentration-measurement-instances.cpp",
+    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp",
+    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp",
+    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/fan-stub.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/resource-monitoring-delegates.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp",
diff --git a/examples/all-clusters-app/linux/BUILD.gn b/examples/all-clusters-app/linux/BUILD.gn
index ab44dc47fbf36d..89124a98a686b8 100644
--- a/examples/all-clusters-app/linux/BUILD.gn
+++ b/examples/all-clusters-app/linux/BUILD.gn
@@ -27,9 +27,9 @@ source_set("chip-all-clusters-common") {
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/concentration-measurement-instances.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/dishwasher-alarm-stub.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/dishwasher-mode.cpp",
-    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp",
+    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/fan-stub.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/laundry-washer-controls-delegate-impl.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/laundry-washer-mode.cpp",
diff --git a/examples/all-clusters-app/mbed/CMakeLists.txt b/examples/all-clusters-app/mbed/CMakeLists.txt
index 486901342dbb08..79a48c85938f78 100644
--- a/examples/all-clusters-app/mbed/CMakeLists.txt
+++ b/examples/all-clusters-app/mbed/CMakeLists.txt
@@ -63,6 +63,9 @@ target_sources(${APP_TARGET} PRIVATE
                ${ALL_CLUSTERS_COMMON}/src/air-quality-instance.cpp
                ${ALL_CLUSTERS_COMMON}/src/concentration-measurement-instances.cpp
                ${ALL_CLUSTERS_COMMON}/src/fan-stub.cpp
+               ${ALL_CLUSTERS_COMMON}/src/EnergyEvseDelegateImpl.cpp
+               ${ALL_CLUSTERS_COMMON}/src/EnergyEvseManager.cpp
+               ${ALL_CLUSTERS_COMMON}/src/energy-evse-stub.cpp
                ${ALL_CLUSTERS_COMMON}/src/resource-monitoring-delegates.cpp
                ${ALL_CLUSTERS_COMMON}/src/smco-stub.cpp
                ${ALL_CLUSTERS_COMMON}/src/static-supported-modes-manager.cpp
diff --git a/examples/all-clusters-app/nrfconnect/CMakeLists.txt b/examples/all-clusters-app/nrfconnect/CMakeLists.txt
index 029210cbf28720..72b93e0647724c 100644
--- a/examples/all-clusters-app/nrfconnect/CMakeLists.txt
+++ b/examples/all-clusters-app/nrfconnect/CMakeLists.txt
@@ -61,6 +61,9 @@ target_sources(app PRIVATE
                ${ALL_CLUSTERS_COMMON_DIR}/src/static-supported-temperature-levels.cpp
                ${ALL_CLUSTERS_COMMON_DIR}/src/bridged-actions-stub.cpp
                ${ALL_CLUSTERS_COMMON_DIR}/src/fan-stub.cpp
+               ${ALL_CLUSTERS_COMMON_DIR}/src/EnergyEvseDelegateImpl.cpp
+               ${ALL_CLUSTERS_COMMON_DIR}/src/EnergyEvseManager.cpp
+               ${ALL_CLUSTERS_COMMON_DIR}/src/energy-evse-stub.cpp
                ${ALL_CLUSTERS_COMMON_DIR}/src/binding-handler.cpp
                ${ALL_CLUSTERS_COMMON_DIR}/src/air-quality-instance.cpp
                ${ALL_CLUSTERS_COMMON_DIR}/src/concentration-measurement-instances.cpp
diff --git a/examples/all-clusters-app/nxp/mw320/BUILD.gn b/examples/all-clusters-app/nxp/mw320/BUILD.gn
index f7f415961a7481..b9d595749dde4a 100644
--- a/examples/all-clusters-app/nxp/mw320/BUILD.gn
+++ b/examples/all-clusters-app/nxp/mw320/BUILD.gn
@@ -78,6 +78,9 @@ mw320_executable("shell_mw320") {
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/concentration-measurement-instances.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/fan-stub.cpp",
+    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp",
+    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp",
+    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/resource-monitoring-delegates.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp",
diff --git a/examples/all-clusters-app/nxp/rt/rw61x/BUILD.gn b/examples/all-clusters-app/nxp/rt/rw61x/BUILD.gn
index 4c0ccba283249b..ee93413dfda79a 100644
--- a/examples/all-clusters-app/nxp/rt/rw61x/BUILD.gn
+++ b/examples/all-clusters-app/nxp/rt/rw61x/BUILD.gn
@@ -118,6 +118,9 @@ rt_executable("all_cluster_app") {
     defines += [ "DEVICE_TYPE_ALL_CLUSTERS" ]
     sources += [
       "${chip_root}/examples/${app_common_folder}/src/bridged-actions-stub.cpp",
+      "${chip_root}/examples/${app_common_folder}/src/EnergyEvseDelegateImpl.cpp",
+      "${chip_root}/examples/${app_common_folder}/src/EnergyEvseManager.cpp",
+      "${chip_root}/examples/${app_common_folder}/src/energy-evse-stub.cpp",
       "${chip_root}/examples/${app_common_folder}/src/smco-stub.cpp",
       "${chip_root}/examples/${app_common_folder}/src/static-supported-modes-manager.cpp",
     ]
diff --git a/examples/all-clusters-app/openiotsdk/CMakeLists.txt b/examples/all-clusters-app/openiotsdk/CMakeLists.txt
index 6b2e7cc87b3157..dce8295b300cb4 100644
--- a/examples/all-clusters-app/openiotsdk/CMakeLists.txt
+++ b/examples/all-clusters-app/openiotsdk/CMakeLists.txt
@@ -57,6 +57,9 @@ target_sources(${APP_TARGET}
         ${ALL_CLUSTERS_COMMON}/src/air-quality-instance.cpp
         ${ALL_CLUSTERS_COMMON}/src/concentration-measurement-instances.cpp
         ${ALL_CLUSTERS_COMMON}/src/fan-stub.cpp
+        ${ALL_CLUSTERS_COMMON}/src/EnergyEvseDelegateImpl.cpp
+        ${ALL_CLUSTERS_COMMON}/src/EnergyEvseManager.cpp
+        ${ALL_CLUSTERS_COMMON}/src/energy-evse-stub.cpp
         ${ALL_CLUSTERS_COMMON}/src/resource-monitoring-delegates.cpp
         ${ALL_CLUSTERS_COMMON}/src/static-supported-modes-manager.cpp
         ${ALL_CLUSTERS_COMMON}/src/binding-handler.cpp
diff --git a/examples/all-clusters-app/telink/CMakeLists.txt b/examples/all-clusters-app/telink/CMakeLists.txt
index 46b7b72960b65b..fa279aa4c8a90f 100644
--- a/examples/all-clusters-app/telink/CMakeLists.txt
+++ b/examples/all-clusters-app/telink/CMakeLists.txt
@@ -84,6 +84,9 @@ target_sources(app PRIVATE
                ${ALL_CLUSTERS_COMMON_DIR}/src/air-quality-instance.cpp
                ${ALL_CLUSTERS_COMMON_DIR}/src/concentration-measurement-instances.cpp
                ${ALL_CLUSTERS_COMMON_DIR}/src/fan-stub.cpp
+               ${ALL_CLUSTERS_COMMON_DIR}/src/EnergyEvseDelegateImpl.cpp
+               ${ALL_CLUSTERS_COMMON_DIR}/src/EnergyEvseManager.cpp
+               ${ALL_CLUSTERS_COMMON_DIR}/src/energy-evse-stub.cpp
                ${ALL_CLUSTERS_COMMON_DIR}/src/resource-monitoring-delegates.cpp
                ${TELINK_COMMON}/common/src/mainCommon.cpp
                ${TELINK_COMMON}/common/src/AppTaskCommon.cpp
diff --git a/examples/all-clusters-app/tizen/BUILD.gn b/examples/all-clusters-app/tizen/BUILD.gn
index 1f40d96500c012..1b7899cf4b82d4 100644
--- a/examples/all-clusters-app/tizen/BUILD.gn
+++ b/examples/all-clusters-app/tizen/BUILD.gn
@@ -28,6 +28,9 @@ source_set("chip-all-clusters-common") {
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/concentration-measurement-instances.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/fan-stub.cpp",
+    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp",
+    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp",
+    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/resource-monitoring-delegates.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp",

From 68479cc56d5ea9fa642faaebba359a1e649fca0c Mon Sep 17 00:00:00 2001
From: "Restyled.io" <commits@restyled.io>
Date: Tue, 5 Dec 2023 22:20:25 +0000
Subject: [PATCH 18/80] Restyled by gn

---
 examples/all-clusters-app/asr/BUILD.gn             | 4 ++--
 examples/all-clusters-app/cc13x2x7_26x2x7/BUILD.gn | 4 ++--
 examples/all-clusters-app/cc13x4_26x4/BUILD.gn     | 4 ++--
 examples/all-clusters-app/infineon/psoc6/BUILD.gn  | 4 ++--
 examples/all-clusters-app/linux/BUILD.gn           | 4 ++--
 examples/all-clusters-app/nxp/mw320/BUILD.gn       | 6 +++---
 examples/all-clusters-app/nxp/rt/rw61x/BUILD.gn    | 2 +-
 examples/all-clusters-app/tizen/BUILD.gn           | 6 +++---
 8 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/examples/all-clusters-app/asr/BUILD.gn b/examples/all-clusters-app/asr/BUILD.gn
index 822dc5a06a4dcd..75c4a3171cfd4a 100755
--- a/examples/all-clusters-app/asr/BUILD.gn
+++ b/examples/all-clusters-app/asr/BUILD.gn
@@ -71,11 +71,11 @@ asr_executable("clusters_app") {
   output_name = "chip-asr-clusters-example.out"
 
   sources = [
+    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp",
+    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/air-quality-instance.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/concentration-measurement-instances.cpp",
-    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp",
-    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/fan-stub.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/resource-monitoring-delegates.cpp",
diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/BUILD.gn b/examples/all-clusters-app/cc13x2x7_26x2x7/BUILD.gn
index e1ce42e563f03f..ad07e2c7a0da32 100644
--- a/examples/all-clusters-app/cc13x2x7_26x2x7/BUILD.gn
+++ b/examples/all-clusters-app/cc13x2x7_26x2x7/BUILD.gn
@@ -75,12 +75,12 @@ ti_simplelink_executable("all-clusters-app") {
   output_name = "chip-${ti_simplelink_board}-all-clusters-example.out"
 
   sources = [
+    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp",
+    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/air-quality-instance.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/binding-handler.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/concentration-measurement-instances.cpp",
-    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp",
-    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/fan-stub.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/resource-monitoring-delegates.cpp",
diff --git a/examples/all-clusters-app/cc13x4_26x4/BUILD.gn b/examples/all-clusters-app/cc13x4_26x4/BUILD.gn
index 9b438da8e93fdf..d8f61a2766d54a 100644
--- a/examples/all-clusters-app/cc13x4_26x4/BUILD.gn
+++ b/examples/all-clusters-app/cc13x4_26x4/BUILD.gn
@@ -75,12 +75,12 @@ ti_simplelink_executable("all-clusters-app") {
   output_name = "chip-${ti_simplelink_board}-all-clusters-example.out"
 
   sources = [
+    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp",
+    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/air-quality-instance.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/binding-handler.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/concentration-measurement-instances.cpp",
-    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp",
-    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/fan-stub.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/resource-monitoring-delegates.cpp",
diff --git a/examples/all-clusters-app/infineon/psoc6/BUILD.gn b/examples/all-clusters-app/infineon/psoc6/BUILD.gn
index a236d788f51750..b99dc84405e841 100644
--- a/examples/all-clusters-app/infineon/psoc6/BUILD.gn
+++ b/examples/all-clusters-app/infineon/psoc6/BUILD.gn
@@ -107,11 +107,11 @@ psoc6_executable("clusters_app") {
   output_name = "chip-psoc6-clusters-example.out"
 
   sources = [
+    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp",
+    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/air-quality-instance.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/concentration-measurement-instances.cpp",
-    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp",
-    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/fan-stub.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/resource-monitoring-delegates.cpp",
diff --git a/examples/all-clusters-app/linux/BUILD.gn b/examples/all-clusters-app/linux/BUILD.gn
index 89124a98a686b8..b3eb61c29f875a 100644
--- a/examples/all-clusters-app/linux/BUILD.gn
+++ b/examples/all-clusters-app/linux/BUILD.gn
@@ -21,14 +21,14 @@ import("${chip_root}/src/platform/device.gni")
 
 source_set("chip-all-clusters-common") {
   sources = [
+    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp",
+    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/air-quality-instance.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/binding-handler.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/concentration-measurement-instances.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/dishwasher-alarm-stub.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/dishwasher-mode.cpp",
-    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp",
-    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/fan-stub.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/laundry-washer-controls-delegate-impl.cpp",
diff --git a/examples/all-clusters-app/nxp/mw320/BUILD.gn b/examples/all-clusters-app/nxp/mw320/BUILD.gn
index b9d595749dde4a..ab7be5a04d64c1 100644
--- a/examples/all-clusters-app/nxp/mw320/BUILD.gn
+++ b/examples/all-clusters-app/nxp/mw320/BUILD.gn
@@ -74,13 +74,13 @@ mw320_executable("shell_mw320") {
     "${chip_root}/examples/all-clusters-app/nxp/mw320/include",
   ]
   sources = [
+    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp",
+    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/air-quality-instance.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/concentration-measurement-instances.cpp",
-    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/fan-stub.cpp",
-    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp",
-    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp",
+    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/fan-stub.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/resource-monitoring-delegates.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp",
diff --git a/examples/all-clusters-app/nxp/rt/rw61x/BUILD.gn b/examples/all-clusters-app/nxp/rt/rw61x/BUILD.gn
index ee93413dfda79a..6f167c92ce5be2 100644
--- a/examples/all-clusters-app/nxp/rt/rw61x/BUILD.gn
+++ b/examples/all-clusters-app/nxp/rt/rw61x/BUILD.gn
@@ -117,9 +117,9 @@ rt_executable("all_cluster_app") {
   if (nxp_device_type == "all-clusters") {
     defines += [ "DEVICE_TYPE_ALL_CLUSTERS" ]
     sources += [
-      "${chip_root}/examples/${app_common_folder}/src/bridged-actions-stub.cpp",
       "${chip_root}/examples/${app_common_folder}/src/EnergyEvseDelegateImpl.cpp",
       "${chip_root}/examples/${app_common_folder}/src/EnergyEvseManager.cpp",
+      "${chip_root}/examples/${app_common_folder}/src/bridged-actions-stub.cpp",
       "${chip_root}/examples/${app_common_folder}/src/energy-evse-stub.cpp",
       "${chip_root}/examples/${app_common_folder}/src/smco-stub.cpp",
       "${chip_root}/examples/${app_common_folder}/src/static-supported-modes-manager.cpp",
diff --git a/examples/all-clusters-app/tizen/BUILD.gn b/examples/all-clusters-app/tizen/BUILD.gn
index 1b7899cf4b82d4..6960ec6aa6d516 100644
--- a/examples/all-clusters-app/tizen/BUILD.gn
+++ b/examples/all-clusters-app/tizen/BUILD.gn
@@ -23,14 +23,14 @@ assert(chip_build_tools)
 
 source_set("chip-all-clusters-common") {
   sources = [
+    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp",
+    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/air-quality-instance.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/binding-handler.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/concentration-measurement-instances.cpp",
-    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/fan-stub.cpp",
-    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp",
-    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp",
+    "${chip_root}/examples/all-clusters-app/all-clusters-common/src/fan-stub.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/resource-monitoring-delegates.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp",
     "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp",

From 919fafbbaa3cacf75c95f2cafc66278142b970f0 Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Tue, 5 Dec 2023 22:43:05 +0000
Subject: [PATCH 19/80] Fixed incorrect uint64_t in
 EnableCharging/EnableDischarging command

---
 .../all-clusters-common/src/EnergyEvseDelegateImpl.cpp        | 4 ++--
 .../energy-management-common/src/EnergyEvseDelegateImpl.cpp   | 4 ++--
 src/app/clusters/energy-evse-server/energy-evse-server.h      | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
index 0e5aab43d485be..9503388e6d17f0 100644
--- a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
+++ b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
@@ -84,7 +84,7 @@ Status EnergyEvseDelegate::Disable()
  * @param maximumChargeCurrent (in mA)
  */
 Status EnergyEvseDelegate::EnableCharging(const chip::app::DataModel::Nullable<uint32_t> & chargingEnabledUntil,
-                                          const uint64_t & minimumChargeCurrent, const uint64_t & maximumChargeCurrent)
+                                          const int64_t & minimumChargeCurrent, const int64_t & maximumChargeCurrent)
 {
     ChipLogProgress(AppServer, "EnergyEvseDelegate::EnableCharging()");
 
@@ -164,7 +164,7 @@ Status EnergyEvseDelegate::EnableCharging(const chip::app::DataModel::Nullable<u
  * @param maximumChargeCurrent (in mA)
  */
 Status EnergyEvseDelegate::EnableDischarging(const chip::app::DataModel::Nullable<uint32_t> & dischargingEnabledUntil,
-                                             const uint64_t & maximumDischargeCurrent)
+                                             const int64_t & maximumDischargeCurrent)
 {
     ChipLogProgress(AppServer, "EnergyEvseDelegate::EnableDischarging() called.");
 
diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
index ac0dd611f803f2..75532d64370311 100644
--- a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
+++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
@@ -84,7 +84,7 @@ Status EnergyEvseDelegate::Disable()
  * @param maximumChargeCurrent (in mA)
  */
 Status EnergyEvseDelegate::EnableCharging(const chip::app::DataModel::Nullable<uint32_t> & chargingEnabledUntil,
-                                          const uint64_t & minimumChargeCurrent, const uint64_t & maximumChargeCurrent)
+                                          const int64_t & minimumChargeCurrent, const int64_t & maximumChargeCurrent)
 {
     ChipLogProgress(AppServer, "EnergyEvseDelegate::EnableCharging()");
 
@@ -164,7 +164,7 @@ Status EnergyEvseDelegate::EnableCharging(const chip::app::DataModel::Nullable<u
  * @param maximumChargeCurrent (in mA)
  */
 Status EnergyEvseDelegate::EnableDischarging(const chip::app::DataModel::Nullable<uint32_t> & dischargingEnabledUntil,
-                                             const uint64_t & maximumDischargeCurrent)
+                                             const int64_t & maximumDischargeCurrent)
 {
     ChipLogProgress(AppServer, "EnergyEvseDelegate::EnableDischarging() called.");
 
diff --git a/src/app/clusters/energy-evse-server/energy-evse-server.h b/src/app/clusters/energy-evse-server/energy-evse-server.h
index 9ae79a9c90215d..1d86d96d1b5c06 100644
--- a/src/app/clusters/energy-evse-server/energy-evse-server.h
+++ b/src/app/clusters/energy-evse-server/energy-evse-server.h
@@ -62,7 +62,7 @@ class Delegate
      * return other Status codes if it fails
      */
     virtual Status EnableCharging(const chip::app::DataModel::Nullable<uint32_t> & enableChargeTime,
-                                  const uint64_t & minimumChargeCurrent, const uint64_t & maximumChargeCurrent) = 0;
+                                  const int64_t & minimumChargeCurrent, const int64_t & maximumChargeCurrent) = 0;
 
     /**
      * @brief Delegate should implement a handler to enable EVSE Discharging.
@@ -70,7 +70,7 @@ class Delegate
      * return other Status codes if it fails
      */
     virtual Status EnableDischarging(const chip::app::DataModel::Nullable<uint32_t> & enableDischargeTime,
-                                     const uint64_t & maximumDischargeCurrent) = 0;
+                                     const int64_t & maximumDischargeCurrent) = 0;
 
     /**
      * @brief Delegate should implement a handler to enable EVSE Diagnostics.

From 2cab3122f5cd27b31ff087b277488154b4898005 Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Tue, 5 Dec 2023 22:56:54 +0000
Subject: [PATCH 20/80] Fixed more issues seen on different platforms

---
 .../include/EnergyEvseDelegateImpl.h                |  4 ++--
 .../include/EnergyEvseDelegateImpl.h                |  4 ++--
 .../energy-evse-server/energy-evse-server.cpp       | 13 -------------
 .../energy-evse-server/energy-evse-server.h         | 10 ++++++++--
 4 files changed, 12 insertions(+), 19 deletions(-)

diff --git a/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h b/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h
index 09cb1deae4bc02..10ae22ede314bc 100644
--- a/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h
+++ b/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h
@@ -50,7 +50,7 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate
      * @param maximumChargeCurrent (in mA)
      */
     Status EnableCharging(const chip::app::DataModel::Nullable<uint32_t> & chargingEnabledUntil,
-                          const uint64_t & minimumChargeCurrent, const uint64_t & maximumChargeCurrent) override;
+                          const int64_t & minimumChargeCurrent, const int64_t & maximumChargeCurrent) override;
 
     /**
      * @brief   Called when EVSE cluster receives EnableDischarging command
@@ -59,7 +59,7 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate
      * @param maximumChargeCurrent (in mA)
      */
     Status EnableDischarging(const chip::app::DataModel::Nullable<uint32_t> & dischargingEnabledUntil,
-                             const uint64_t & maximumDischargeCurrent) override;
+                             const int64_t & maximumDischargeCurrent) override;
 
     /**
      * @brief    Called when EVSE cluster receives StartDiagnostics command
diff --git a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h
index 09cb1deae4bc02..10ae22ede314bc 100644
--- a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h
+++ b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h
@@ -50,7 +50,7 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate
      * @param maximumChargeCurrent (in mA)
      */
     Status EnableCharging(const chip::app::DataModel::Nullable<uint32_t> & chargingEnabledUntil,
-                          const uint64_t & minimumChargeCurrent, const uint64_t & maximumChargeCurrent) override;
+                          const int64_t & minimumChargeCurrent, const int64_t & maximumChargeCurrent) override;
 
     /**
      * @brief   Called when EVSE cluster receives EnableDischarging command
@@ -59,7 +59,7 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate
      * @param maximumChargeCurrent (in mA)
      */
     Status EnableDischarging(const chip::app::DataModel::Nullable<uint32_t> & dischargingEnabledUntil,
-                             const uint64_t & maximumDischargeCurrent) override;
+                             const int64_t & maximumDischargeCurrent) override;
 
     /**
      * @brief    Called when EVSE cluster receives StartDiagnostics command
diff --git a/src/app/clusters/energy-evse-server/energy-evse-server.cpp b/src/app/clusters/energy-evse-server/energy-evse-server.cpp
index 8ba0b9c91136cf..9a3dd08dd242dd 100644
--- a/src/app/clusters/energy-evse-server/energy-evse-server.cpp
+++ b/src/app/clusters/energy-evse-server/energy-evse-server.cpp
@@ -33,19 +33,6 @@ namespace app {
 namespace Clusters {
 namespace EnergyEvse {
 
-Instance::Instance(EndpointId aEndpointId, Delegate & aDelegate) :
-    AttributeAccessInterface(MakeOptional(aEndpointId), Id), CommandHandlerInterface(MakeOptional(aEndpointId), Id),
-    mDelegate(aDelegate), mEndpointId(aEndpointId)
-{
-    /* set the base class delegates endpointId */
-    mDelegate.SetEndpointId(aEndpointId);
-}
-
-Instance::~Instance()
-{
-    Shutdown();
-}
-
 CHIP_ERROR Instance::Init()
 {
     registerAttributeAccessOverride(this);
diff --git a/src/app/clusters/energy-evse-server/energy-evse-server.h b/src/app/clusters/energy-evse-server/energy-evse-server.h
index 1d86d96d1b5c06..1ac7daa72a1837 100644
--- a/src/app/clusters/energy-evse-server/energy-evse-server.h
+++ b/src/app/clusters/energy-evse-server/energy-evse-server.h
@@ -128,8 +128,14 @@ class Delegate
 class Instance : public AttributeAccessInterface, public CommandHandlerInterface
 {
 public:
-    Instance(EndpointId aEndpointId, Delegate & aDelegate);
-    ~Instance();
+    Instance(EndpointId aEndpointId, Delegate & aDelegate) :
+        AttributeAccessInterface(MakeOptional(aEndpointId), Id), CommandHandlerInterface(MakeOptional(aEndpointId), Id),
+        mDelegate(aDelegate), mEndpointId(aEndpointId)
+    {
+        /* set the base class delegates endpointId */
+        mDelegate.SetEndpointId(aEndpointId);
+    }
+    ~Instance() { Shutdown(); }
 
     CHIP_ERROR Init();
     void Shutdown();

From 293cdbf0a8c5d0ffc618eb5ac60643a6af272947 Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Tue, 5 Dec 2023 23:18:50 +0000
Subject: [PATCH 21/80] Removed unused mEndpointId

---
 src/app/clusters/energy-evse-server/energy-evse-server.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/app/clusters/energy-evse-server/energy-evse-server.h b/src/app/clusters/energy-evse-server/energy-evse-server.h
index 1ac7daa72a1837..6422787201e1a6 100644
--- a/src/app/clusters/energy-evse-server/energy-evse-server.h
+++ b/src/app/clusters/energy-evse-server/energy-evse-server.h
@@ -130,7 +130,7 @@ class Instance : public AttributeAccessInterface, public CommandHandlerInterface
 public:
     Instance(EndpointId aEndpointId, Delegate & aDelegate) :
         AttributeAccessInterface(MakeOptional(aEndpointId), Id), CommandHandlerInterface(MakeOptional(aEndpointId), Id),
-        mDelegate(aDelegate), mEndpointId(aEndpointId)
+        mDelegate(aDelegate)
     {
         /* set the base class delegates endpointId */
         mDelegate.SetEndpointId(aEndpointId);
@@ -144,7 +144,6 @@ class Instance : public AttributeAccessInterface, public CommandHandlerInterface
 
 private:
     Delegate & mDelegate;
-    EndpointId mEndpointId;
     BitMask<Feature> mFeature;
 
     // AttributeAccessInterface

From f44f52a93c403773bd9a2139dbf736214ef6dc84 Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Tue, 5 Dec 2023 23:46:54 +0000
Subject: [PATCH 22/80] Add source files to shell standalone BUILD.gn,  More %d
 fixes for different platforms

---
 .../src/EnergyEvseDelegateImpl.cpp                    |  9 ++++++---
 .../src/EnergyEvseDelegateImpl.cpp                    | 11 +++++++----
 examples/shell/shell_common/BUILD.gn                  |  3 +++
 3 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
index 9503388e6d17f0..33bc6a084a97b7 100644
--- a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
+++ b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
@@ -475,7 +475,8 @@ CHIP_ERROR EnergyEvseDelegate::SetChargingEnabledUntil(uint32_t newValue)
     mChargingEnabledUntil = MakeNullable(newValue);
     if ((oldValue.IsNull()) || (oldValue.Value() != newValue))
     {
-        ChipLogDetail(AppServer, "ChargingEnabledUntil updated to %d", mChargingEnabledUntil.Value());
+        ChipLogDetail(AppServer, "ChargingEnabledUntil updated to %lu",
+                      static_cast<unsigned long int>(mChargingEnabledUntil.Value()));
         MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, ChargingEnabledUntil::Id);
     }
     return CHIP_NO_ERROR;
@@ -492,7 +493,8 @@ CHIP_ERROR EnergyEvseDelegate::SetDischargingEnabledUntil(uint32_t newValue)
     mDischargingEnabledUntil = MakeNullable(newValue);
     if ((oldValue.IsNull()) || (oldValue.Value() != newValue))
     {
-        ChipLogDetail(AppServer, "DischargingEnabledUntil updated to %d", mDischargingEnabledUntil.Value());
+        ChipLogDetail(AppServer, "DischargingEnabledUntil updated to %lu",
+                      static_cast<unsigned long int>(mDischargingEnabledUntil.Value()));
         MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, DischargingEnabledUntil::Id);
     }
     return CHIP_NO_ERROR;
@@ -624,7 +626,8 @@ CHIP_ERROR EnergyEvseDelegate::SetRandomizationDelayWindow(uint32_t newValue)
     mRandomizationDelayWindow = newValue;
     if (oldValue != newValue)
     {
-        ChipLogDetail(AppServer, "RandomizationDelayWindow updated to %d", mRandomizationDelayWindow);
+        ChipLogDetail(AppServer, "RandomizationDelayWindow updated to %lu",
+                      static_cast<unsigned long int>(mRandomizationDelayWindow));
         MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, RandomizationDelayWindow::Id);
     }
     return CHIP_NO_ERROR;
diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
index 75532d64370311..33bc6a084a97b7 100644
--- a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
+++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
@@ -114,7 +114,7 @@ Status EnergyEvseDelegate::EnableCharging(const chip::app::DataModel::Nullable<u
     else
     {
         /* check chargingEnabledUntil is in the future */
-        ChipLogError(NotSpecified, "Charging enabled until: %d", chargingEnabledUntil.Value());
+        ChipLogError(NotSpecified, "Charging enabled until: %lu", static_cast<long unsigned int>(chargingEnabledUntil.Value()));
         // TODO
         // if (checkChargingEnabled)
     }
@@ -475,7 +475,8 @@ CHIP_ERROR EnergyEvseDelegate::SetChargingEnabledUntil(uint32_t newValue)
     mChargingEnabledUntil = MakeNullable(newValue);
     if ((oldValue.IsNull()) || (oldValue.Value() != newValue))
     {
-        ChipLogDetail(AppServer, "ChargingEnabledUntil updated to %d", mChargingEnabledUntil.Value());
+        ChipLogDetail(AppServer, "ChargingEnabledUntil updated to %lu",
+                      static_cast<unsigned long int>(mChargingEnabledUntil.Value()));
         MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, ChargingEnabledUntil::Id);
     }
     return CHIP_NO_ERROR;
@@ -492,7 +493,8 @@ CHIP_ERROR EnergyEvseDelegate::SetDischargingEnabledUntil(uint32_t newValue)
     mDischargingEnabledUntil = MakeNullable(newValue);
     if ((oldValue.IsNull()) || (oldValue.Value() != newValue))
     {
-        ChipLogDetail(AppServer, "DischargingEnabledUntil updated to %d", mDischargingEnabledUntil.Value());
+        ChipLogDetail(AppServer, "DischargingEnabledUntil updated to %lu",
+                      static_cast<unsigned long int>(mDischargingEnabledUntil.Value()));
         MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, DischargingEnabledUntil::Id);
     }
     return CHIP_NO_ERROR;
@@ -624,7 +626,8 @@ CHIP_ERROR EnergyEvseDelegate::SetRandomizationDelayWindow(uint32_t newValue)
     mRandomizationDelayWindow = newValue;
     if (oldValue != newValue)
     {
-        ChipLogDetail(AppServer, "RandomizationDelayWindow updated to %d", mRandomizationDelayWindow);
+        ChipLogDetail(AppServer, "RandomizationDelayWindow updated to %lu",
+                      static_cast<unsigned long int>(mRandomizationDelayWindow));
         MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, RandomizationDelayWindow::Id);
     }
     return CHIP_NO_ERROR;
diff --git a/examples/shell/shell_common/BUILD.gn b/examples/shell/shell_common/BUILD.gn
index 2cbc8900f9353a..8b55dcc3b53566 100644
--- a/examples/shell/shell_common/BUILD.gn
+++ b/examples/shell/shell_common/BUILD.gn
@@ -64,6 +64,9 @@ static_library("shell_common") {
     import("${chip_root}/src/app/chip_data_model.gni")
 
     sources += [
+      "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp",
+      "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp",
+      "${chip_root}/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp",
       "${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp",
       "${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp",
       "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp",

From 43b98d479b9b3793de8515baf947e3f4bdaf2f63 Mon Sep 17 00:00:00 2001
From: "Restyled.io" <commits@restyled.io>
Date: Tue, 5 Dec 2023 23:48:53 +0000
Subject: [PATCH 23/80] Restyled by gn

---
 examples/shell/shell_common/BUILD.gn | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/examples/shell/shell_common/BUILD.gn b/examples/shell/shell_common/BUILD.gn
index 8b55dcc3b53566..b870628717d8e5 100644
--- a/examples/shell/shell_common/BUILD.gn
+++ b/examples/shell/shell_common/BUILD.gn
@@ -66,8 +66,8 @@ static_library("shell_common") {
     sources += [
       "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp",
       "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp",
-      "${chip_root}/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp",
       "${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp",
+      "${chip_root}/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp",
       "${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp",
       "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp",
       "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp",

From fc5472409fb37862d501ca8b0e6c4bb5955c1ab2 Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Wed, 6 Dec 2023 00:07:32 +0000
Subject: [PATCH 24/80] Removed unused mMinimumChargingCurrentLimitFromCommand

---
 .../all-clusters-common/include/EnergyEvseDelegateImpl.h         | 1 -
 .../energy-management-common/include/EnergyEvseDelegateImpl.h    | 1 -
 2 files changed, 2 deletions(-)

diff --git a/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h b/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h
index 10ae22ede314bc..8ae0d2fe774d01 100644
--- a/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h
+++ b/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h
@@ -144,7 +144,6 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate
     int64_t mMaxHardwareCurrentLimit                = 0; /* Hardware current limit in mA */
     int64_t mCableAssemblyCurrentLimit              = 0; /* Cable limit detected when cable is plugged in, in mA */
     int64_t mMaximumChargingCurrentLimitFromCommand = 0; /* Value of current maximum limit when charging enabled */
-    int64_t mMinimumChargingCurrentLimitFromCommand = 0; /* Value of current minimum limit when charging enabled */
     int64_t mActualChargingCurrentLimit             = 0;
     StateEnum mHwState                              = StateEnum::kNotPluggedIn; /* Hardware state */
 
diff --git a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h
index 10ae22ede314bc..8ae0d2fe774d01 100644
--- a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h
+++ b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h
@@ -144,7 +144,6 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate
     int64_t mMaxHardwareCurrentLimit                = 0; /* Hardware current limit in mA */
     int64_t mCableAssemblyCurrentLimit              = 0; /* Cable limit detected when cable is plugged in, in mA */
     int64_t mMaximumChargingCurrentLimitFromCommand = 0; /* Value of current maximum limit when charging enabled */
-    int64_t mMinimumChargingCurrentLimitFromCommand = 0; /* Value of current minimum limit when charging enabled */
     int64_t mActualChargingCurrentLimit             = 0;
     StateEnum mHwState                              = StateEnum::kNotPluggedIn; /* Hardware state */
 

From d3752baacd322a78bcffae4d78fc2b0c64afe72f Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Wed, 6 Dec 2023 00:16:34 +0000
Subject: [PATCH 25/80] Removed yet more unused variables

---
 .../all-clusters-common/include/EnergyEvseManager.h           | 4 +---
 .../energy-management-common/include/EnergyEvseManager.h      | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/examples/all-clusters-app/all-clusters-common/include/EnergyEvseManager.h b/examples/all-clusters-app/all-clusters-common/include/EnergyEvseManager.h
index 034da67e7de01d..9e99fa7c08732b 100644
--- a/examples/all-clusters-app/all-clusters-common/include/EnergyEvseManager.h
+++ b/examples/all-clusters-app/all-clusters-common/include/EnergyEvseManager.h
@@ -31,8 +31,7 @@ using namespace chip::app::Clusters::EnergyEvse;
 class EnergyEvseManager : public Instance
 {
 public:
-    EnergyEvseManager(EndpointId aEndpointId, EnergyEvseDelegate & aDelegate) :
-        EnergyEvse::Instance(aEndpointId, aDelegate), mEndpointId(aEndpointId)
+    EnergyEvseManager(EndpointId aEndpointId, EnergyEvseDelegate & aDelegate) : EnergyEvse::Instance(aEndpointId, aDelegate)
     {
         mInstance = this;
         mDelegate = &aDelegate;
@@ -51,7 +50,6 @@ class EnergyEvseManager : public Instance
 
 private:
     EnergyEvse::Instance * mInstance;
-    EndpointId mEndpointId;
     EnergyEvseDelegate * mDelegate;
 };
 
diff --git a/examples/energy-management-app/energy-management-common/include/EnergyEvseManager.h b/examples/energy-management-app/energy-management-common/include/EnergyEvseManager.h
index 034da67e7de01d..9e99fa7c08732b 100644
--- a/examples/energy-management-app/energy-management-common/include/EnergyEvseManager.h
+++ b/examples/energy-management-app/energy-management-common/include/EnergyEvseManager.h
@@ -31,8 +31,7 @@ using namespace chip::app::Clusters::EnergyEvse;
 class EnergyEvseManager : public Instance
 {
 public:
-    EnergyEvseManager(EndpointId aEndpointId, EnergyEvseDelegate & aDelegate) :
-        EnergyEvse::Instance(aEndpointId, aDelegate), mEndpointId(aEndpointId)
+    EnergyEvseManager(EndpointId aEndpointId, EnergyEvseDelegate & aDelegate) : EnergyEvse::Instance(aEndpointId, aDelegate)
     {
         mInstance = this;
         mDelegate = &aDelegate;
@@ -51,7 +50,6 @@ class EnergyEvseManager : public Instance
 
 private:
     EnergyEvse::Instance * mInstance;
-    EndpointId mEndpointId;
     EnergyEvseDelegate * mDelegate;
 };
 

From a14846a9aa48f5f8f8c06603a3ebd97e9c67b636 Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Wed, 6 Dec 2023 07:51:03 +0000
Subject: [PATCH 26/80] Fixed missing semi-colon. How did the other compilers
 not pick this up?

---
 .../all-clusters-common/src/EnergyEvseDelegateImpl.cpp          | 2 +-
 .../energy-management-common/src/EnergyEvseDelegateImpl.cpp     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
index 33bc6a084a97b7..c577275a1d265f 100644
--- a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
+++ b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
@@ -109,7 +109,7 @@ Status EnergyEvseDelegate::EnableCharging(const chip::app::DataModel::Nullable<u
     if (chargingEnabledUntil.IsNull())
     {
         /* Charging enabled indefinitely */
-        ChipLogError(NotSpecified, "Charging enabled indefinitely")
+        ChipLogError(NotSpecified, "Charging enabled indefinitely");
     }
     else
     {
diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
index 33bc6a084a97b7..c577275a1d265f 100644
--- a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
+++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
@@ -109,7 +109,7 @@ Status EnergyEvseDelegate::EnableCharging(const chip::app::DataModel::Nullable<u
     if (chargingEnabledUntil.IsNull())
     {
         /* Charging enabled indefinitely */
-        ChipLogError(NotSpecified, "Charging enabled indefinitely")
+        ChipLogError(NotSpecified, "Charging enabled indefinitely");
     }
     else
     {

From 04a12f745f3a878c483fd2a0c11e9453db17ffec Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Wed, 6 Dec 2023 08:35:06 +0000
Subject: [PATCH 27/80] Capitalise function names

---
 .../include/EnergyEvseDelegateImpl.h                 | 12 ++++++------
 .../src/EnergyEvseDelegateImpl.cpp                   | 12 ++++++------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h b/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h
index 8ae0d2fe774d01..e1494c907f8a84 100644
--- a/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h
+++ b/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h
@@ -68,12 +68,12 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate
 
     // -----------------------------------------------------------------
     // Internal API to allow an EVSE to change its internal state etc
-    // TODO Status hwRegisterEvseHardwareCallback(Callback);
-    Status hwSetMaxHardwareCurrentLimit(int64_t currentmA);
-    Status hwSetCircuitCapacity(int64_t currentmA);
-    Status hwSetCableAssemblyLimit(int64_t currentmA);
-    Status hwSetState(StateEnum state);
-    Status hwSetFault(FaultStateEnum fault);
+    // TODO Status HwRegisterEvseHardwareCallback(Callback);
+    Status HwSetMaxHardwareCurrentLimit(int64_t currentmA);
+    Status HwSetCircuitCapacity(int64_t currentmA);
+    Status HwSetCableAssemblyLimit(int64_t currentmA);
+    Status HwSetState(StateEnum state);
+    Status HwSetFault(FaultStateEnum fault);
 
     // ------------------------------------------------------------------
     // Get attribute methods
diff --git a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
index c577275a1d265f..87c1eb37ce35e2 100644
--- a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
+++ b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
@@ -211,7 +211,7 @@ Status EnergyEvseDelegate::StartDiagnostics()
  * @param    Callback function
  */
 #if 0
-Status EnergyEvseDelegate::hwRegisterEvseHardwareCallback(int Callback) // TODO
+Status EnergyEvseDelegate::HwRegisterEvseHardwareCallback(int Callback) // TODO
 {
     // TODO
     return CHIP_NO_ERROR;
@@ -225,7 +225,7 @@ Status EnergyEvseDelegate::hwRegisterEvseHardwareCallback(int Callback) // TODO
  *
  * @param    currentmA
  */
-Status EnergyEvseDelegate::hwSetMaxHardwareCurrentLimit(int64_t currentmA)
+Status EnergyEvseDelegate::HwSetMaxHardwareCurrentLimit(int64_t currentmA)
 {
     if (currentmA < MAX_CURRENT_LOWER_BOUND || currentmA > MAX_CURRENT_UPPER_BOUND)
     {
@@ -247,7 +247,7 @@ Status EnergyEvseDelegate::hwSetMaxHardwareCurrentLimit(int64_t currentmA)
  *
  * @param    currentmA
  */
-Status EnergyEvseDelegate::hwSetCircuitCapacity(int64_t currentmA)
+Status EnergyEvseDelegate::HwSetCircuitCapacity(int64_t currentmA)
 {
     if (currentmA < MAX_CURRENT_LOWER_BOUND || currentmA > MAX_CURRENT_UPPER_BOUND)
     {
@@ -272,7 +272,7 @@ Status EnergyEvseDelegate::hwSetCircuitCapacity(int64_t currentmA)
  *
  * @param    currentmA
  */
-Status EnergyEvseDelegate::hwSetCableAssemblyLimit(int64_t currentmA)
+Status EnergyEvseDelegate::HwSetCableAssemblyLimit(int64_t currentmA)
 {
     if (currentmA < MAX_CURRENT_LOWER_BOUND || currentmA > MAX_CURRENT_UPPER_BOUND)
     {
@@ -290,7 +290,7 @@ Status EnergyEvseDelegate::hwSetCableAssemblyLimit(int64_t currentmA)
  *
  * @param    StateEnum
  */
-Status EnergyEvseDelegate::hwSetState(StateEnum state)
+Status EnergyEvseDelegate::HwSetState(StateEnum state)
 {
     /* the only allowed states that the EVSE hardware can set are:
      *  kNotPluggedIn
@@ -326,7 +326,7 @@ Status EnergyEvseDelegate::hwSetState(StateEnum state)
  *
  * @param    FaultStateEnum
  */
-Status EnergyEvseDelegate::hwSetFault(FaultStateEnum fault)
+Status EnergyEvseDelegate::HwSetFault(FaultStateEnum fault)
 {
     ChipLogProgress(AppServer, "EnergyEvseDelegate::Fault()");
 

From 49acb7fc6682c80059c5e8d1afa3bc7ce8ddc1d7 Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Wed, 6 Dec 2023 08:58:53 +0000
Subject: [PATCH 28/80] PR comment - Moved PluginServerInitCallback to sdk.
 Capitalised more function names in energy-management-app.

---
 .../all-clusters-common/src/EnergyEvseManager.cpp    |  2 --
 .../include/EnergyEvseDelegateImpl.h                 | 12 ++++++------
 .../src/EVSEManufacturerImpl.cpp                     |  8 ++++----
 .../src/EnergyEvseDelegateImpl.cpp                   | 12 ++++++------
 .../src/EnergyEvseManager.cpp                        |  2 --
 .../energy-evse-server/energy-evse-server.cpp        |  5 +++++
 6 files changed, 21 insertions(+), 20 deletions(-)

diff --git a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp
index d9eb5ce0a7ac7d..5f8fcaa61dcb6a 100644
--- a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp
+++ b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp
@@ -32,5 +32,3 @@ void EnergyEvseManager::Shutdown()
 {
     GetInstance()->Instance::Shutdown();
 }
-
-void MatterEnergyEvsePluginServerInitCallback() {}
diff --git a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h
index 8ae0d2fe774d01..e1494c907f8a84 100644
--- a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h
+++ b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h
@@ -68,12 +68,12 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate
 
     // -----------------------------------------------------------------
     // Internal API to allow an EVSE to change its internal state etc
-    // TODO Status hwRegisterEvseHardwareCallback(Callback);
-    Status hwSetMaxHardwareCurrentLimit(int64_t currentmA);
-    Status hwSetCircuitCapacity(int64_t currentmA);
-    Status hwSetCableAssemblyLimit(int64_t currentmA);
-    Status hwSetState(StateEnum state);
-    Status hwSetFault(FaultStateEnum fault);
+    // TODO Status HwRegisterEvseHardwareCallback(Callback);
+    Status HwSetMaxHardwareCurrentLimit(int64_t currentmA);
+    Status HwSetCircuitCapacity(int64_t currentmA);
+    Status HwSetCableAssemblyLimit(int64_t currentmA);
+    Status HwSetState(StateEnum state);
+    Status HwSetFault(FaultStateEnum fault);
 
     // ------------------------------------------------------------------
     // Get attribute methods
diff --git a/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp b/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp
index 68c7c31541bff3..55dfece7312060 100644
--- a/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp
+++ b/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp
@@ -32,14 +32,14 @@ CHIP_ERROR EVSEManufacturer::Init(EnergyEvseManager * aInstance)
 
     /* Set the EVSE Hardware Maximum current limit */
     // For Manufacturer to specify the hardware capability in mA
-    aInstance->GetDelegate()->hwSetMaxHardwareCurrentLimit(32000);
+    aInstance->GetDelegate()->HwSetMaxHardwareCurrentLimit(32000);
 
     // For Manufacturer to specify the CircuitCapacity (e.g. from DIP switches)
-    aInstance->GetDelegate()->hwSetCircuitCapacity(20000);
+    aInstance->GetDelegate()->HwSetCircuitCapacity(20000);
 
     /* For now let's pretend the EV is plugged in, and asking for demand */
-    aInstance->GetDelegate()->hwSetState(StateEnum::kPluggedInDemand);
-    aInstance->GetDelegate()->hwSetCableAssemblyLimit(63000);
+    aInstance->GetDelegate()->HwSetState(StateEnum::kPluggedInDemand);
+    aInstance->GetDelegate()->HwSetCableAssemblyLimit(63000);
 
     return CHIP_NO_ERROR;
 }
diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
index c577275a1d265f..87c1eb37ce35e2 100644
--- a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
+++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
@@ -211,7 +211,7 @@ Status EnergyEvseDelegate::StartDiagnostics()
  * @param    Callback function
  */
 #if 0
-Status EnergyEvseDelegate::hwRegisterEvseHardwareCallback(int Callback) // TODO
+Status EnergyEvseDelegate::HwRegisterEvseHardwareCallback(int Callback) // TODO
 {
     // TODO
     return CHIP_NO_ERROR;
@@ -225,7 +225,7 @@ Status EnergyEvseDelegate::hwRegisterEvseHardwareCallback(int Callback) // TODO
  *
  * @param    currentmA
  */
-Status EnergyEvseDelegate::hwSetMaxHardwareCurrentLimit(int64_t currentmA)
+Status EnergyEvseDelegate::HwSetMaxHardwareCurrentLimit(int64_t currentmA)
 {
     if (currentmA < MAX_CURRENT_LOWER_BOUND || currentmA > MAX_CURRENT_UPPER_BOUND)
     {
@@ -247,7 +247,7 @@ Status EnergyEvseDelegate::hwSetMaxHardwareCurrentLimit(int64_t currentmA)
  *
  * @param    currentmA
  */
-Status EnergyEvseDelegate::hwSetCircuitCapacity(int64_t currentmA)
+Status EnergyEvseDelegate::HwSetCircuitCapacity(int64_t currentmA)
 {
     if (currentmA < MAX_CURRENT_LOWER_BOUND || currentmA > MAX_CURRENT_UPPER_BOUND)
     {
@@ -272,7 +272,7 @@ Status EnergyEvseDelegate::hwSetCircuitCapacity(int64_t currentmA)
  *
  * @param    currentmA
  */
-Status EnergyEvseDelegate::hwSetCableAssemblyLimit(int64_t currentmA)
+Status EnergyEvseDelegate::HwSetCableAssemblyLimit(int64_t currentmA)
 {
     if (currentmA < MAX_CURRENT_LOWER_BOUND || currentmA > MAX_CURRENT_UPPER_BOUND)
     {
@@ -290,7 +290,7 @@ Status EnergyEvseDelegate::hwSetCableAssemblyLimit(int64_t currentmA)
  *
  * @param    StateEnum
  */
-Status EnergyEvseDelegate::hwSetState(StateEnum state)
+Status EnergyEvseDelegate::HwSetState(StateEnum state)
 {
     /* the only allowed states that the EVSE hardware can set are:
      *  kNotPluggedIn
@@ -326,7 +326,7 @@ Status EnergyEvseDelegate::hwSetState(StateEnum state)
  *
  * @param    FaultStateEnum
  */
-Status EnergyEvseDelegate::hwSetFault(FaultStateEnum fault)
+Status EnergyEvseDelegate::HwSetFault(FaultStateEnum fault)
 {
     ChipLogProgress(AppServer, "EnergyEvseDelegate::Fault()");
 
diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp
index d9eb5ce0a7ac7d..5f8fcaa61dcb6a 100644
--- a/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp
+++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp
@@ -32,5 +32,3 @@ void EnergyEvseManager::Shutdown()
 {
     GetInstance()->Instance::Shutdown();
 }
-
-void MatterEnergyEvsePluginServerInitCallback() {}
diff --git a/src/app/clusters/energy-evse-server/energy-evse-server.cpp b/src/app/clusters/energy-evse-server/energy-evse-server.cpp
index 9a3dd08dd242dd..b0036487a2e054 100644
--- a/src/app/clusters/energy-evse-server/energy-evse-server.cpp
+++ b/src/app/clusters/energy-evse-server/energy-evse-server.cpp
@@ -315,3 +315,8 @@ void Instance::HandleClearTargets(HandlerContext & ctx, const Commands::ClearTar
 } // namespace Clusters
 } // namespace app
 } // namespace chip
+
+// -----------------------------------------------------------------------------
+// Plugin initialization
+
+void MatterEnergyEvsePluginServerInitCallback() {}
\ No newline at end of file

From a2240c5cca49f95e0249ff33e1b5f74a18efeaa7 Mon Sep 17 00:00:00 2001
From: "Restyled.io" <commits@restyled.io>
Date: Wed, 6 Dec 2023 08:59:23 +0000
Subject: [PATCH 29/80] Restyled by whitespace

---
 src/app/clusters/energy-evse-server/energy-evse-server.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/app/clusters/energy-evse-server/energy-evse-server.cpp b/src/app/clusters/energy-evse-server/energy-evse-server.cpp
index b0036487a2e054..6b2fd1977f7875 100644
--- a/src/app/clusters/energy-evse-server/energy-evse-server.cpp
+++ b/src/app/clusters/energy-evse-server/energy-evse-server.cpp
@@ -319,4 +319,4 @@ void Instance::HandleClearTargets(HandlerContext & ctx, const Commands::ClearTar
 // -----------------------------------------------------------------------------
 // Plugin initialization
 
-void MatterEnergyEvsePluginServerInitCallback() {}
\ No newline at end of file
+void MatterEnergyEvsePluginServerInitCallback() {}

From ee824c02d41bd2859402e277f3197b868e52f40d Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Wed, 6 Dec 2023 12:28:55 +0000
Subject: [PATCH 30/80] Fixes #30805 Updated energy-evse-cluster.xml

---
 .../data-model/chip/energy-evse-cluster.xml   | 20 +++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml
index 83f44e37f1eaf4..70cbb5bdfa8c58 100644
--- a/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml
+++ b/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml
@@ -69,7 +69,7 @@ limitations under the License.
   </bitmap>
   <struct name="ChargingTargetStruct" apiMaturity="provisional">
     <cluster code="0x0099"/>
-    <item fieldId="0" name="TargetTime" type="int16u" min="0" max="1439"/>
+    <item fieldId="0" name="TargetTimeMinutesPastMidnight" type="int16u" min="0" max="1439"/>
     <item fieldId="1" name="TargetSoC" type="percent" optional="true"/>
     <item fieldId="2" name="AddedEnergy" type="energy_mwh" min="0" optional="true"/>
   </struct>
@@ -130,11 +130,11 @@ limitations under the License.
     <attribute code="0x0031" side="server" type="energy_mwh" define="BATTERY_CAPACITY" isNullable="true" min="0" writable="false" optional="true">BatteryCapacity</attribute>
     <!--Conformance feature PNC - for now optional-->
     <attribute code="0x0032" side="server" type="char_string" define="VEHICLE_ID" isNullable="true" length="32" writable="false" optional="true">VehicleID</attribute>
-    <attribute code="0x0040" side="server" type="int32u" define="SESSION_ID" isNullable="true" default="0" min="1" max="0xFFFFFFFF" writable="false" optional="false">SessionID</attribute>
-    <attribute code="0x0041" side="server" type="elapsed_s" define="SESSION_DURATION" default="0" writable="false" optional="false">SessionDuration</attribute>
-    <attribute code="0x0042" side="server" type="energy_mwh" define="SESSION_ENERGY_CHARGED" default="0" min="0" writable="false" optional="false">SessionEnergyCharged</attribute>
+    <attribute code="0x0040" side="server" type="int32u" define="SESSION_ID" isNullable="true" writable="false" optional="false">SessionID</attribute>
+    <attribute code="0x0041" side="server" type="elapsed_s" define="SESSION_DURATION" isNullable="true" writable="false" optional="false">SessionDuration</attribute>
+    <attribute code="0x0042" side="server" type="energy_mwh" define="SESSION_ENERGY_CHARGED" isNullable="true" min="0" writable="false" optional="false">SessionEnergyCharged</attribute>
     <!--Conformance feature V2X - for now optional-->
-    <attribute code="0x0043" side="server" type="energy_mwh" define="SESSION_ENERGY_DISCHARGED" default="0" min="0" writable="false" optional="true">SessionEnergyDischarged</attribute>
+    <attribute code="0x0043" side="server" type="energy_mwh" define="SESSION_ENERGY_DISCHARGED" isNullable="true" min="0" writable="false" optional="true">SessionEnergyDischarged</attribute>
     <command source="client" code="0x0001" name="Disable" optional="false" mustUseTimedInvoke="true" apiMaturity="provisional">
       <description>Allows a client to disable the EVSE from charging and discharging.</description>
     </command>
@@ -171,11 +171,11 @@ limitations under the License.
     </command>
     <event code="0x0000" name="EVConnected" priority="info" apiMaturity="provisional">
       <description>EVConnected</description>
-      <field id="0" name="SessionID" type="int32u" min="1" max="0xFFFFFFFF" apiMaturity="provisional"/>
+      <field id="0" name="SessionID" type="int32u" apiMaturity="provisional"/>
     </event>
     <event code="0x0001" name="EVNotDetected" priority="info" apiMaturity="provisional">
       <description>EVNotDetected</description>
-      <field id="0" name="SessionID" type="int32u" min="1" max="0xFFFFFFFF" apiMaturity="provisional"/>
+      <field id="0" name="SessionID" type="int32u" apiMaturity="provisional"/>
       <field id="1" name="State" type="StateEnum" apiMaturity="provisional"/>
       <field id="2" name="SessionDuration" type="elapsed_s" apiMaturity="provisional"/>
       <field id="3" name="SessionEnergyCharged" type="energy_mwh" min="0" apiMaturity="provisional"/>
@@ -183,20 +183,20 @@ limitations under the License.
     </event>
     <event code="0x0002" name="EnergyTransferStarted" priority="info" apiMaturity="provisional">
       <description>EnergyTransferStarted</description>
-      <field id="0" name="SessionID" type="int32u" min="1" max="0xFFFFFFFF" apiMaturity="provisional"/>
+      <field id="0" name="SessionID" type="int32u" apiMaturity="provisional"/>
       <field id="1" name="State" type="StateEnum" apiMaturity="provisional"/>
       <field id="2" name="MaximumCurrent" type="amperage_ma" min="0" max="80000" apiMaturity="provisional"/>
     </event>
     <event code="0x0003" name="EnergyTransferStopped" priority="info" apiMaturity="provisional">
       <description>EnergyTransferStopped</description>
-      <field id="0" name="SessionID" type="int32u" min="1" max="0xFFFFFFFF" apiMaturity="provisional"/>
+      <field id="0" name="SessionID" type="int32u" apiMaturity="provisional"/>
       <field id="1" name="State" type="StateEnum" apiMaturity="provisional"/>
       <field id="2" name="Reason" type="EnergyTransferStoppedReasonEnum" apiMaturity="provisional"/>
       <field id="4" name="EnergyTransferred" type="energy_mwh" min="0" apiMaturity="provisional"/>
     </event>
     <event code="0x0004" name="Fault" priority="critical" apiMaturity="provisional">
       <description>Fault</description>
-      <field id="0" name="SessionID" type="int32u" min="1" max="0xFFFFFFFF" apiMaturity="provisional"/>
+      <field id="0" name="SessionID" type="int32u" apiMaturity="provisional"/>
       <field id="1" name="State" type="StateEnum" apiMaturity="provisional"/>
       <field id="2" name="FaultStatePreviousState" type="FaultStateEnum" apiMaturity="provisional"/>
       <field id="4" name="FaultStateCurrentState" type="FaultStateEnum" apiMaturity="provisional"/>

From 2947b9b32e021748c076519ae55c6d4742a80e10 Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Wed, 6 Dec 2023 12:56:42 +0000
Subject: [PATCH 31/80] Fixes #30805 zap_regen_all commit.

---
 .../all-clusters-app.matter                   |   8 +-
 .../energy-management-app.matter              |   8 +-
 .../data_model/controller-clusters.matter     |   8 +-
 .../data_model/controller-clusters.zap        |  12 +-
 .../chip/devicecontroller/ChipClusters.java   |  36 ++--
 .../chip/devicecontroller/ChipStructs.java    |  22 +-
 .../devicecontroller/ClusterInfoMapping.java  |  63 ++++++
 .../devicecontroller/ClusterReadMapping.java  |  12 +-
 .../EnergyEvseClusterChargingTargetStruct.kt  |  17 +-
 .../cluster/clusters/EnergyEvseCluster.kt     |  27 ++-
 .../EnergyEvseClusterChargingTargetStruct.kt  |  17 +-
 .../CHIPAttributeTLVValueDecoder.cpp          |  51 +++--
 .../zap-generated/CHIPInvokeCallbacks.cpp     |  19 +-
 .../java/zap-generated/CHIPReadCallbacks.cpp  | 202 ++++++++++++++++++
 .../python/chip/clusters/Objects.py           |  28 +--
 .../MTRAttributeTLVValueDecoder.mm            |  24 ++-
 .../zap-generated/MTRCommandPayloadsObjc.mm   |   4 +-
 .../CHIP/zap-generated/MTRStructsObjc.h       |   2 +-
 .../CHIP/zap-generated/MTRStructsObjc.mm      |   6 +-
 .../zap-generated/attributes/Accessors.cpp    |  96 +++++++--
 .../zap-generated/attributes/Accessors.h      |  12 +-
 .../zap-generated/cluster-objects.cpp         |   6 +-
 .../zap-generated/cluster-objects.h           |  32 +--
 .../zap-generated/cluster/Commands.h          |  16 +-
 .../cluster/ComplexArgumentParser.cpp         |  14 +-
 .../cluster/logging/DataModelLogger.cpp       |  10 +-
 .../zap-generated/cluster/Commands.h          |   2 +-
 27 files changed, 583 insertions(+), 171 deletions(-)

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 3f9f4287a39d05..6360f50ad618c8 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
@@ -3703,7 +3703,7 @@ provisional cluster EnergyEvse = 153 {
   }
 
   struct ChargingTargetStruct {
-    int16u targetTime = 0;
+    int16u targetTimeMinutesPastMidnight = 0;
     optional percent targetSoC = 1;
     optional energy_mwh addedEnergy = 2;
   }
@@ -3766,9 +3766,9 @@ provisional cluster EnergyEvse = 153 {
   readonly attribute optional nullable energy_mwh batteryCapacity = 49;
   readonly attribute optional nullable char_string<32> vehicleID = 50;
   readonly attribute nullable int32u sessionID = 64;
-  readonly attribute elapsed_s sessionDuration = 65;
-  readonly attribute energy_mwh sessionEnergyCharged = 66;
-  readonly attribute optional energy_mwh sessionEnergyDischarged = 67;
+  readonly attribute nullable elapsed_s sessionDuration = 65;
+  readonly attribute nullable energy_mwh sessionEnergyCharged = 66;
+  readonly attribute optional nullable energy_mwh sessionEnergyDischarged = 67;
   readonly attribute command_id generatedCommandList[] = 65528;
   readonly attribute command_id acceptedCommandList[] = 65529;
   readonly attribute event_id eventList[] = 65530;
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 a29bb693e4f5cf..f3f8c720f8edf7 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
@@ -1026,7 +1026,7 @@ provisional cluster EnergyEvse = 153 {
   }
 
   struct ChargingTargetStruct {
-    int16u targetTime = 0;
+    int16u targetTimeMinutesPastMidnight = 0;
     optional percent targetSoC = 1;
     optional energy_mwh addedEnergy = 2;
   }
@@ -1089,9 +1089,9 @@ provisional cluster EnergyEvse = 153 {
   readonly attribute optional nullable energy_mwh batteryCapacity = 49;
   readonly attribute optional nullable char_string<32> vehicleID = 50;
   readonly attribute nullable int32u sessionID = 64;
-  readonly attribute elapsed_s sessionDuration = 65;
-  readonly attribute energy_mwh sessionEnergyCharged = 66;
-  readonly attribute optional energy_mwh sessionEnergyDischarged = 67;
+  readonly attribute nullable elapsed_s sessionDuration = 65;
+  readonly attribute nullable energy_mwh sessionEnergyCharged = 66;
+  readonly attribute optional nullable energy_mwh sessionEnergyDischarged = 67;
   readonly attribute command_id generatedCommandList[] = 65528;
   readonly attribute command_id acceptedCommandList[] = 65529;
   readonly attribute event_id eventList[] = 65530;
diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter
index 4d699edccf49ca..d293f47c4d0760 100644
--- a/src/controller/data_model/controller-clusters.matter
+++ b/src/controller/data_model/controller-clusters.matter
@@ -4368,7 +4368,7 @@ provisional cluster EnergyEvse = 153 {
   }
 
   struct ChargingTargetStruct {
-    int16u targetTime = 0;
+    int16u targetTimeMinutesPastMidnight = 0;
     optional percent targetSoC = 1;
     optional energy_mwh addedEnergy = 2;
   }
@@ -4431,9 +4431,9 @@ provisional cluster EnergyEvse = 153 {
   readonly attribute optional nullable energy_mwh batteryCapacity = 49;
   readonly attribute optional nullable char_string<32> vehicleID = 50;
   readonly attribute nullable int32u sessionID = 64;
-  readonly attribute elapsed_s sessionDuration = 65;
-  readonly attribute energy_mwh sessionEnergyCharged = 66;
-  readonly attribute optional energy_mwh sessionEnergyDischarged = 67;
+  readonly attribute nullable elapsed_s sessionDuration = 65;
+  readonly attribute nullable energy_mwh sessionEnergyCharged = 66;
+  readonly attribute optional nullable energy_mwh sessionEnergyDischarged = 67;
   readonly attribute command_id generatedCommandList[] = 65528;
   readonly attribute command_id acceptedCommandList[] = 65529;
   readonly attribute event_id eventList[] = 65530;
diff --git a/src/controller/data_model/controller-clusters.zap b/src/controller/data_model/controller-clusters.zap
index 34eed703bb2519..9bb8be22fae1a2 100644
--- a/src/controller/data_model/controller-clusters.zap
+++ b/src/controller/data_model/controller-clusters.zap
@@ -17,12 +17,6 @@
     }
   ],
   "package": [
-    {
-      "pathRelativity": "relativeToZap",
-      "path": "../../app/zap-templates/app-templates.json",
-      "type": "gen-templates-json",
-      "version": "chip-v1"
-    },
     {
       "pathRelativity": "relativeToZap",
       "path": "../../app/zap-templates/zcl/zcl.json",
@@ -30,6 +24,12 @@
       "category": "matter",
       "version": 1,
       "description": "Matter SDK ZCL data"
+    },
+    {
+      "pathRelativity": "relativeToZap",
+      "path": "../../app/zap-templates/app-templates.json",
+      "type": "gen-templates-json",
+      "version": "chip-v1"
     }
   ],
   "endpointTypes": [
diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java
index 9d5ffd3f8f4885..de860e7b0caee3 100644
--- a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java
+++ b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java
@@ -29073,6 +29073,18 @@ public interface SessionIDAttributeCallback extends BaseAttributeCallback {
       void onSuccess(@Nullable Long value);
     }
 
+    public interface SessionDurationAttributeCallback extends BaseAttributeCallback {
+      void onSuccess(@Nullable Long value);
+    }
+
+    public interface SessionEnergyChargedAttributeCallback extends BaseAttributeCallback {
+      void onSuccess(@Nullable Long value);
+    }
+
+    public interface SessionEnergyDischargedAttributeCallback extends BaseAttributeCallback {
+      void onSuccess(@Nullable Long value);
+    }
+
     public interface GeneratedCommandListAttributeCallback extends BaseAttributeCallback {
       void onSuccess(List<Long> value);
     }
@@ -29667,76 +29679,76 @@ public void onSuccess(byte[] tlv) {
     }
 
     public void readSessionDurationAttribute(
-        LongAttributeCallback callback) {
+        SessionDurationAttributeCallback callback) {
       ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SESSION_DURATION_ATTRIBUTE_ID);
 
       readAttribute(new ReportCallbackImpl(callback, path) {
           @Override
           public void onSuccess(byte[] tlv) {
-            Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+            @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
             callback.onSuccess(value);
           }
         }, SESSION_DURATION_ATTRIBUTE_ID, true);
     }
 
     public void subscribeSessionDurationAttribute(
-        LongAttributeCallback callback, int minInterval, int maxInterval) {
+        SessionDurationAttributeCallback callback, int minInterval, int maxInterval) {
       ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SESSION_DURATION_ATTRIBUTE_ID);
 
       subscribeAttribute(new ReportCallbackImpl(callback, path) {
           @Override
           public void onSuccess(byte[] tlv) {
-            Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+            @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
           }
         }, SESSION_DURATION_ATTRIBUTE_ID, minInterval, maxInterval);
     }
 
     public void readSessionEnergyChargedAttribute(
-        LongAttributeCallback callback) {
+        SessionEnergyChargedAttributeCallback callback) {
       ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SESSION_ENERGY_CHARGED_ATTRIBUTE_ID);
 
       readAttribute(new ReportCallbackImpl(callback, path) {
           @Override
           public void onSuccess(byte[] tlv) {
-            Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+            @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
             callback.onSuccess(value);
           }
         }, SESSION_ENERGY_CHARGED_ATTRIBUTE_ID, true);
     }
 
     public void subscribeSessionEnergyChargedAttribute(
-        LongAttributeCallback callback, int minInterval, int maxInterval) {
+        SessionEnergyChargedAttributeCallback callback, int minInterval, int maxInterval) {
       ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SESSION_ENERGY_CHARGED_ATTRIBUTE_ID);
 
       subscribeAttribute(new ReportCallbackImpl(callback, path) {
           @Override
           public void onSuccess(byte[] tlv) {
-            Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+            @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
           }
         }, SESSION_ENERGY_CHARGED_ATTRIBUTE_ID, minInterval, maxInterval);
     }
 
     public void readSessionEnergyDischargedAttribute(
-        LongAttributeCallback callback) {
+        SessionEnergyDischargedAttributeCallback callback) {
       ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SESSION_ENERGY_DISCHARGED_ATTRIBUTE_ID);
 
       readAttribute(new ReportCallbackImpl(callback, path) {
           @Override
           public void onSuccess(byte[] tlv) {
-            Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+            @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
             callback.onSuccess(value);
           }
         }, SESSION_ENERGY_DISCHARGED_ATTRIBUTE_ID, true);
     }
 
     public void subscribeSessionEnergyDischargedAttribute(
-        LongAttributeCallback callback, int minInterval, int maxInterval) {
+        SessionEnergyDischargedAttributeCallback callback, int minInterval, int maxInterval) {
       ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SESSION_ENERGY_DISCHARGED_ATTRIBUTE_ID);
 
       subscribeAttribute(new ReportCallbackImpl(callback, path) {
           @Override
           public void onSuccess(byte[] tlv) {
-            Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+            @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
           }
         }, SESSION_ENERGY_DISCHARGED_ATTRIBUTE_ID, minInterval, maxInterval);
     }
diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java
index f6c63ca6a40163..9e1aa48995ef6f 100644
--- a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java
+++ b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java
@@ -6097,26 +6097,26 @@ public String toString() {
   }
 }
 public static class EnergyEvseClusterChargingTargetStruct {
-  public Integer targetTime;
+  public Integer targetTimeMinutesPastMidnight;
   public Optional<Integer> targetSoC;
   public Optional<Long> addedEnergy;
-  private static final long TARGET_TIME_ID = 0L;
+  private static final long TARGET_TIME_MINUTES_PAST_MIDNIGHT_ID = 0L;
   private static final long TARGET_SO_C_ID = 1L;
   private static final long ADDED_ENERGY_ID = 2L;
 
   public EnergyEvseClusterChargingTargetStruct(
-    Integer targetTime,
+    Integer targetTimeMinutesPastMidnight,
     Optional<Integer> targetSoC,
     Optional<Long> addedEnergy
   ) {
-    this.targetTime = targetTime;
+    this.targetTimeMinutesPastMidnight = targetTimeMinutesPastMidnight;
     this.targetSoC = targetSoC;
     this.addedEnergy = addedEnergy;
   }
 
   public StructType encodeTlv() {
     ArrayList<StructElement> values = new ArrayList<>();
-    values.add(new StructElement(TARGET_TIME_ID, new UIntType(targetTime)));
+    values.add(new StructElement(TARGET_TIME_MINUTES_PAST_MIDNIGHT_ID, new UIntType(targetTimeMinutesPastMidnight)));
     values.add(new StructElement(TARGET_SO_C_ID, targetSoC.<BaseTLVType>map((nonOptionaltargetSoC) -> new UIntType(nonOptionaltargetSoC)).orElse(new EmptyType())));
     values.add(new StructElement(ADDED_ENERGY_ID, addedEnergy.<BaseTLVType>map((nonOptionaladdedEnergy) -> new IntType(nonOptionaladdedEnergy)).orElse(new EmptyType())));
 
@@ -6127,14 +6127,14 @@ public static EnergyEvseClusterChargingTargetStruct decodeTlv(BaseTLVType tlvVal
     if (tlvValue == null || tlvValue.type() != TLVType.Struct) {
       return null;
     }
-    Integer targetTime = null;
+    Integer targetTimeMinutesPastMidnight = null;
     Optional<Integer> targetSoC = Optional.empty();
     Optional<Long> addedEnergy = Optional.empty();
     for (StructElement element: ((StructType)tlvValue).value()) {
-      if (element.contextTagNum() == TARGET_TIME_ID) {
+      if (element.contextTagNum() == TARGET_TIME_MINUTES_PAST_MIDNIGHT_ID) {
         if (element.value(BaseTLVType.class).type() == TLVType.UInt) {
           UIntType castingValue = element.value(UIntType.class);
-          targetTime = castingValue.value(Integer.class);
+          targetTimeMinutesPastMidnight = castingValue.value(Integer.class);
         }
       } else if (element.contextTagNum() == TARGET_SO_C_ID) {
         if (element.value(BaseTLVType.class).type() == TLVType.UInt) {
@@ -6149,7 +6149,7 @@ public static EnergyEvseClusterChargingTargetStruct decodeTlv(BaseTLVType tlvVal
       }
     }
     return new EnergyEvseClusterChargingTargetStruct(
-      targetTime,
+      targetTimeMinutesPastMidnight,
       targetSoC,
       addedEnergy
     );
@@ -6159,8 +6159,8 @@ public static EnergyEvseClusterChargingTargetStruct decodeTlv(BaseTLVType tlvVal
   public String toString() {
     StringBuilder output = new StringBuilder();
     output.append("EnergyEvseClusterChargingTargetStruct {\n");
-    output.append("\ttargetTime: ");
-    output.append(targetTime);
+    output.append("\ttargetTimeMinutesPastMidnight: ");
+    output.append(targetTimeMinutesPastMidnight);
     output.append("\n");
     output.append("\ttargetSoC: ");
     output.append(targetSoC);
diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java
index eb4616451405ab..a05e4cb3cff239 100644
--- a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java
+++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java
@@ -10432,6 +10432,69 @@ public void onError(Exception ex) {
     }
   }
 
+  public static class DelegatedEnergyEvseClusterSessionDurationAttributeCallback implements ChipClusters.EnergyEvseCluster.SessionDurationAttributeCallback, DelegatedClusterCallback {
+    private ClusterCommandCallback callback;
+    @Override
+    public void setCallbackDelegate(ClusterCommandCallback callback) {
+      this.callback = callback;
+    }
+
+    @Override
+    public void onSuccess(@Nullable Long value) {
+      Map<CommandResponseInfo, Object> responseValues = new LinkedHashMap<>();
+      CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "Long");
+      responseValues.put(commandResponseInfo, value);
+      callback.onSuccess(responseValues);
+    }
+
+    @Override
+    public void onError(Exception ex) {
+      callback.onFailure(ex);
+    }
+  }
+
+  public static class DelegatedEnergyEvseClusterSessionEnergyChargedAttributeCallback implements ChipClusters.EnergyEvseCluster.SessionEnergyChargedAttributeCallback, DelegatedClusterCallback {
+    private ClusterCommandCallback callback;
+    @Override
+    public void setCallbackDelegate(ClusterCommandCallback callback) {
+      this.callback = callback;
+    }
+
+    @Override
+    public void onSuccess(@Nullable Long value) {
+      Map<CommandResponseInfo, Object> responseValues = new LinkedHashMap<>();
+      CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "Long");
+      responseValues.put(commandResponseInfo, value);
+      callback.onSuccess(responseValues);
+    }
+
+    @Override
+    public void onError(Exception ex) {
+      callback.onFailure(ex);
+    }
+  }
+
+  public static class DelegatedEnergyEvseClusterSessionEnergyDischargedAttributeCallback implements ChipClusters.EnergyEvseCluster.SessionEnergyDischargedAttributeCallback, DelegatedClusterCallback {
+    private ClusterCommandCallback callback;
+    @Override
+    public void setCallbackDelegate(ClusterCommandCallback callback) {
+      this.callback = callback;
+    }
+
+    @Override
+    public void onSuccess(@Nullable Long value) {
+      Map<CommandResponseInfo, Object> responseValues = new LinkedHashMap<>();
+      CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "Long");
+      responseValues.put(commandResponseInfo, value);
+      callback.onSuccess(responseValues);
+    }
+
+    @Override
+    public void onError(Exception ex) {
+      callback.onFailure(ex);
+    }
+  }
+
   public static class DelegatedEnergyEvseClusterGeneratedCommandListAttributeCallback implements ChipClusters.EnergyEvseCluster.GeneratedCommandListAttributeCallback, DelegatedClusterCallback {
     private ClusterCommandCallback callback;
     @Override
diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java
index 1cdbced7a386ac..38281939790845 100644
--- a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java
+++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java
@@ -9336,10 +9336,10 @@ private static Map<String, InteractionInfo> readEnergyEvseInteractionInfo() {
         InteractionInfo readEnergyEvseSessionDurationAttributeInteractionInfo = new InteractionInfo(
           (cluster, callback, commandArguments) -> {
             ((ChipClusters.EnergyEvseCluster) cluster).readSessionDurationAttribute(
-              (ChipClusters.LongAttributeCallback) callback
+              (ChipClusters.EnergyEvseCluster.SessionDurationAttributeCallback) callback
             );
           },
-          () -> new ClusterInfoMapping.DelegatedLongAttributeCallback(),
+          () -> new ClusterInfoMapping.DelegatedEnergyEvseClusterSessionDurationAttributeCallback(),
           readEnergyEvseSessionDurationCommandParams
         );
         result.put("readSessionDurationAttribute", readEnergyEvseSessionDurationAttributeInteractionInfo);
@@ -9347,10 +9347,10 @@ private static Map<String, InteractionInfo> readEnergyEvseInteractionInfo() {
         InteractionInfo readEnergyEvseSessionEnergyChargedAttributeInteractionInfo = new InteractionInfo(
           (cluster, callback, commandArguments) -> {
             ((ChipClusters.EnergyEvseCluster) cluster).readSessionEnergyChargedAttribute(
-              (ChipClusters.LongAttributeCallback) callback
+              (ChipClusters.EnergyEvseCluster.SessionEnergyChargedAttributeCallback) callback
             );
           },
-          () -> new ClusterInfoMapping.DelegatedLongAttributeCallback(),
+          () -> new ClusterInfoMapping.DelegatedEnergyEvseClusterSessionEnergyChargedAttributeCallback(),
           readEnergyEvseSessionEnergyChargedCommandParams
         );
         result.put("readSessionEnergyChargedAttribute", readEnergyEvseSessionEnergyChargedAttributeInteractionInfo);
@@ -9358,10 +9358,10 @@ private static Map<String, InteractionInfo> readEnergyEvseInteractionInfo() {
         InteractionInfo readEnergyEvseSessionEnergyDischargedAttributeInteractionInfo = new InteractionInfo(
           (cluster, callback, commandArguments) -> {
             ((ChipClusters.EnergyEvseCluster) cluster).readSessionEnergyDischargedAttribute(
-              (ChipClusters.LongAttributeCallback) callback
+              (ChipClusters.EnergyEvseCluster.SessionEnergyDischargedAttributeCallback) callback
             );
           },
-          () -> new ClusterInfoMapping.DelegatedLongAttributeCallback(),
+          () -> new ClusterInfoMapping.DelegatedEnergyEvseClusterSessionEnergyDischargedAttributeCallback(),
           readEnergyEvseSessionEnergyDischargedCommandParams
         );
         result.put("readSessionEnergyDischargedAttribute", readEnergyEvseSessionEnergyDischargedAttributeInteractionInfo);
diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseClusterChargingTargetStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseClusterChargingTargetStruct.kt
index f457f066ff27bc..9e859dbdf40e53 100644
--- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseClusterChargingTargetStruct.kt
+++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseClusterChargingTargetStruct.kt
@@ -24,13 +24,13 @@ import matter.tlv.TlvReader
 import matter.tlv.TlvWriter
 
 class EnergyEvseClusterChargingTargetStruct(
-  val targetTime: UInt,
+  val targetTimeMinutesPastMidnight: UInt,
   val targetSoC: Optional<UInt>,
   val addedEnergy: Optional<Long>
 ) {
   override fun toString(): String = buildString {
     append("EnergyEvseClusterChargingTargetStruct {\n")
-    append("\ttargetTime : $targetTime\n")
+    append("\ttargetTimeMinutesPastMidnight : $targetTimeMinutesPastMidnight\n")
     append("\ttargetSoC : $targetSoC\n")
     append("\taddedEnergy : $addedEnergy\n")
     append("}\n")
@@ -39,7 +39,7 @@ class EnergyEvseClusterChargingTargetStruct(
   fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) {
     tlvWriter.apply {
       startStructure(tlvTag)
-      put(ContextSpecificTag(TAG_TARGET_TIME), targetTime)
+      put(ContextSpecificTag(TAG_TARGET_TIME_MINUTES_PAST_MIDNIGHT), targetTimeMinutesPastMidnight)
       if (targetSoC.isPresent) {
         val opttargetSoC = targetSoC.get()
         put(ContextSpecificTag(TAG_TARGET_SO_C), opttargetSoC)
@@ -53,13 +53,14 @@ class EnergyEvseClusterChargingTargetStruct(
   }
 
   companion object {
-    private const val TAG_TARGET_TIME = 0
+    private const val TAG_TARGET_TIME_MINUTES_PAST_MIDNIGHT = 0
     private const val TAG_TARGET_SO_C = 1
     private const val TAG_ADDED_ENERGY = 2
 
     fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyEvseClusterChargingTargetStruct {
       tlvReader.enterStructure(tlvTag)
-      val targetTime = tlvReader.getUInt(ContextSpecificTag(TAG_TARGET_TIME))
+      val targetTimeMinutesPastMidnight =
+        tlvReader.getUInt(ContextSpecificTag(TAG_TARGET_TIME_MINUTES_PAST_MIDNIGHT))
       val targetSoC =
         if (tlvReader.isNextTag(ContextSpecificTag(TAG_TARGET_SO_C))) {
           Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_TARGET_SO_C)))
@@ -75,7 +76,11 @@ class EnergyEvseClusterChargingTargetStruct(
 
       tlvReader.exitContainer()
 
-      return EnergyEvseClusterChargingTargetStruct(targetTime, targetSoC, addedEnergy)
+      return EnergyEvseClusterChargingTargetStruct(
+        targetTimeMinutesPastMidnight,
+        targetSoC,
+        addedEnergy
+      )
     }
   }
 }
diff --git a/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/EnergyEvseCluster.kt b/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/EnergyEvseCluster.kt
index 8e5208cee1d2b4..b04d537dadb6b9 100644
--- a/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/EnergyEvseCluster.kt
+++ b/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/EnergyEvseCluster.kt
@@ -50,6 +50,12 @@ class EnergyEvseCluster(private val controller: MatterController, private val en
 
   class SessionIDAttribute(val value: UInt?)
 
+  class SessionDurationAttribute(val value: UInt?)
+
+  class SessionEnergyChargedAttribute(val value: Long?)
+
+  class SessionEnergyDischargedAttribute(val value: Long?)
+
   class GeneratedCommandListAttribute(val value: List<UInt>)
 
   class AcceptedCommandListAttribute(val value: List<UInt>)
@@ -349,27 +355,36 @@ class EnergyEvseCluster(private val controller: MatterController, private val en
     // Implementation needs to be added here
   }
 
-  suspend fun readSessionDurationAttribute(): UInt {
+  suspend fun readSessionDurationAttribute(): SessionDurationAttribute {
     // Implementation needs to be added here
   }
 
-  suspend fun subscribeSessionDurationAttribute(minInterval: Int, maxInterval: Int): UInt {
+  suspend fun subscribeSessionDurationAttribute(
+    minInterval: Int,
+    maxInterval: Int
+  ): SessionDurationAttribute {
     // Implementation needs to be added here
   }
 
-  suspend fun readSessionEnergyChargedAttribute(): Long {
+  suspend fun readSessionEnergyChargedAttribute(): SessionEnergyChargedAttribute {
     // Implementation needs to be added here
   }
 
-  suspend fun subscribeSessionEnergyChargedAttribute(minInterval: Int, maxInterval: Int): Long {
+  suspend fun subscribeSessionEnergyChargedAttribute(
+    minInterval: Int,
+    maxInterval: Int
+  ): SessionEnergyChargedAttribute {
     // Implementation needs to be added here
   }
 
-  suspend fun readSessionEnergyDischargedAttribute(): Long {
+  suspend fun readSessionEnergyDischargedAttribute(): SessionEnergyDischargedAttribute {
     // Implementation needs to be added here
   }
 
-  suspend fun subscribeSessionEnergyDischargedAttribute(minInterval: Int, maxInterval: Int): Long {
+  suspend fun subscribeSessionEnergyDischargedAttribute(
+    minInterval: Int,
+    maxInterval: Int
+  ): SessionEnergyDischargedAttribute {
     // Implementation needs to be added here
   }
 
diff --git a/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/EnergyEvseClusterChargingTargetStruct.kt b/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/EnergyEvseClusterChargingTargetStruct.kt
index a81f4c8716c8e8..c77debf20393d9 100644
--- a/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/EnergyEvseClusterChargingTargetStruct.kt
+++ b/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/EnergyEvseClusterChargingTargetStruct.kt
@@ -24,13 +24,13 @@ import matter.tlv.TlvReader
 import matter.tlv.TlvWriter
 
 class EnergyEvseClusterChargingTargetStruct(
-  val targetTime: UShort,
+  val targetTimeMinutesPastMidnight: UShort,
   val targetSoC: Optional<UByte>,
   val addedEnergy: Optional<Long>
 ) {
   override fun toString(): String = buildString {
     append("EnergyEvseClusterChargingTargetStruct {\n")
-    append("\ttargetTime : $targetTime\n")
+    append("\ttargetTimeMinutesPastMidnight : $targetTimeMinutesPastMidnight\n")
     append("\ttargetSoC : $targetSoC\n")
     append("\taddedEnergy : $addedEnergy\n")
     append("}\n")
@@ -39,7 +39,7 @@ class EnergyEvseClusterChargingTargetStruct(
   fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) {
     tlvWriter.apply {
       startStructure(tlvTag)
-      put(ContextSpecificTag(TAG_TARGET_TIME), targetTime)
+      put(ContextSpecificTag(TAG_TARGET_TIME_MINUTES_PAST_MIDNIGHT), targetTimeMinutesPastMidnight)
       if (targetSoC.isPresent) {
         val opttargetSoC = targetSoC.get()
         put(ContextSpecificTag(TAG_TARGET_SO_C), opttargetSoC)
@@ -53,13 +53,14 @@ class EnergyEvseClusterChargingTargetStruct(
   }
 
   companion object {
-    private const val TAG_TARGET_TIME = 0
+    private const val TAG_TARGET_TIME_MINUTES_PAST_MIDNIGHT = 0
     private const val TAG_TARGET_SO_C = 1
     private const val TAG_ADDED_ENERGY = 2
 
     fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyEvseClusterChargingTargetStruct {
       tlvReader.enterStructure(tlvTag)
-      val targetTime = tlvReader.getUShort(ContextSpecificTag(TAG_TARGET_TIME))
+      val targetTimeMinutesPastMidnight =
+        tlvReader.getUShort(ContextSpecificTag(TAG_TARGET_TIME_MINUTES_PAST_MIDNIGHT))
       val targetSoC =
         if (tlvReader.isNextTag(ContextSpecificTag(TAG_TARGET_SO_C))) {
           Optional.of(tlvReader.getUByte(ContextSpecificTag(TAG_TARGET_SO_C)))
@@ -75,7 +76,11 @@ class EnergyEvseClusterChargingTargetStruct(
 
       tlvReader.exitContainer()
 
-      return EnergyEvseClusterChargingTargetStruct(targetTime, targetSoC, addedEnergy)
+      return EnergyEvseClusterChargingTargetStruct(
+        targetTimeMinutesPastMidnight,
+        targetSoC,
+        addedEnergy
+      )
     }
   }
 }
diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp
index f8378c15aaf01c..3f55c79316a77a 100644
--- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp
+++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp
@@ -21157,11 +21157,18 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR
                 return nullptr;
             }
             jobject value;
-            std::string valueClassName     = "java/lang/Long";
-            std::string valueCtorSignature = "(J)V";
-            jlong jnivalue                 = static_cast<jlong>(cppValue);
-            chip::JniReferences::GetInstance().CreateBoxedObject<jlong>(valueClassName.c_str(), valueCtorSignature.c_str(),
-                                                                        jnivalue, value);
+            if (cppValue.IsNull())
+            {
+                value = nullptr;
+            }
+            else
+            {
+                std::string valueClassName     = "java/lang/Long";
+                std::string valueCtorSignature = "(J)V";
+                jlong jnivalue                 = static_cast<jlong>(cppValue.Value());
+                chip::JniReferences::GetInstance().CreateBoxedObject<jlong>(valueClassName.c_str(), valueCtorSignature.c_str(),
+                                                                            jnivalue, value);
+            }
             return value;
         }
         case Attributes::SessionEnergyCharged::Id: {
@@ -21173,11 +21180,18 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR
                 return nullptr;
             }
             jobject value;
-            std::string valueClassName     = "java/lang/Long";
-            std::string valueCtorSignature = "(J)V";
-            jlong jnivalue                 = static_cast<jlong>(cppValue);
-            chip::JniReferences::GetInstance().CreateBoxedObject<jlong>(valueClassName.c_str(), valueCtorSignature.c_str(),
-                                                                        jnivalue, value);
+            if (cppValue.IsNull())
+            {
+                value = nullptr;
+            }
+            else
+            {
+                std::string valueClassName     = "java/lang/Long";
+                std::string valueCtorSignature = "(J)V";
+                jlong jnivalue                 = static_cast<jlong>(cppValue.Value());
+                chip::JniReferences::GetInstance().CreateBoxedObject<jlong>(valueClassName.c_str(), valueCtorSignature.c_str(),
+                                                                            jnivalue, value);
+            }
             return value;
         }
         case Attributes::SessionEnergyDischarged::Id: {
@@ -21189,11 +21203,18 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR
                 return nullptr;
             }
             jobject value;
-            std::string valueClassName     = "java/lang/Long";
-            std::string valueCtorSignature = "(J)V";
-            jlong jnivalue                 = static_cast<jlong>(cppValue);
-            chip::JniReferences::GetInstance().CreateBoxedObject<jlong>(valueClassName.c_str(), valueCtorSignature.c_str(),
-                                                                        jnivalue, value);
+            if (cppValue.IsNull())
+            {
+                value = nullptr;
+            }
+            else
+            {
+                std::string valueClassName     = "java/lang/Long";
+                std::string valueCtorSignature = "(J)V";
+                jlong jnivalue                 = static_cast<jlong>(cppValue.Value());
+                chip::JniReferences::GetInstance().CreateBoxedObject<jlong>(valueClassName.c_str(), valueCtorSignature.c_str(),
+                                                                            jnivalue, value);
+            }
             return value;
         }
         case Attributes::GeneratedCommandList::Id: {
diff --git a/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp b/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp
index 6b14927999f48a..886d4af532f7b3 100644
--- a/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp
+++ b/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp
@@ -3959,13 +3959,14 @@ void CHIPEnergyEvseClusterGetTargetsResponseCallback::CallbackFn(
     {
         auto & entry_0 = iter_ChargingTargets_0.GetValue();
         jobject newElement_0;
-        jobject newElement_0_targetTime;
-        std::string newElement_0_targetTimeClassName     = "java/lang/Integer";
-        std::string newElement_0_targetTimeCtorSignature = "(I)V";
-        jint jninewElement_0_targetTime                  = static_cast<jint>(entry_0.targetTime);
-        chip::JniReferences::GetInstance().CreateBoxedObject<jint>(newElement_0_targetTimeClassName.c_str(),
-                                                                   newElement_0_targetTimeCtorSignature.c_str(),
-                                                                   jninewElement_0_targetTime, newElement_0_targetTime);
+        jobject newElement_0_targetTimeMinutesPastMidnight;
+        std::string newElement_0_targetTimeMinutesPastMidnightClassName     = "java/lang/Integer";
+        std::string newElement_0_targetTimeMinutesPastMidnightCtorSignature = "(I)V";
+        jint jninewElement_0_targetTimeMinutesPastMidnight = static_cast<jint>(entry_0.targetTimeMinutesPastMidnight);
+        chip::JniReferences::GetInstance().CreateBoxedObject<jint>(newElement_0_targetTimeMinutesPastMidnightClassName.c_str(),
+                                                                   newElement_0_targetTimeMinutesPastMidnightCtorSignature.c_str(),
+                                                                   jninewElement_0_targetTimeMinutesPastMidnight,
+                                                                   newElement_0_targetTimeMinutesPastMidnight);
         jobject newElement_0_targetSoC;
         if (!entry_0.targetSoC.HasValue())
         {
@@ -4016,8 +4017,8 @@ void CHIPEnergyEvseClusterGetTargetsResponseCallback::CallbackFn(
             return;
         }
 
-        newElement_0 = env->NewObject(chargingTargetStructStructClass_1, chargingTargetStructStructCtor_1, newElement_0_targetTime,
-                                      newElement_0_targetSoC, newElement_0_addedEnergy);
+        newElement_0 = env->NewObject(chargingTargetStructStructClass_1, chargingTargetStructStructCtor_1,
+                                      newElement_0_targetTimeMinutesPastMidnight, newElement_0_targetSoC, newElement_0_addedEnergy);
         chip::JniReferences::GetInstance().AddToList(ChargingTargets, newElement_0);
     }
 
diff --git a/src/controller/java/zap-generated/CHIPReadCallbacks.cpp b/src/controller/java/zap-generated/CHIPReadCallbacks.cpp
index 7437f04c99f4bc..4198fb821c53dd 100644
--- a/src/controller/java/zap-generated/CHIPReadCallbacks.cpp
+++ b/src/controller/java/zap-generated/CHIPReadCallbacks.cpp
@@ -33171,6 +33171,208 @@ void CHIPEnergyEvseSessionIDAttributeCallback::CallbackFn(void * context, const
     env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue);
 }
 
+CHIPEnergyEvseSessionDurationAttributeCallback::CHIPEnergyEvseSessionDurationAttributeCallback(jobject javaCallback,
+                                                                                               bool keepAlive) :
+    chip::Callback::Callback<CHIPEnergyEvseClusterSessionDurationAttributeCallbackType>(CallbackFn, this), keepAlive(keepAlive)
+{
+    JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread();
+    if (env == nullptr)
+    {
+        ChipLogError(Zcl, "Could not create global reference for Java callback");
+        return;
+    }
+
+    javaCallbackRef = env->NewGlobalRef(javaCallback);
+    if (javaCallbackRef == nullptr)
+    {
+        ChipLogError(Zcl, "Could not create global reference for Java callback");
+    }
+}
+
+CHIPEnergyEvseSessionDurationAttributeCallback::~CHIPEnergyEvseSessionDurationAttributeCallback()
+{
+    JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread();
+    if (env == nullptr)
+    {
+        ChipLogError(Zcl, "Could not delete global reference for Java callback");
+        return;
+    }
+    env->DeleteGlobalRef(javaCallbackRef);
+}
+
+void CHIPEnergyEvseSessionDurationAttributeCallback::CallbackFn(void * context,
+                                                                const chip::app::DataModel::Nullable<uint32_t> & value)
+{
+    chip::DeviceLayer::StackUnlock unlock;
+    CHIP_ERROR err = CHIP_NO_ERROR;
+    JNIEnv * env   = chip::JniReferences::GetInstance().GetEnvForCurrentThread();
+    jobject javaCallbackRef;
+
+    VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env"));
+    std::unique_ptr<CHIPEnergyEvseSessionDurationAttributeCallback, decltype(&maybeDestroy)> cppCallback(
+        reinterpret_cast<CHIPEnergyEvseSessionDurationAttributeCallback *>(context), maybeDestroy);
+
+    // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback.
+    javaCallbackRef = cppCallback.get()->javaCallbackRef;
+    VerifyOrReturn(javaCallbackRef != nullptr,
+                   ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null"));
+
+    jmethodID javaMethod;
+    err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/lang/Long;)V", &javaMethod);
+    VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method"));
+
+    jobject javaValue;
+    if (value.IsNull())
+    {
+        javaValue = nullptr;
+    }
+    else
+    {
+        std::string javaValueClassName     = "java/lang/Long";
+        std::string javaValueCtorSignature = "(J)V";
+        jlong jnijavaValue                 = static_cast<jlong>(value.Value());
+        chip::JniReferences::GetInstance().CreateBoxedObject<jlong>(javaValueClassName.c_str(), javaValueCtorSignature.c_str(),
+                                                                    jnijavaValue, javaValue);
+    }
+
+    env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue);
+}
+
+CHIPEnergyEvseSessionEnergyChargedAttributeCallback::CHIPEnergyEvseSessionEnergyChargedAttributeCallback(jobject javaCallback,
+                                                                                                         bool keepAlive) :
+    chip::Callback::Callback<CHIPEnergyEvseClusterSessionEnergyChargedAttributeCallbackType>(CallbackFn, this), keepAlive(keepAlive)
+{
+    JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread();
+    if (env == nullptr)
+    {
+        ChipLogError(Zcl, "Could not create global reference for Java callback");
+        return;
+    }
+
+    javaCallbackRef = env->NewGlobalRef(javaCallback);
+    if (javaCallbackRef == nullptr)
+    {
+        ChipLogError(Zcl, "Could not create global reference for Java callback");
+    }
+}
+
+CHIPEnergyEvseSessionEnergyChargedAttributeCallback::~CHIPEnergyEvseSessionEnergyChargedAttributeCallback()
+{
+    JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread();
+    if (env == nullptr)
+    {
+        ChipLogError(Zcl, "Could not delete global reference for Java callback");
+        return;
+    }
+    env->DeleteGlobalRef(javaCallbackRef);
+}
+
+void CHIPEnergyEvseSessionEnergyChargedAttributeCallback::CallbackFn(void * context,
+                                                                     const chip::app::DataModel::Nullable<int64_t> & value)
+{
+    chip::DeviceLayer::StackUnlock unlock;
+    CHIP_ERROR err = CHIP_NO_ERROR;
+    JNIEnv * env   = chip::JniReferences::GetInstance().GetEnvForCurrentThread();
+    jobject javaCallbackRef;
+
+    VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env"));
+    std::unique_ptr<CHIPEnergyEvseSessionEnergyChargedAttributeCallback, decltype(&maybeDestroy)> cppCallback(
+        reinterpret_cast<CHIPEnergyEvseSessionEnergyChargedAttributeCallback *>(context), maybeDestroy);
+
+    // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback.
+    javaCallbackRef = cppCallback.get()->javaCallbackRef;
+    VerifyOrReturn(javaCallbackRef != nullptr,
+                   ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null"));
+
+    jmethodID javaMethod;
+    err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/lang/Long;)V", &javaMethod);
+    VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method"));
+
+    jobject javaValue;
+    if (value.IsNull())
+    {
+        javaValue = nullptr;
+    }
+    else
+    {
+        std::string javaValueClassName     = "java/lang/Long";
+        std::string javaValueCtorSignature = "(J)V";
+        jlong jnijavaValue                 = static_cast<jlong>(value.Value());
+        chip::JniReferences::GetInstance().CreateBoxedObject<jlong>(javaValueClassName.c_str(), javaValueCtorSignature.c_str(),
+                                                                    jnijavaValue, javaValue);
+    }
+
+    env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue);
+}
+
+CHIPEnergyEvseSessionEnergyDischargedAttributeCallback::CHIPEnergyEvseSessionEnergyDischargedAttributeCallback(jobject javaCallback,
+                                                                                                               bool keepAlive) :
+    chip::Callback::Callback<CHIPEnergyEvseClusterSessionEnergyDischargedAttributeCallbackType>(CallbackFn, this),
+    keepAlive(keepAlive)
+{
+    JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread();
+    if (env == nullptr)
+    {
+        ChipLogError(Zcl, "Could not create global reference for Java callback");
+        return;
+    }
+
+    javaCallbackRef = env->NewGlobalRef(javaCallback);
+    if (javaCallbackRef == nullptr)
+    {
+        ChipLogError(Zcl, "Could not create global reference for Java callback");
+    }
+}
+
+CHIPEnergyEvseSessionEnergyDischargedAttributeCallback::~CHIPEnergyEvseSessionEnergyDischargedAttributeCallback()
+{
+    JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread();
+    if (env == nullptr)
+    {
+        ChipLogError(Zcl, "Could not delete global reference for Java callback");
+        return;
+    }
+    env->DeleteGlobalRef(javaCallbackRef);
+}
+
+void CHIPEnergyEvseSessionEnergyDischargedAttributeCallback::CallbackFn(void * context,
+                                                                        const chip::app::DataModel::Nullable<int64_t> & value)
+{
+    chip::DeviceLayer::StackUnlock unlock;
+    CHIP_ERROR err = CHIP_NO_ERROR;
+    JNIEnv * env   = chip::JniReferences::GetInstance().GetEnvForCurrentThread();
+    jobject javaCallbackRef;
+
+    VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env"));
+    std::unique_ptr<CHIPEnergyEvseSessionEnergyDischargedAttributeCallback, decltype(&maybeDestroy)> cppCallback(
+        reinterpret_cast<CHIPEnergyEvseSessionEnergyDischargedAttributeCallback *>(context), maybeDestroy);
+
+    // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback.
+    javaCallbackRef = cppCallback.get()->javaCallbackRef;
+    VerifyOrReturn(javaCallbackRef != nullptr,
+                   ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null"));
+
+    jmethodID javaMethod;
+    err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/lang/Long;)V", &javaMethod);
+    VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method"));
+
+    jobject javaValue;
+    if (value.IsNull())
+    {
+        javaValue = nullptr;
+    }
+    else
+    {
+        std::string javaValueClassName     = "java/lang/Long";
+        std::string javaValueCtorSignature = "(J)V";
+        jlong jnijavaValue                 = static_cast<jlong>(value.Value());
+        chip::JniReferences::GetInstance().CreateBoxedObject<jlong>(javaValueClassName.c_str(), javaValueCtorSignature.c_str(),
+                                                                    jnijavaValue, javaValue);
+    }
+
+    env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue);
+}
+
 CHIPEnergyEvseGeneratedCommandListAttributeCallback::CHIPEnergyEvseGeneratedCommandListAttributeCallback(jobject javaCallback,
                                                                                                          bool keepAlive) :
     chip::Callback::Callback<CHIPEnergyEvseClusterGeneratedCommandListAttributeCallbackType>(CallbackFn, this), keepAlive(keepAlive)
diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py
index 9401e9653c15d1..0f1d8f044eb420 100644
--- a/src/controller/python/chip/clusters/Objects.py
+++ b/src/controller/python/chip/clusters/Objects.py
@@ -22796,9 +22796,9 @@ def descriptor(cls) -> ClusterObjectDescriptor:
                 ClusterObjectFieldDescriptor(Label="batteryCapacity", Tag=0x00000031, Type=typing.Union[None, Nullable, int]),
                 ClusterObjectFieldDescriptor(Label="vehicleID", Tag=0x00000032, Type=typing.Union[None, Nullable, str]),
                 ClusterObjectFieldDescriptor(Label="sessionID", Tag=0x00000040, Type=typing.Union[Nullable, uint]),
-                ClusterObjectFieldDescriptor(Label="sessionDuration", Tag=0x00000041, Type=uint),
-                ClusterObjectFieldDescriptor(Label="sessionEnergyCharged", Tag=0x00000042, Type=int),
-                ClusterObjectFieldDescriptor(Label="sessionEnergyDischarged", Tag=0x00000043, Type=typing.Optional[int]),
+                ClusterObjectFieldDescriptor(Label="sessionDuration", Tag=0x00000041, Type=typing.Union[Nullable, uint]),
+                ClusterObjectFieldDescriptor(Label="sessionEnergyCharged", Tag=0x00000042, Type=typing.Union[Nullable, int]),
+                ClusterObjectFieldDescriptor(Label="sessionEnergyDischarged", Tag=0x00000043, Type=typing.Union[None, Nullable, int]),
                 ClusterObjectFieldDescriptor(Label="generatedCommandList", Tag=0x0000FFF8, Type=typing.List[uint]),
                 ClusterObjectFieldDescriptor(Label="acceptedCommandList", Tag=0x0000FFF9, Type=typing.List[uint]),
                 ClusterObjectFieldDescriptor(Label="eventList", Tag=0x0000FFFA, Type=typing.List[uint]),
@@ -22829,9 +22829,9 @@ def descriptor(cls) -> ClusterObjectDescriptor:
     batteryCapacity: 'typing.Union[None, Nullable, int]' = None
     vehicleID: 'typing.Union[None, Nullable, str]' = None
     sessionID: 'typing.Union[Nullable, uint]' = None
-    sessionDuration: 'uint' = None
-    sessionEnergyCharged: 'int' = None
-    sessionEnergyDischarged: 'typing.Optional[int]' = None
+    sessionDuration: 'typing.Union[Nullable, uint]' = None
+    sessionEnergyCharged: 'typing.Union[Nullable, int]' = None
+    sessionEnergyDischarged: 'typing.Union[None, Nullable, int]' = None
     generatedCommandList: 'typing.List[uint]' = None
     acceptedCommandList: 'typing.List[uint]' = None
     eventList: 'typing.List[uint]' = None
@@ -22924,12 +22924,12 @@ class ChargingTargetStruct(ClusterObject):
             def descriptor(cls) -> ClusterObjectDescriptor:
                 return ClusterObjectDescriptor(
                     Fields=[
-                        ClusterObjectFieldDescriptor(Label="targetTime", Tag=0, Type=uint),
+                        ClusterObjectFieldDescriptor(Label="targetTimeMinutesPastMidnight", Tag=0, Type=uint),
                         ClusterObjectFieldDescriptor(Label="targetSoC", Tag=1, Type=typing.Optional[uint]),
                         ClusterObjectFieldDescriptor(Label="addedEnergy", Tag=2, Type=typing.Optional[int]),
                     ])
 
-            targetTime: 'uint' = 0
+            targetTimeMinutesPastMidnight: 'uint' = 0
             targetSoC: 'typing.Optional[uint]' = None
             addedEnergy: 'typing.Optional[int]' = None
 
@@ -23456,9 +23456,9 @@ def attribute_id(cls) -> int:
 
             @ChipUtility.classproperty
             def attribute_type(cls) -> ClusterObjectFieldDescriptor:
-                return ClusterObjectFieldDescriptor(Type=uint)
+                return ClusterObjectFieldDescriptor(Type=typing.Union[Nullable, uint])
 
-            value: 'uint' = 0
+            value: 'typing.Union[Nullable, uint]' = NullValue
 
         @dataclass
         class SessionEnergyCharged(ClusterAttributeDescriptor):
@@ -23472,9 +23472,9 @@ def attribute_id(cls) -> int:
 
             @ChipUtility.classproperty
             def attribute_type(cls) -> ClusterObjectFieldDescriptor:
-                return ClusterObjectFieldDescriptor(Type=int)
+                return ClusterObjectFieldDescriptor(Type=typing.Union[Nullable, int])
 
-            value: 'int' = 0
+            value: 'typing.Union[Nullable, int]' = NullValue
 
         @dataclass
         class SessionEnergyDischarged(ClusterAttributeDescriptor):
@@ -23488,9 +23488,9 @@ def attribute_id(cls) -> int:
 
             @ChipUtility.classproperty
             def attribute_type(cls) -> ClusterObjectFieldDescriptor:
-                return ClusterObjectFieldDescriptor(Type=typing.Optional[int])
+                return ClusterObjectFieldDescriptor(Type=typing.Union[None, Nullable, int])
 
-            value: 'typing.Optional[int]' = None
+            value: 'typing.Union[None, Nullable, int]' = None
 
         @dataclass
         class GeneratedCommandList(ClusterAttributeDescriptor):
diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm
index 6984dd50ecabf4..53cb77540486d8 100644
--- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm
+++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm
@@ -8268,8 +8268,12 @@ static id _Nullable DecodeAttributeValueForEnergyEVSECluster(AttributeId aAttrib
         if (*aError != CHIP_NO_ERROR) {
             return nil;
         }
-        NSNumber * _Nonnull value;
-        value = [NSNumber numberWithUnsignedInt:cppValue];
+        NSNumber * _Nullable value;
+        if (cppValue.IsNull()) {
+            value = nil;
+        } else {
+            value = [NSNumber numberWithUnsignedInt:cppValue.Value()];
+        }
         return value;
     }
     case Attributes::SessionEnergyCharged::Id: {
@@ -8279,8 +8283,12 @@ static id _Nullable DecodeAttributeValueForEnergyEVSECluster(AttributeId aAttrib
         if (*aError != CHIP_NO_ERROR) {
             return nil;
         }
-        NSNumber * _Nonnull value;
-        value = [NSNumber numberWithLongLong:cppValue];
+        NSNumber * _Nullable value;
+        if (cppValue.IsNull()) {
+            value = nil;
+        } else {
+            value = [NSNumber numberWithLongLong:cppValue.Value()];
+        }
         return value;
     }
     case Attributes::SessionEnergyDischarged::Id: {
@@ -8290,8 +8298,12 @@ static id _Nullable DecodeAttributeValueForEnergyEVSECluster(AttributeId aAttrib
         if (*aError != CHIP_NO_ERROR) {
             return nil;
         }
-        NSNumber * _Nonnull value;
-        value = [NSNumber numberWithLongLong:cppValue];
+        NSNumber * _Nullable value;
+        if (cppValue.IsNull()) {
+            value = nil;
+        } else {
+            value = [NSNumber numberWithLongLong:cppValue.Value()];
+        }
         return value;
     }
     default: {
diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm
index 84aa2dd3157ba2..990e8e9543a826 100644
--- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm
+++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm
@@ -16300,7 +16300,7 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::EnergyEv
                 auto & entry_0 = iter_0.GetValue();
                 MTREnergyEVSEClusterChargingTargetStruct * newElement_0;
                 newElement_0 = [MTREnergyEVSEClusterChargingTargetStruct new];
-                newElement_0.targetTime = [NSNumber numberWithUnsignedShort:entry_0.targetTime];
+                newElement_0.targetTimeMinutesPastMidnight = [NSNumber numberWithUnsignedShort:entry_0.targetTimeMinutesPastMidnight];
                 if (entry_0.targetSoC.HasValue()) {
                     newElement_0.targetSoC = [NSNumber numberWithUnsignedChar:entry_0.targetSoC.Value()];
                 } else {
@@ -16716,7 +16716,7 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader
                         return CHIP_ERROR_INVALID_ARGUMENT;
                     }
                     auto element_0 = (MTREnergyEVSEClusterChargingTargetStruct *) self.chargingTargets[i_0];
-                    listHolder_0->mList[i_0].targetTime = element_0.targetTime.unsignedShortValue;
+                    listHolder_0->mList[i_0].targetTimeMinutesPastMidnight = element_0.targetTimeMinutesPastMidnight.unsignedShortValue;
                     if (element_0.targetSoC != nil) {
                         auto & definedValue_2 = listHolder_0->mList[i_0].targetSoC.Emplace();
                         definedValue_2 = element_0.targetSoC.unsignedCharValue;
diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h
index 3bc24e45d309f7..c52be978096752 100644
--- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h
+++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h
@@ -1148,7 +1148,7 @@ MTR_PROVISIONALLY_AVAILABLE
 
 MTR_PROVISIONALLY_AVAILABLE
 @interface MTREnergyEVSEClusterChargingTargetStruct : NSObject <NSCopying>
-@property (nonatomic, copy) NSNumber * _Nonnull targetTime MTR_PROVISIONALLY_AVAILABLE;
+@property (nonatomic, copy) NSNumber * _Nonnull targetTimeMinutesPastMidnight MTR_PROVISIONALLY_AVAILABLE;
 @property (nonatomic, copy) NSNumber * _Nullable targetSoC MTR_PROVISIONALLY_AVAILABLE;
 @property (nonatomic, copy) NSNumber * _Nullable addedEnergy MTR_PROVISIONALLY_AVAILABLE;
 @end
diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm
index fa9319d59092fc..e5387099738cbd 100644
--- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm
+++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm
@@ -4645,7 +4645,7 @@ - (instancetype)init
 {
     if (self = [super init]) {
 
-        _targetTime = @(0);
+        _targetTimeMinutesPastMidnight = @(0);
 
         _targetSoC = nil;
 
@@ -4658,7 +4658,7 @@ - (id)copyWithZone:(NSZone * _Nullable)zone
 {
     auto other = [[MTREnergyEVSEClusterChargingTargetStruct alloc] init];
 
-    other.targetTime = self.targetTime;
+    other.targetTimeMinutesPastMidnight = self.targetTimeMinutesPastMidnight;
     other.targetSoC = self.targetSoC;
     other.addedEnergy = self.addedEnergy;
 
@@ -4667,7 +4667,7 @@ - (id)copyWithZone:(NSZone * _Nullable)zone
 
 - (NSString *)description
 {
-    NSString * descriptionString = [NSString stringWithFormat:@"<%@: targetTime:%@; targetSoC:%@; addedEnergy:%@; >", NSStringFromClass([self class]), _targetTime, _targetSoC, _addedEnergy];
+    NSString * descriptionString = [NSString stringWithFormat:@"<%@: targetTimeMinutesPastMidnight:%@; targetSoC:%@; addedEnergy:%@; >", NSStringFromClass([self class]), _targetTimeMinutesPastMidnight, _targetSoC, _addedEnergy];
     return descriptionString;
 }
 
diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp
index 686af77f7168ef..d37368b683b1d4 100644
--- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp
+++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp
@@ -11301,24 +11301,27 @@ EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullabl
 
 namespace SessionDuration {
 
-EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value)
+EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable<uint32_t> & value)
 {
     using Traits = NumericAttributeTraits<uint32_t>;
     Traits::StorageType temp;
     uint8_t * readable   = Traits::ToAttributeStoreRepresentation(temp);
     EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::EnergyEvse::Id, Id, readable, sizeof(temp));
     VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status);
-    if (!Traits::CanRepresentValue(/* isNullable = */ false, temp))
+    if (Traits::IsNullValue(temp))
     {
-        return EMBER_ZCL_STATUS_CONSTRAINT_ERROR;
+        value.SetNull();
+    }
+    else
+    {
+        value.SetNonNull() = Traits::StorageToWorking(temp);
     }
-    *value = Traits::StorageToWorking(temp);
     return status;
 }
 EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value)
 {
     using Traits = NumericAttributeTraits<uint32_t>;
-    if (!Traits::CanRepresentValue(/* isNullable = */ false, value))
+    if (!Traits::CanRepresentValue(/* isNullable = */ true, value))
     {
         return EMBER_ZCL_STATUS_CONSTRAINT_ERROR;
     }
@@ -11328,28 +11331,50 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value)
     return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ELAPSED_S_ATTRIBUTE_TYPE);
 }
 
+EmberAfStatus SetNull(chip::EndpointId endpoint)
+{
+    using Traits = NumericAttributeTraits<uint32_t>;
+    Traits::StorageType value;
+    Traits::SetNull(value);
+    uint8_t * writable = Traits::ToAttributeStoreRepresentation(value);
+    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ELAPSED_S_ATTRIBUTE_TYPE);
+}
+
+EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable<uint32_t> & value)
+{
+    if (value.IsNull())
+    {
+        return SetNull(endpoint);
+    }
+
+    return Set(endpoint, value.Value());
+}
+
 } // namespace SessionDuration
 
 namespace SessionEnergyCharged {
 
-EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value)
+EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable<int64_t> & value)
 {
     using Traits = NumericAttributeTraits<int64_t>;
     Traits::StorageType temp;
     uint8_t * readable   = Traits::ToAttributeStoreRepresentation(temp);
     EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::EnergyEvse::Id, Id, readable, sizeof(temp));
     VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status);
-    if (!Traits::CanRepresentValue(/* isNullable = */ false, temp))
+    if (Traits::IsNullValue(temp))
     {
-        return EMBER_ZCL_STATUS_CONSTRAINT_ERROR;
+        value.SetNull();
+    }
+    else
+    {
+        value.SetNonNull() = Traits::StorageToWorking(temp);
     }
-    *value = Traits::StorageToWorking(temp);
     return status;
 }
 EmberAfStatus Set(chip::EndpointId endpoint, int64_t value)
 {
     using Traits = NumericAttributeTraits<int64_t>;
-    if (!Traits::CanRepresentValue(/* isNullable = */ false, value))
+    if (!Traits::CanRepresentValue(/* isNullable = */ true, value))
     {
         return EMBER_ZCL_STATUS_CONSTRAINT_ERROR;
     }
@@ -11359,28 +11384,50 @@ EmberAfStatus Set(chip::EndpointId endpoint, int64_t value)
     return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_MWH_ATTRIBUTE_TYPE);
 }
 
+EmberAfStatus SetNull(chip::EndpointId endpoint)
+{
+    using Traits = NumericAttributeTraits<int64_t>;
+    Traits::StorageType value;
+    Traits::SetNull(value);
+    uint8_t * writable = Traits::ToAttributeStoreRepresentation(value);
+    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_MWH_ATTRIBUTE_TYPE);
+}
+
+EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable<int64_t> & value)
+{
+    if (value.IsNull())
+    {
+        return SetNull(endpoint);
+    }
+
+    return Set(endpoint, value.Value());
+}
+
 } // namespace SessionEnergyCharged
 
 namespace SessionEnergyDischarged {
 
-EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value)
+EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable<int64_t> & value)
 {
     using Traits = NumericAttributeTraits<int64_t>;
     Traits::StorageType temp;
     uint8_t * readable   = Traits::ToAttributeStoreRepresentation(temp);
     EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::EnergyEvse::Id, Id, readable, sizeof(temp));
     VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status);
-    if (!Traits::CanRepresentValue(/* isNullable = */ false, temp))
+    if (Traits::IsNullValue(temp))
     {
-        return EMBER_ZCL_STATUS_CONSTRAINT_ERROR;
+        value.SetNull();
+    }
+    else
+    {
+        value.SetNonNull() = Traits::StorageToWorking(temp);
     }
-    *value = Traits::StorageToWorking(temp);
     return status;
 }
 EmberAfStatus Set(chip::EndpointId endpoint, int64_t value)
 {
     using Traits = NumericAttributeTraits<int64_t>;
-    if (!Traits::CanRepresentValue(/* isNullable = */ false, value))
+    if (!Traits::CanRepresentValue(/* isNullable = */ true, value))
     {
         return EMBER_ZCL_STATUS_CONSTRAINT_ERROR;
     }
@@ -11390,6 +11437,25 @@ EmberAfStatus Set(chip::EndpointId endpoint, int64_t value)
     return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_MWH_ATTRIBUTE_TYPE);
 }
 
+EmberAfStatus SetNull(chip::EndpointId endpoint)
+{
+    using Traits = NumericAttributeTraits<int64_t>;
+    Traits::StorageType value;
+    Traits::SetNull(value);
+    uint8_t * writable = Traits::ToAttributeStoreRepresentation(value);
+    return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_MWH_ATTRIBUTE_TYPE);
+}
+
+EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable<int64_t> & value)
+{
+    if (value.IsNull())
+    {
+        return SetNull(endpoint);
+    }
+
+    return Set(endpoint, value.Value());
+}
+
 } // namespace SessionEnergyDischarged
 
 namespace FeatureMap {
diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h
index 3d5c3dbe54058d..a06d90a274d523 100644
--- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h
+++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h
@@ -2141,18 +2141,24 @@ EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullabl
 } // namespace SessionID
 
 namespace SessionDuration {
-EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value); // elapsed_s
+EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable<uint32_t> & value); // elapsed_s
 EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value);
+EmberAfStatus SetNull(chip::EndpointId endpoint);
+EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable<uint32_t> & value);
 } // namespace SessionDuration
 
 namespace SessionEnergyCharged {
-EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // energy_mwh
+EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable<int64_t> & value); // energy_mwh
 EmberAfStatus Set(chip::EndpointId endpoint, int64_t value);
+EmberAfStatus SetNull(chip::EndpointId endpoint);
+EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable<int64_t> & value);
 } // namespace SessionEnergyCharged
 
 namespace SessionEnergyDischarged {
-EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // energy_mwh
+EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable<int64_t> & value); // energy_mwh
 EmberAfStatus Set(chip::EndpointId endpoint, int64_t value);
+EmberAfStatus SetNull(chip::EndpointId endpoint);
+EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable<int64_t> & value);
 } // namespace SessionEnergyDischarged
 
 namespace FeatureMap {
diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp
index c9ea1a045e35e2..1798e23105ff7e 100644
--- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp
+++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp
@@ -14685,7 +14685,7 @@ namespace ChargingTargetStruct {
 CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
 {
     DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
-    encoder.Encode(to_underlying(Fields::kTargetTime), targetTime);
+    encoder.Encode(to_underlying(Fields::kTargetTimeMinutesPastMidnight), targetTimeMinutesPastMidnight);
     encoder.Encode(to_underlying(Fields::kTargetSoC), targetSoC);
     encoder.Encode(to_underlying(Fields::kAddedEnergy), addedEnergy);
     return encoder.Finalize();
@@ -14705,9 +14705,9 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
         CHIP_ERROR err              = CHIP_NO_ERROR;
         const uint8_t __context_tag = std::get<uint8_t>(__element);
 
-        if (__context_tag == to_underlying(Fields::kTargetTime))
+        if (__context_tag == to_underlying(Fields::kTargetTimeMinutesPastMidnight))
         {
-            err = DataModel::Decode(reader, targetTime);
+            err = DataModel::Decode(reader, targetTimeMinutesPastMidnight);
         }
         else if (__context_tag == to_underlying(Fields::kTargetSoC))
         {
diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h
index 4b7d700dfc0585..1c19d448dd8957 100644
--- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h
+++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h
@@ -20766,15 +20766,15 @@ namespace Structs {
 namespace ChargingTargetStruct {
 enum class Fields : uint8_t
 {
-    kTargetTime  = 0,
-    kTargetSoC   = 1,
-    kAddedEnergy = 2,
+    kTargetTimeMinutesPastMidnight = 0,
+    kTargetSoC                     = 1,
+    kAddedEnergy                   = 2,
 };
 
 struct Type
 {
 public:
-    uint16_t targetTime = static_cast<uint16_t>(0);
+    uint16_t targetTimeMinutesPastMidnight = static_cast<uint16_t>(0);
     Optional<chip::Percent> targetSoC;
     Optional<int64_t> addedEnergy;
 
@@ -21367,9 +21367,9 @@ struct TypeInfo
 namespace SessionDuration {
 struct TypeInfo
 {
-    using Type             = uint32_t;
-    using DecodableType    = uint32_t;
-    using DecodableArgType = uint32_t;
+    using Type             = chip::app::DataModel::Nullable<uint32_t>;
+    using DecodableType    = chip::app::DataModel::Nullable<uint32_t>;
+    using DecodableArgType = const chip::app::DataModel::Nullable<uint32_t> &;
 
     static constexpr ClusterId GetClusterId() { return Clusters::EnergyEvse::Id; }
     static constexpr AttributeId GetAttributeId() { return Attributes::SessionDuration::Id; }
@@ -21379,9 +21379,9 @@ struct TypeInfo
 namespace SessionEnergyCharged {
 struct TypeInfo
 {
-    using Type             = int64_t;
-    using DecodableType    = int64_t;
-    using DecodableArgType = int64_t;
+    using Type             = chip::app::DataModel::Nullable<int64_t>;
+    using DecodableType    = chip::app::DataModel::Nullable<int64_t>;
+    using DecodableArgType = const chip::app::DataModel::Nullable<int64_t> &;
 
     static constexpr ClusterId GetClusterId() { return Clusters::EnergyEvse::Id; }
     static constexpr AttributeId GetAttributeId() { return Attributes::SessionEnergyCharged::Id; }
@@ -21391,9 +21391,9 @@ struct TypeInfo
 namespace SessionEnergyDischarged {
 struct TypeInfo
 {
-    using Type             = int64_t;
-    using DecodableType    = int64_t;
-    using DecodableArgType = int64_t;
+    using Type             = chip::app::DataModel::Nullable<int64_t>;
+    using DecodableType    = chip::app::DataModel::Nullable<int64_t>;
+    using DecodableArgType = const chip::app::DataModel::Nullable<int64_t> &;
 
     static constexpr ClusterId GetClusterId() { return Clusters::EnergyEvse::Id; }
     static constexpr AttributeId GetAttributeId() { return Attributes::SessionEnergyDischarged::Id; }
@@ -21469,9 +21469,9 @@ struct TypeInfo
         Attributes::BatteryCapacity::TypeInfo::DecodableType batteryCapacity;
         Attributes::VehicleID::TypeInfo::DecodableType vehicleID;
         Attributes::SessionID::TypeInfo::DecodableType sessionID;
-        Attributes::SessionDuration::TypeInfo::DecodableType sessionDuration                 = static_cast<uint32_t>(0);
-        Attributes::SessionEnergyCharged::TypeInfo::DecodableType sessionEnergyCharged       = static_cast<int64_t>(0);
-        Attributes::SessionEnergyDischarged::TypeInfo::DecodableType sessionEnergyDischarged = static_cast<int64_t>(0);
+        Attributes::SessionDuration::TypeInfo::DecodableType sessionDuration;
+        Attributes::SessionEnergyCharged::TypeInfo::DecodableType sessionEnergyCharged;
+        Attributes::SessionEnergyDischarged::TypeInfo::DecodableType sessionEnergyDischarged;
         Attributes::GeneratedCommandList::TypeInfo::DecodableType generatedCommandList;
         Attributes::AcceptedCommandList::TypeInfo::DecodableType acceptedCommandList;
         Attributes::EventList::TypeInfo::DecodableType eventList;
diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h
index 0394a481dd1300..810fe066011087 100644
--- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h
+++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h
@@ -19229,13 +19229,15 @@ void registerClusterEnergyEvse(Commands & commands, CredentialIssuerCommands * c
             Id, "vehicle-id", Attributes::VehicleID::Id, WriteCommandType::kForceWrite, credsIssuerConfig), //
         make_unique<WriteAttribute<chip::app::DataModel::Nullable<uint32_t>>>(
             Id, "session-id", 0, UINT32_MAX, Attributes::SessionID::Id, WriteCommandType::kForceWrite, credsIssuerConfig), //
-        make_unique<WriteAttribute<uint32_t>>(Id, "session-duration", 0, UINT32_MAX, Attributes::SessionDuration::Id,
-                                              WriteCommandType::kForceWrite, credsIssuerConfig), //
-        make_unique<WriteAttribute<int64_t>>(Id, "session-energy-charged", 0, UINT64_MAX, Attributes::SessionEnergyCharged::Id,
-                                             WriteCommandType::kForceWrite, credsIssuerConfig), //
-        make_unique<WriteAttribute<int64_t>>(Id, "session-energy-discharged", 0, UINT64_MAX,
-                                             Attributes::SessionEnergyDischarged::Id, WriteCommandType::kForceWrite,
-                                             credsIssuerConfig), //
+        make_unique<WriteAttribute<chip::app::DataModel::Nullable<uint32_t>>>(Id, "session-duration", 0, UINT32_MAX,
+                                                                              Attributes::SessionDuration::Id,
+                                                                              WriteCommandType::kForceWrite, credsIssuerConfig), //
+        make_unique<WriteAttribute<chip::app::DataModel::Nullable<int64_t>>>(Id, "session-energy-charged", 0, UINT64_MAX,
+                                                                             Attributes::SessionEnergyCharged::Id,
+                                                                             WriteCommandType::kForceWrite, credsIssuerConfig), //
+        make_unique<WriteAttribute<chip::app::DataModel::Nullable<int64_t>>>(Id, "session-energy-discharged", 0, UINT64_MAX,
+                                                                             Attributes::SessionEnergyDischarged::Id,
+                                                                             WriteCommandType::kForceWrite, credsIssuerConfig), //
         make_unique<WriteAttributeAsComplex<chip::app::DataModel::List<const chip::CommandId>>>(
             Id, "generated-command-list", Attributes::GeneratedCommandList::Id, WriteCommandType::kForceWrite,
             credsIssuerConfig), //
diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp
index 17bb154ec9319a..e62db3285e0603 100644
--- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp
+++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp
@@ -2601,13 +2601,15 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label,
     // Copy to track which members we already processed.
     Json::Value valueCopy(value);
 
-    ReturnErrorOnFailure(
-        ComplexArgumentParser::EnsureMemberExist("ChargingTargetStruct.targetTime", "targetTime", value.isMember("targetTime")));
+    ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ChargingTargetStruct.targetTimeMinutesPastMidnight",
+                                                                  "targetTimeMinutesPastMidnight",
+                                                                  value.isMember("targetTimeMinutesPastMidnight")));
 
     char labelWithMember[kMaxLabelLength];
-    snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "targetTime");
-    ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.targetTime, value["targetTime"]));
-    valueCopy.removeMember("targetTime");
+    snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "targetTimeMinutesPastMidnight");
+    ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.targetTimeMinutesPastMidnight,
+                                                      value["targetTimeMinutesPastMidnight"]));
+    valueCopy.removeMember("targetTimeMinutesPastMidnight");
 
     if (value.isMember("targetSoC"))
     {
@@ -2628,7 +2630,7 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label,
 
 void ComplexArgumentParser::Finalize(chip::app::Clusters::EnergyEvse::Structs::ChargingTargetStruct::Type & request)
 {
-    ComplexArgumentParser::Finalize(request.targetTime);
+    ComplexArgumentParser::Finalize(request.targetTimeMinutesPastMidnight);
     ComplexArgumentParser::Finalize(request.targetSoC);
     ComplexArgumentParser::Finalize(request.addedEnergy);
 }
diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp
index e055a0e282b46b..bdf5deeb960932 100644
--- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp
+++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp
@@ -2294,10 +2294,10 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent,
 {
     DataModelLogger::LogString(label, indent, "{");
     {
-        CHIP_ERROR err = LogValue("TargetTime", indent + 1, value.targetTime);
+        CHIP_ERROR err = LogValue("TargetTimeMinutesPastMidnight", indent + 1, value.targetTimeMinutesPastMidnight);
         if (err != CHIP_NO_ERROR)
         {
-            DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'TargetTime'");
+            DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'TargetTimeMinutesPastMidnight'");
             return err;
         }
     }
@@ -11192,17 +11192,17 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP
             return DataModelLogger::LogValue("SessionID", 1, value);
         }
         case EnergyEvse::Attributes::SessionDuration::Id: {
-            uint32_t value;
+            chip::app::DataModel::Nullable<uint32_t> value;
             ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value));
             return DataModelLogger::LogValue("SessionDuration", 1, value);
         }
         case EnergyEvse::Attributes::SessionEnergyCharged::Id: {
-            int64_t value;
+            chip::app::DataModel::Nullable<int64_t> value;
             ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value));
             return DataModelLogger::LogValue("SessionEnergyCharged", 1, value);
         }
         case EnergyEvse::Attributes::SessionEnergyDischarged::Id: {
-            int64_t value;
+            chip::app::DataModel::Nullable<int64_t> value;
             ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value));
             return DataModelLogger::LogValue("SessionEnergyDischarged", 1, value);
         }
diff --git a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h
index 41f6ff91c44f2a..f4932b5ab17288 100644
--- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h
+++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h
@@ -78011,7 +78011,7 @@ class EnergyEvseSetTargets : public ClusterCommand {
             for (auto & entry_0 : mRequest.chargingTargets) {
                 MTREnergyEVSEClusterChargingTargetStruct * newElement_0;
                 newElement_0 = [MTREnergyEVSEClusterChargingTargetStruct new];
-                newElement_0.targetTime = [NSNumber numberWithUnsignedShort:entry_0.targetTime];
+                newElement_0.targetTimeMinutesPastMidnight = [NSNumber numberWithUnsignedShort:entry_0.targetTimeMinutesPastMidnight];
                 if (entry_0.targetSoC.HasValue()) {
                     newElement_0.targetSoC = [NSNumber numberWithUnsignedChar:entry_0.targetSoC.Value()];
                 } else {

From 271031c45a50af8cdd8c796b4607de8fcaf6cd2f Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Thu, 7 Dec 2023 22:36:56 +0000
Subject: [PATCH 32/80] Made Fault Event allow a nullable SessionID

---
 .../all-clusters-common/all-clusters-app.matter |  2 +-
 .../energy-management-app.matter                |  2 +-
 .../zcl/data-model/chip/energy-evse-cluster.xml |  2 +-
 .../data_model/controller-clusters.matter       |  2 +-
 .../chip/devicecontroller/ChipEventStructs.java |  8 ++++----
 .../eventstructs/EnergyEvseClusterFaultEvent.kt | 16 +++++++++++++---
 .../eventstructs/EnergyEvseClusterFaultEvent.kt | 16 +++++++++++++---
 .../zap-generated/CHIPEventTLVValueDecoder.cpp  | 17 ++++++++++++-----
 src/controller/python/chip/clusters/Objects.py  |  4 ++--
 .../zap-generated/MTREventTLVValueDecoder.mm    |  8 ++++++--
 .../CHIP/zap-generated/MTRStructsObjc.h         |  2 +-
 .../CHIP/zap-generated/MTRStructsObjc.mm        |  2 +-
 .../app-common/zap-generated/cluster-objects.h  |  4 ++--
 13 files changed, 58 insertions(+), 27 deletions(-)

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 6360f50ad618c8..10e40f369720ca 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
@@ -3734,7 +3734,7 @@ provisional cluster EnergyEvse = 153 {
   }
 
   critical event Fault = 4 {
-    int32u sessionID = 0;
+    nullable int32u sessionID = 0;
     StateEnum state = 1;
     FaultStateEnum faultStatePreviousState = 2;
     FaultStateEnum faultStateCurrentState = 4;
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 f3f8c720f8edf7..c57d13e0e5c5df 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
@@ -1057,7 +1057,7 @@ provisional cluster EnergyEvse = 153 {
   }
 
   critical event Fault = 4 {
-    int32u sessionID = 0;
+    nullable int32u sessionID = 0;
     StateEnum state = 1;
     FaultStateEnum faultStatePreviousState = 2;
     FaultStateEnum faultStateCurrentState = 4;
diff --git a/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml
index 70cbb5bdfa8c58..f8925c73d7ce3c 100644
--- a/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml
+++ b/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml
@@ -196,7 +196,7 @@ limitations under the License.
     </event>
     <event code="0x0004" name="Fault" priority="critical" apiMaturity="provisional">
       <description>Fault</description>
-      <field id="0" name="SessionID" type="int32u" apiMaturity="provisional"/>
+      <field id="0" name="SessionID" type="int32u" isNullable="true" apiMaturity="provisional"/>
       <field id="1" name="State" type="StateEnum" apiMaturity="provisional"/>
       <field id="2" name="FaultStatePreviousState" type="FaultStateEnum" apiMaturity="provisional"/>
       <field id="4" name="FaultStateCurrentState" type="FaultStateEnum" apiMaturity="provisional"/>
diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter
index 2e5b1fe38a0c53..9a21c9ca7a88f8 100644
--- a/src/controller/data_model/controller-clusters.matter
+++ b/src/controller/data_model/controller-clusters.matter
@@ -4578,7 +4578,7 @@ provisional cluster EnergyEvse = 153 {
   }
 
   critical event Fault = 4 {
-    int32u sessionID = 0;
+    nullable int32u sessionID = 0;
     StateEnum state = 1;
     FaultStateEnum faultStatePreviousState = 2;
     FaultStateEnum faultStateCurrentState = 4;
diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipEventStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipEventStructs.java
index 256d205a09e8df..7ff238b4c1ce47 100644
--- a/src/controller/java/generated/java/chip/devicecontroller/ChipEventStructs.java
+++ b/src/controller/java/generated/java/chip/devicecontroller/ChipEventStructs.java
@@ -3637,7 +3637,7 @@ public String toString() {
   }
 }
 public static class EnergyEvseClusterFaultEvent {
-  public Long sessionID;
+  public @Nullable Long sessionID;
   public Integer state;
   public Integer faultStatePreviousState;
   public Integer faultStateCurrentState;
@@ -3647,7 +3647,7 @@ public static class EnergyEvseClusterFaultEvent {
   private static final long FAULT_STATE_CURRENT_STATE_ID = 4L;
 
   public EnergyEvseClusterFaultEvent(
-    Long sessionID,
+    @Nullable Long sessionID,
     Integer state,
     Integer faultStatePreviousState,
     Integer faultStateCurrentState
@@ -3660,7 +3660,7 @@ public EnergyEvseClusterFaultEvent(
 
   public StructType encodeTlv() {
     ArrayList<StructElement> values = new ArrayList<>();
-    values.add(new StructElement(SESSION_I_D_ID, new UIntType(sessionID)));
+    values.add(new StructElement(SESSION_I_D_ID, sessionID != null ? new UIntType(sessionID) : new NullType()));
     values.add(new StructElement(STATE_ID, new UIntType(state)));
     values.add(new StructElement(FAULT_STATE_PREVIOUS_STATE_ID, new UIntType(faultStatePreviousState)));
     values.add(new StructElement(FAULT_STATE_CURRENT_STATE_ID, new UIntType(faultStateCurrentState)));
@@ -3672,7 +3672,7 @@ public static EnergyEvseClusterFaultEvent decodeTlv(BaseTLVType tlvValue) {
     if (tlvValue == null || tlvValue.type() != TLVType.Struct) {
       return null;
     }
-    Long sessionID = null;
+    @Nullable Long sessionID = null;
     Integer state = null;
     Integer faultStatePreviousState = null;
     Integer faultStateCurrentState = null;
diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/EnergyEvseClusterFaultEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/EnergyEvseClusterFaultEvent.kt
index 2b82c363aa442c..53ca88273b038d 100644
--- a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/EnergyEvseClusterFaultEvent.kt
+++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/EnergyEvseClusterFaultEvent.kt
@@ -23,7 +23,7 @@ import matter.tlv.TlvReader
 import matter.tlv.TlvWriter
 
 class EnergyEvseClusterFaultEvent(
-  val sessionID: ULong,
+  val sessionID: ULong?,
   val state: UInt,
   val faultStatePreviousState: UInt,
   val faultStateCurrentState: UInt
@@ -40,7 +40,11 @@ class EnergyEvseClusterFaultEvent(
   fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) {
     tlvWriter.apply {
       startStructure(tlvTag)
-      put(ContextSpecificTag(TAG_SESSION_I_D), sessionID)
+      if (sessionID != null) {
+        put(ContextSpecificTag(TAG_SESSION_I_D), sessionID)
+      } else {
+        putNull(ContextSpecificTag(TAG_SESSION_I_D))
+      }
       put(ContextSpecificTag(TAG_STATE), state)
       put(ContextSpecificTag(TAG_FAULT_STATE_PREVIOUS_STATE), faultStatePreviousState)
       put(ContextSpecificTag(TAG_FAULT_STATE_CURRENT_STATE), faultStateCurrentState)
@@ -56,7 +60,13 @@ class EnergyEvseClusterFaultEvent(
 
     fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyEvseClusterFaultEvent {
       tlvReader.enterStructure(tlvTag)
-      val sessionID = tlvReader.getULong(ContextSpecificTag(TAG_SESSION_I_D))
+      val sessionID =
+        if (!tlvReader.isNull()) {
+          tlvReader.getULong(ContextSpecificTag(TAG_SESSION_I_D))
+        } else {
+          tlvReader.getNull(ContextSpecificTag(TAG_SESSION_I_D))
+          null
+        }
       val state = tlvReader.getUInt(ContextSpecificTag(TAG_STATE))
       val faultStatePreviousState =
         tlvReader.getUInt(ContextSpecificTag(TAG_FAULT_STATE_PREVIOUS_STATE))
diff --git a/src/controller/java/generated/java/matter/devicecontroller/cluster/eventstructs/EnergyEvseClusterFaultEvent.kt b/src/controller/java/generated/java/matter/devicecontroller/cluster/eventstructs/EnergyEvseClusterFaultEvent.kt
index 71cdcae9dc193f..8b8ad7814304d5 100644
--- a/src/controller/java/generated/java/matter/devicecontroller/cluster/eventstructs/EnergyEvseClusterFaultEvent.kt
+++ b/src/controller/java/generated/java/matter/devicecontroller/cluster/eventstructs/EnergyEvseClusterFaultEvent.kt
@@ -23,7 +23,7 @@ import matter.tlv.TlvReader
 import matter.tlv.TlvWriter
 
 class EnergyEvseClusterFaultEvent(
-  val sessionID: UInt,
+  val sessionID: UInt?,
   val state: UInt,
   val faultStatePreviousState: UInt,
   val faultStateCurrentState: UInt
@@ -40,7 +40,11 @@ class EnergyEvseClusterFaultEvent(
   fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) {
     tlvWriter.apply {
       startStructure(tlvTag)
-      put(ContextSpecificTag(TAG_SESSION_I_D), sessionID)
+      if (sessionID != null) {
+        put(ContextSpecificTag(TAG_SESSION_I_D), sessionID)
+      } else {
+        putNull(ContextSpecificTag(TAG_SESSION_I_D))
+      }
       put(ContextSpecificTag(TAG_STATE), state)
       put(ContextSpecificTag(TAG_FAULT_STATE_PREVIOUS_STATE), faultStatePreviousState)
       put(ContextSpecificTag(TAG_FAULT_STATE_CURRENT_STATE), faultStateCurrentState)
@@ -56,7 +60,13 @@ class EnergyEvseClusterFaultEvent(
 
     fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyEvseClusterFaultEvent {
       tlvReader.enterStructure(tlvTag)
-      val sessionID = tlvReader.getUInt(ContextSpecificTag(TAG_SESSION_I_D))
+      val sessionID =
+        if (!tlvReader.isNull()) {
+          tlvReader.getUInt(ContextSpecificTag(TAG_SESSION_I_D))
+        } else {
+          tlvReader.getNull(ContextSpecificTag(TAG_SESSION_I_D))
+          null
+        }
       val state = tlvReader.getUInt(ContextSpecificTag(TAG_STATE))
       val faultStatePreviousState =
         tlvReader.getUInt(ContextSpecificTag(TAG_FAULT_STATE_PREVIOUS_STATE))
diff --git a/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp
index 4b67ac79cd7b9f..ae2f9cc55de230 100644
--- a/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp
+++ b/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp
@@ -4674,11 +4674,18 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader &
                 return nullptr;
             }
             jobject value_sessionID;
-            std::string value_sessionIDClassName     = "java/lang/Long";
-            std::string value_sessionIDCtorSignature = "(J)V";
-            jlong jnivalue_sessionID                 = static_cast<jlong>(cppValue.sessionID);
-            chip::JniReferences::GetInstance().CreateBoxedObject<jlong>(
-                value_sessionIDClassName.c_str(), value_sessionIDCtorSignature.c_str(), jnivalue_sessionID, value_sessionID);
+            if (cppValue.sessionID.IsNull())
+            {
+                value_sessionID = nullptr;
+            }
+            else
+            {
+                std::string value_sessionIDClassName     = "java/lang/Long";
+                std::string value_sessionIDCtorSignature = "(J)V";
+                jlong jnivalue_sessionID                 = static_cast<jlong>(cppValue.sessionID.Value());
+                chip::JniReferences::GetInstance().CreateBoxedObject<jlong>(
+                    value_sessionIDClassName.c_str(), value_sessionIDCtorSignature.c_str(), jnivalue_sessionID, value_sessionID);
+            }
 
             jobject value_state;
             std::string value_stateClassName     = "java/lang/Integer";
diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py
index be6d5760631413..1ae0fc2c88dcb9 100644
--- a/src/controller/python/chip/clusters/Objects.py
+++ b/src/controller/python/chip/clusters/Objects.py
@@ -24331,13 +24331,13 @@ def event_id(cls) -> int:
             def descriptor(cls) -> ClusterObjectDescriptor:
                 return ClusterObjectDescriptor(
                     Fields=[
-                        ClusterObjectFieldDescriptor(Label="sessionID", Tag=0, Type=uint),
+                        ClusterObjectFieldDescriptor(Label="sessionID", Tag=0, Type=typing.Union[Nullable, uint]),
                         ClusterObjectFieldDescriptor(Label="state", Tag=1, Type=EnergyEvse.Enums.StateEnum),
                         ClusterObjectFieldDescriptor(Label="faultStatePreviousState", Tag=2, Type=EnergyEvse.Enums.FaultStateEnum),
                         ClusterObjectFieldDescriptor(Label="faultStateCurrentState", Tag=4, Type=EnergyEvse.Enums.FaultStateEnum),
                     ])
 
-            sessionID: 'uint' = 0
+            sessionID: 'typing.Union[Nullable, uint]' = NullValue
             state: 'EnergyEvse.Enums.StateEnum' = 0
             faultStatePreviousState: 'EnergyEvse.Enums.FaultStateEnum' = 0
             faultStateCurrentState: 'EnergyEvse.Enums.FaultStateEnum' = 0
diff --git a/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm
index 5912d3d8d6454e..52718596207915 100644
--- a/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm
+++ b/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm
@@ -2822,8 +2822,12 @@ static id _Nullable DecodeEventPayloadForEnergyEVSECluster(EventId aEventId, TLV
         __auto_type * value = [MTREnergyEVSEClusterFaultEvent new];
 
         do {
-            NSNumber * _Nonnull memberValue;
-            memberValue = [NSNumber numberWithUnsignedInt:cppValue.sessionID];
+            NSNumber * _Nullable memberValue;
+            if (cppValue.sessionID.IsNull()) {
+                memberValue = nil;
+            } else {
+                memberValue = [NSNumber numberWithUnsignedInt:cppValue.sessionID.Value()];
+            }
             value.sessionID = memberValue;
         } while (0);
         do {
diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h
index 8fa9df1305c929..dc78dba69a2294 100644
--- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h
+++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h
@@ -1269,7 +1269,7 @@ MTR_PROVISIONALLY_AVAILABLE
 
 MTR_PROVISIONALLY_AVAILABLE
 @interface MTREnergyEVSEClusterFaultEvent : NSObject <NSCopying>
-@property (nonatomic, copy) NSNumber * _Nonnull sessionID MTR_PROVISIONALLY_AVAILABLE;
+@property (nonatomic, copy) NSNumber * _Nullable sessionID MTR_PROVISIONALLY_AVAILABLE;
 @property (nonatomic, copy) NSNumber * _Nonnull state MTR_PROVISIONALLY_AVAILABLE;
 @property (nonatomic, copy) NSNumber * _Nonnull faultStatePreviousState MTR_PROVISIONALLY_AVAILABLE;
 @property (nonatomic, copy) NSNumber * _Nonnull faultStateCurrentState MTR_PROVISIONALLY_AVAILABLE;
diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm
index 9a97f4d1b12dcc..67ac4a903cb0ac 100644
--- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm
+++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm
@@ -5185,7 +5185,7 @@ - (instancetype)init
 {
     if (self = [super init]) {
 
-        _sessionID = @(0);
+        _sessionID = nil;
 
         _state = @(0);
 
diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h
index 7e2712c4d5fd1b..f0959a4c8fa48b 100644
--- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h
+++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h
@@ -22443,7 +22443,7 @@ struct Type
     static constexpr ClusterId GetClusterId() { return Clusters::EnergyEvse::Id; }
     static constexpr bool kIsFabricScoped = false;
 
-    uint32_t sessionID                     = static_cast<uint32_t>(0);
+    DataModel::Nullable<uint32_t> sessionID;
     StateEnum state                        = static_cast<StateEnum>(0);
     FaultStateEnum faultStatePreviousState = static_cast<FaultStateEnum>(0);
     FaultStateEnum faultStateCurrentState  = static_cast<FaultStateEnum>(0);
@@ -22458,7 +22458,7 @@ struct DecodableType
     static constexpr EventId GetEventId() { return Events::Fault::Id; }
     static constexpr ClusterId GetClusterId() { return Clusters::EnergyEvse::Id; }
 
-    uint32_t sessionID                     = static_cast<uint32_t>(0);
+    DataModel::Nullable<uint32_t> sessionID;
     StateEnum state                        = static_cast<StateEnum>(0);
     FaultStateEnum faultStatePreviousState = static_cast<FaultStateEnum>(0);
     FaultStateEnum faultStateCurrentState  = static_cast<FaultStateEnum>(0);

From b886c716c287caa6bc2b225a08b6783d7c2aba6e Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Sat, 9 Dec 2023 21:20:39 +0000
Subject: [PATCH 33/80] Updates based on review (use kMaximumChargeCurrent
 instead of duplicate #define). Add HwSetVehicleID implementation

---
 .../include/EnergyEvseDelegateImpl.h          | 20 +++++++-------
 .../src/EnergyEvseDelegateImpl.cpp            | 27 ++++++++++++++-----
 .../include/EnergyEvseDelegateImpl.h          | 20 +++++++-------
 .../src/EVSEManufacturerImpl.cpp              | 12 ++++++---
 .../src/EnergyEvseDelegateImpl.cpp            | 27 ++++++++++++++-----
 .../energy-evse-server/energy-evse-server.cpp |  8 +++---
 .../energy-evse-server/energy-evse-server.h   |  9 +++----
 7 files changed, 76 insertions(+), 47 deletions(-)

diff --git a/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h b/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h
index e1494c907f8a84..cbe5468440c60c 100644
--- a/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h
+++ b/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h
@@ -49,8 +49,8 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate
      * @param minimumChargeCurrent (in mA)
      * @param maximumChargeCurrent (in mA)
      */
-    Status EnableCharging(const chip::app::DataModel::Nullable<uint32_t> & chargingEnabledUntil,
-                          const int64_t & minimumChargeCurrent, const int64_t & maximumChargeCurrent) override;
+    Status EnableCharging(const DataModel::Nullable<uint32_t> & chargingEnabledUntil, const int64_t & minimumChargeCurrent,
+                          const int64_t & maximumChargeCurrent) override;
 
     /**
      * @brief   Called when EVSE cluster receives EnableDischarging command
@@ -58,7 +58,7 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate
      * @param dischargingEnabledUntil
      * @param maximumChargeCurrent (in mA)
      */
-    Status EnableDischarging(const chip::app::DataModel::Nullable<uint32_t> & dischargingEnabledUntil,
+    Status EnableDischarging(const DataModel::Nullable<uint32_t> & dischargingEnabledUntil,
                              const int64_t & maximumDischargeCurrent) override;
 
     /**
@@ -74,6 +74,8 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate
     Status HwSetCableAssemblyLimit(int64_t currentmA);
     Status HwSetState(StateEnum state);
     Status HwSetFault(FaultStateEnum fault);
+    Status HwSetRFID(chip::CharSpan RFID);
+    Status HwSetVehicleID(chip::CharSpan);
 
     // ------------------------------------------------------------------
     // Get attribute methods
@@ -125,7 +127,7 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate
     DataModel::Nullable<chip::Percent> GetStateOfCharge() override;
     DataModel::Nullable<int64_t> GetBatteryCapacity() override;
     /* PNC attributes*/
-    char * GetVehicleID() override;
+    DataModel::Nullable<chip::CharSpan> GetVehicleID() override;
     /* Session SESS attributes */
     DataModel::Nullable<uint32_t> GetSessionID() override;
     DataModel::Nullable<uint32_t> GetSessionDuration() override;
@@ -134,11 +136,9 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate
 
 private:
     /* Constants */
-    static constexpr int MAX_CURRENT_LOWER_BOUND             = 0;
-    static constexpr int MAX_CURRENT_UPPER_BOUND             = 80000;
-    static constexpr int DEFAULT_MIN_CHARGE_CURRENT          = 6000;  /* 6A */
-    static constexpr int DEFAULT_USER_MAXIMUM_CHARGE_CURRENT = 80000; /* 80A */
-    static constexpr int DEFAULT_RANDOMIZATION_DELAY_WINDOW  = 600;   /* 600s */
+    static constexpr int DEFAULT_MIN_CHARGE_CURRENT          = 6000;                  /* 6A */
+    static constexpr int DEFAULT_USER_MAXIMUM_CHARGE_CURRENT = kMaximumChargeCurrent; /* 80A */
+    static constexpr int DEFAULT_RANDOMIZATION_DELAY_WINDOW  = 600;                   /* 600s */
 
     /* private variables for controlling the hardware - these are not attributes */
     int64_t mMaxHardwareCurrentLimit                = 0; /* Hardware current limit in mA */
@@ -178,7 +178,7 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate
     DataModel::Nullable<int64_t> mBatteryCapacity;
 
     /* PNC attributes*/
-    char * mVehicleID;
+    DataModel::Nullable<chip::CharSpan> mVehicleID;
 
     /* Session SESS attributes */
     DataModel::Nullable<uint32_t> mSessionID;
diff --git a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
index 87c1eb37ce35e2..de8aafdbc2cb01 100644
--- a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
+++ b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
@@ -88,13 +88,13 @@ Status EnergyEvseDelegate::EnableCharging(const chip::app::DataModel::Nullable<u
 {
     ChipLogProgress(AppServer, "EnergyEvseDelegate::EnableCharging()");
 
-    if (maximumChargeCurrent < MAX_CURRENT_LOWER_BOUND || maximumChargeCurrent > MAX_CURRENT_UPPER_BOUND)
+    if (maximumChargeCurrent < kMinimumChargeCurrent || maximumChargeCurrent > kMaximumChargeCurrent)
     {
         ChipLogError(NotSpecified, "Maximum Current outside limits");
         return Status::ConstraintError;
     }
 
-    if (minimumChargeCurrent < MAX_CURRENT_LOWER_BOUND || minimumChargeCurrent > MAX_CURRENT_UPPER_BOUND)
+    if (minimumChargeCurrent < kMinimumChargeCurrent || minimumChargeCurrent > kMaximumChargeCurrent)
     {
         ChipLogError(NotSpecified, "Maximum Current outside limits");
         return Status::ConstraintError;
@@ -227,7 +227,7 @@ Status EnergyEvseDelegate::HwRegisterEvseHardwareCallback(int Callback) // TODO
  */
 Status EnergyEvseDelegate::HwSetMaxHardwareCurrentLimit(int64_t currentmA)
 {
-    if (currentmA < MAX_CURRENT_LOWER_BOUND || currentmA > MAX_CURRENT_UPPER_BOUND)
+    if (currentmA < kMinimumChargeCurrent || currentmA > kMaximumChargeCurrent)
     {
         return Status::ConstraintError;
     }
@@ -249,7 +249,7 @@ Status EnergyEvseDelegate::HwSetMaxHardwareCurrentLimit(int64_t currentmA)
  */
 Status EnergyEvseDelegate::HwSetCircuitCapacity(int64_t currentmA)
 {
-    if (currentmA < MAX_CURRENT_LOWER_BOUND || currentmA > MAX_CURRENT_UPPER_BOUND)
+    if (currentmA < kMinimumChargeCurrent || currentmA > kMaximumChargeCurrent)
     {
         return Status::ConstraintError;
     }
@@ -274,7 +274,7 @@ Status EnergyEvseDelegate::HwSetCircuitCapacity(int64_t currentmA)
  */
 Status EnergyEvseDelegate::HwSetCableAssemblyLimit(int64_t currentmA)
 {
-    if (currentmA < MAX_CURRENT_LOWER_BOUND || currentmA > MAX_CURRENT_UPPER_BOUND)
+    if (currentmA < kMinimumChargeCurrent || currentmA > kMaximumChargeCurrent)
     {
         return Status::ConstraintError;
     }
@@ -352,6 +352,20 @@ Status EnergyEvseDelegate::HwSetFault(FaultStateEnum fault)
     return Status::Success;
 }
 
+Status EnergyEvseDelegate::HwSetVehicleID(chip::CharSpan newValue)
+{
+    DataModel::Nullable<chip::CharSpan> oldValue = mVehicleID;
+
+    mVehicleID = MakeNullable(newValue);
+    if ((oldValue.IsNull()) || (strcmp(mVehicleID.Value().data(), oldValue.Value().data())))
+    {
+        ChipLogDetail(AppServer, "VehicleID updated to %s", mVehicleID.Value().data());
+        MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, VehicleID::Id);
+    }
+
+    return Status::Success;
+}
+
 /* ---------------------------------------------------------------------------
  * Functions below are private helper functions internal to the delegate
  */
@@ -689,9 +703,8 @@ DataModel::Nullable<int64_t> EnergyEvseDelegate::GetBatteryCapacity()
 }
 
 /* PNC attributes*/
-char * EnergyEvseDelegate::GetVehicleID()
+DataModel::Nullable<chip::CharSpan> EnergyEvseDelegate::GetVehicleID()
 {
-    // TODO handle this properly
     return mVehicleID;
 }
 
diff --git a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h
index e1494c907f8a84..cbe5468440c60c 100644
--- a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h
+++ b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h
@@ -49,8 +49,8 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate
      * @param minimumChargeCurrent (in mA)
      * @param maximumChargeCurrent (in mA)
      */
-    Status EnableCharging(const chip::app::DataModel::Nullable<uint32_t> & chargingEnabledUntil,
-                          const int64_t & minimumChargeCurrent, const int64_t & maximumChargeCurrent) override;
+    Status EnableCharging(const DataModel::Nullable<uint32_t> & chargingEnabledUntil, const int64_t & minimumChargeCurrent,
+                          const int64_t & maximumChargeCurrent) override;
 
     /**
      * @brief   Called when EVSE cluster receives EnableDischarging command
@@ -58,7 +58,7 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate
      * @param dischargingEnabledUntil
      * @param maximumChargeCurrent (in mA)
      */
-    Status EnableDischarging(const chip::app::DataModel::Nullable<uint32_t> & dischargingEnabledUntil,
+    Status EnableDischarging(const DataModel::Nullable<uint32_t> & dischargingEnabledUntil,
                              const int64_t & maximumDischargeCurrent) override;
 
     /**
@@ -74,6 +74,8 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate
     Status HwSetCableAssemblyLimit(int64_t currentmA);
     Status HwSetState(StateEnum state);
     Status HwSetFault(FaultStateEnum fault);
+    Status HwSetRFID(chip::CharSpan RFID);
+    Status HwSetVehicleID(chip::CharSpan);
 
     // ------------------------------------------------------------------
     // Get attribute methods
@@ -125,7 +127,7 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate
     DataModel::Nullable<chip::Percent> GetStateOfCharge() override;
     DataModel::Nullable<int64_t> GetBatteryCapacity() override;
     /* PNC attributes*/
-    char * GetVehicleID() override;
+    DataModel::Nullable<chip::CharSpan> GetVehicleID() override;
     /* Session SESS attributes */
     DataModel::Nullable<uint32_t> GetSessionID() override;
     DataModel::Nullable<uint32_t> GetSessionDuration() override;
@@ -134,11 +136,9 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate
 
 private:
     /* Constants */
-    static constexpr int MAX_CURRENT_LOWER_BOUND             = 0;
-    static constexpr int MAX_CURRENT_UPPER_BOUND             = 80000;
-    static constexpr int DEFAULT_MIN_CHARGE_CURRENT          = 6000;  /* 6A */
-    static constexpr int DEFAULT_USER_MAXIMUM_CHARGE_CURRENT = 80000; /* 80A */
-    static constexpr int DEFAULT_RANDOMIZATION_DELAY_WINDOW  = 600;   /* 600s */
+    static constexpr int DEFAULT_MIN_CHARGE_CURRENT          = 6000;                  /* 6A */
+    static constexpr int DEFAULT_USER_MAXIMUM_CHARGE_CURRENT = kMaximumChargeCurrent; /* 80A */
+    static constexpr int DEFAULT_RANDOMIZATION_DELAY_WINDOW  = 600;                   /* 600s */
 
     /* private variables for controlling the hardware - these are not attributes */
     int64_t mMaxHardwareCurrentLimit                = 0; /* Hardware current limit in mA */
@@ -178,7 +178,7 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate
     DataModel::Nullable<int64_t> mBatteryCapacity;
 
     /* PNC attributes*/
-    char * mVehicleID;
+    DataModel::Nullable<chip::CharSpan> mVehicleID;
 
     /* Session SESS attributes */
     DataModel::Nullable<uint32_t> mSessionID;
diff --git a/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp b/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp
index 55dfece7312060..34ac1146c33e2a 100644
--- a/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp
+++ b/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp
@@ -28,18 +28,22 @@ CHIP_ERROR EVSEManufacturer::Init(EnergyEvseManager * aInstance)
     /* Manufacturers should modify this to do any custom initialisation */
 
     /* Register callbacks */
+    EnergyEvseDelegate * dg = aInstance->GetDelegate();
     // TODO EnergyEvseManager::GetInstance()->GetDelegate()->RegisterCallbacks();
 
     /* Set the EVSE Hardware Maximum current limit */
     // For Manufacturer to specify the hardware capability in mA
-    aInstance->GetDelegate()->HwSetMaxHardwareCurrentLimit(32000);
+    dg->HwSetMaxHardwareCurrentLimit(32000);
 
     // For Manufacturer to specify the CircuitCapacity (e.g. from DIP switches)
-    aInstance->GetDelegate()->HwSetCircuitCapacity(20000);
+    dg->HwSetCircuitCapacity(20000);
 
     /* For now let's pretend the EV is plugged in, and asking for demand */
-    aInstance->GetDelegate()->HwSetState(StateEnum::kPluggedInDemand);
-    aInstance->GetDelegate()->HwSetCableAssemblyLimit(63000);
+    dg->HwSetState(StateEnum::kPluggedInDemand);
+    dg->HwSetCableAssemblyLimit(63000);
+
+    /* For now let's pretend the vehicle ID is set */
+    dg->HwSetVehicleID(CharSpan("TEST_VEHICLE_123456789", 22));
 
     return CHIP_NO_ERROR;
 }
diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
index 87c1eb37ce35e2..de8aafdbc2cb01 100644
--- a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
+++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
@@ -88,13 +88,13 @@ Status EnergyEvseDelegate::EnableCharging(const chip::app::DataModel::Nullable<u
 {
     ChipLogProgress(AppServer, "EnergyEvseDelegate::EnableCharging()");
 
-    if (maximumChargeCurrent < MAX_CURRENT_LOWER_BOUND || maximumChargeCurrent > MAX_CURRENT_UPPER_BOUND)
+    if (maximumChargeCurrent < kMinimumChargeCurrent || maximumChargeCurrent > kMaximumChargeCurrent)
     {
         ChipLogError(NotSpecified, "Maximum Current outside limits");
         return Status::ConstraintError;
     }
 
-    if (minimumChargeCurrent < MAX_CURRENT_LOWER_BOUND || minimumChargeCurrent > MAX_CURRENT_UPPER_BOUND)
+    if (minimumChargeCurrent < kMinimumChargeCurrent || minimumChargeCurrent > kMaximumChargeCurrent)
     {
         ChipLogError(NotSpecified, "Maximum Current outside limits");
         return Status::ConstraintError;
@@ -227,7 +227,7 @@ Status EnergyEvseDelegate::HwRegisterEvseHardwareCallback(int Callback) // TODO
  */
 Status EnergyEvseDelegate::HwSetMaxHardwareCurrentLimit(int64_t currentmA)
 {
-    if (currentmA < MAX_CURRENT_LOWER_BOUND || currentmA > MAX_CURRENT_UPPER_BOUND)
+    if (currentmA < kMinimumChargeCurrent || currentmA > kMaximumChargeCurrent)
     {
         return Status::ConstraintError;
     }
@@ -249,7 +249,7 @@ Status EnergyEvseDelegate::HwSetMaxHardwareCurrentLimit(int64_t currentmA)
  */
 Status EnergyEvseDelegate::HwSetCircuitCapacity(int64_t currentmA)
 {
-    if (currentmA < MAX_CURRENT_LOWER_BOUND || currentmA > MAX_CURRENT_UPPER_BOUND)
+    if (currentmA < kMinimumChargeCurrent || currentmA > kMaximumChargeCurrent)
     {
         return Status::ConstraintError;
     }
@@ -274,7 +274,7 @@ Status EnergyEvseDelegate::HwSetCircuitCapacity(int64_t currentmA)
  */
 Status EnergyEvseDelegate::HwSetCableAssemblyLimit(int64_t currentmA)
 {
-    if (currentmA < MAX_CURRENT_LOWER_BOUND || currentmA > MAX_CURRENT_UPPER_BOUND)
+    if (currentmA < kMinimumChargeCurrent || currentmA > kMaximumChargeCurrent)
     {
         return Status::ConstraintError;
     }
@@ -352,6 +352,20 @@ Status EnergyEvseDelegate::HwSetFault(FaultStateEnum fault)
     return Status::Success;
 }
 
+Status EnergyEvseDelegate::HwSetVehicleID(chip::CharSpan newValue)
+{
+    DataModel::Nullable<chip::CharSpan> oldValue = mVehicleID;
+
+    mVehicleID = MakeNullable(newValue);
+    if ((oldValue.IsNull()) || (strcmp(mVehicleID.Value().data(), oldValue.Value().data())))
+    {
+        ChipLogDetail(AppServer, "VehicleID updated to %s", mVehicleID.Value().data());
+        MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, VehicleID::Id);
+    }
+
+    return Status::Success;
+}
+
 /* ---------------------------------------------------------------------------
  * Functions below are private helper functions internal to the delegate
  */
@@ -689,9 +703,8 @@ DataModel::Nullable<int64_t> EnergyEvseDelegate::GetBatteryCapacity()
 }
 
 /* PNC attributes*/
-char * EnergyEvseDelegate::GetVehicleID()
+DataModel::Nullable<chip::CharSpan> EnergyEvseDelegate::GetVehicleID()
 {
-    // TODO handle this properly
     return mVehicleID;
 }
 
diff --git a/src/app/clusters/energy-evse-server/energy-evse-server.cpp b/src/app/clusters/energy-evse-server/energy-evse-server.cpp
index 6b2fd1977f7875..5d6b8f54c90178 100644
--- a/src/app/clusters/energy-evse-server/energy-evse-server.cpp
+++ b/src/app/clusters/energy-evse-server/energy-evse-server.cpp
@@ -108,7 +108,7 @@ CHIP_ERROR Instance::Read(const ConcreteReadAttributePath & aPath, AttributeValu
 
     /* PNC attributes*/
     case VehicleID::Id:
-        // TODO return aEncoder.Encode(mDelegate.GetVehicleID());
+        return aEncoder.Encode(mDelegate.GetVehicleID());
 
     /* Session SESS attributes */
     case SessionID::Id:
@@ -233,13 +233,13 @@ void Instance::HandleEnableCharging(HandlerContext & ctx, const Commands::Enable
     auto & minimumChargeCurrent = commandData.minimumChargeCurrent;
     auto & maximumChargeCurrent = commandData.maximumChargeCurrent;
 
-    if ((minimumChargeCurrent < 0) || (minimumChargeCurrent > kMaximumChargeCurrent))
+    if ((minimumChargeCurrent < kMinimumChargeCurrent) || (minimumChargeCurrent > kMaximumChargeCurrent))
     {
         ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError);
         return;
     }
 
-    if ((maximumChargeCurrent < 0) || (maximumChargeCurrent > kMaximumChargeCurrent))
+    if ((maximumChargeCurrent < kMinimumChargeCurrent) || (maximumChargeCurrent > kMaximumChargeCurrent))
     {
         ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError);
         return;
@@ -263,7 +263,7 @@ void Instance::HandleEnableDischarging(HandlerContext & ctx, const Commands::Ena
     auto & dischargingEnabledUntil = commandData.dischargingEnabledUntil;
     auto & maximumDischargeCurrent = commandData.maximumDischargeCurrent;
 
-    if ((maximumDischargeCurrent < 0) || (maximumDischargeCurrent > kMaximumChargeCurrent))
+    if ((maximumDischargeCurrent < kMinimumChargeCurrent) || (maximumDischargeCurrent > kMaximumChargeCurrent))
     {
         ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError);
         return;
diff --git a/src/app/clusters/energy-evse-server/energy-evse-server.h b/src/app/clusters/energy-evse-server/energy-evse-server.h
index 6422787201e1a6..397d3a6bdc3f19 100644
--- a/src/app/clusters/energy-evse-server/energy-evse-server.h
+++ b/src/app/clusters/energy-evse-server/energy-evse-server.h
@@ -61,15 +61,15 @@ class Delegate
      * It should report Status::Success if successful and may
      * return other Status codes if it fails
      */
-    virtual Status EnableCharging(const chip::app::DataModel::Nullable<uint32_t> & enableChargeTime,
-                                  const int64_t & minimumChargeCurrent, const int64_t & maximumChargeCurrent) = 0;
+    virtual Status EnableCharging(const DataModel::Nullable<uint32_t> & enableChargeTime, const int64_t & minimumChargeCurrent,
+                                  const int64_t & maximumChargeCurrent) = 0;
 
     /**
      * @brief Delegate should implement a handler to enable EVSE Discharging.
      * It should report Status::Success if successful and may
      * return other Status codes if it fails
      */
-    virtual Status EnableDischarging(const chip::app::DataModel::Nullable<uint32_t> & enableDischargeTime,
+    virtual Status EnableDischarging(const DataModel::Nullable<uint32_t> & enableDischargeTime,
                                      const int64_t & maximumDischargeCurrent) = 0;
 
     /**
@@ -106,8 +106,7 @@ class Delegate
     virtual DataModel::Nullable<int64_t> GetBatteryCapacity()     = 0;
 
     /* PNC attributes*/
-    // TODO make nullable
-    virtual char * GetVehicleID() = 0;
+    virtual DataModel::Nullable<chip::CharSpan> GetVehicleID() = 0;
 
     /* Session SESS attributes */
     virtual DataModel::Nullable<uint32_t> GetSessionID()              = 0;

From adbb15e4dd8a638dfe5e2f6f30ca395d4ebb104d Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Sat, 9 Dec 2023 21:59:58 +0000
Subject: [PATCH 34/80] Added RFID Event support. Removed more unnecessary
 chip::

---
 .../include/EnergyEvseDelegateImpl.h          | 16 +++----
 .../src/EnergyEvseDelegateImpl.cpp            | 43 +++++++++++++++----
 .../include/EnergyEvseDelegateImpl.h          | 16 +++----
 .../src/EVSEManufacturerImpl.cpp              |  4 ++
 .../src/EnergyEvseDelegateImpl.cpp            | 43 +++++++++++++++----
 5 files changed, 88 insertions(+), 34 deletions(-)

diff --git a/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h b/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h
index cbe5468440c60c..6f2d8fda8b63cf 100644
--- a/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h
+++ b/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h
@@ -74,8 +74,8 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate
     Status HwSetCableAssemblyLimit(int64_t currentmA);
     Status HwSetState(StateEnum state);
     Status HwSetFault(FaultStateEnum fault);
-    Status HwSetRFID(chip::CharSpan RFID);
-    Status HwSetVehicleID(chip::CharSpan);
+    Status HwSetRFID(ByteSpan uid);
+    Status HwSetVehicleID(CharSpan vehID);
 
     // ------------------------------------------------------------------
     // Get attribute methods
@@ -118,16 +118,16 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate
     DataModel::Nullable<uint32_t> GetNextChargeStartTime() override;
     DataModel::Nullable<uint32_t> GetNextChargeTargetTime() override;
     DataModel::Nullable<int64_t> GetNextChargeRequiredEnergy() override;
-    DataModel::Nullable<chip::Percent> GetNextChargeTargetSoC() override;
+    DataModel::Nullable<Percent> GetNextChargeTargetSoC() override;
 
     DataModel::Nullable<uint16_t> GetApproximateEVEfficiency() override;
     CHIP_ERROR SetApproximateEVEfficiency(uint16_t) override;
 
     /* SOC attributes */
-    DataModel::Nullable<chip::Percent> GetStateOfCharge() override;
+    DataModel::Nullable<Percent> GetStateOfCharge() override;
     DataModel::Nullable<int64_t> GetBatteryCapacity() override;
     /* PNC attributes*/
-    DataModel::Nullable<chip::CharSpan> GetVehicleID() override;
+    DataModel::Nullable<CharSpan> GetVehicleID() override;
     /* Session SESS attributes */
     DataModel::Nullable<uint32_t> GetSessionID() override;
     DataModel::Nullable<uint32_t> GetSessionDuration() override;
@@ -170,15 +170,15 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate
     DataModel::Nullable<uint32_t> mNextChargeStartTime;
     DataModel::Nullable<uint32_t> mNextChargeTargetTime;
     DataModel::Nullable<int64_t> mNextChargeRequiredEnergy;
-    DataModel::Nullable<chip::Percent> mNextChargeTargetSoC;
+    DataModel::Nullable<Percent> mNextChargeTargetSoC;
     DataModel::Nullable<uint16_t> mApproximateEVEfficiency;
 
     /* SOC attributes */
-    DataModel::Nullable<chip::Percent> mStateOfCharge;
+    DataModel::Nullable<Percent> mStateOfCharge;
     DataModel::Nullable<int64_t> mBatteryCapacity;
 
     /* PNC attributes*/
-    DataModel::Nullable<chip::CharSpan> mVehicleID;
+    DataModel::Nullable<CharSpan> mVehicleID;
 
     /* Session SESS attributes */
     DataModel::Nullable<uint32_t> mSessionID;
diff --git a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
index de8aafdbc2cb01..00b4563438069d 100644
--- a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
+++ b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
@@ -19,16 +19,18 @@
 #include <EnergyEvseDelegateImpl.h>
 #include <app-common/zap-generated/attributes/Accessors.h>
 #include <app-common/zap-generated/cluster-objects.h>
+#include <app/EventLogging.h>
 
 using namespace chip;
-using chip::Protocols::InteractionModel::Status;
-
 using namespace chip::app;
 using namespace chip::app::DataModel;
 using namespace chip::app::Clusters;
 using namespace chip::app::Clusters::EnergyEvse;
 using namespace chip::app::Clusters::EnergyEvse::Attributes;
 
+using chip::app::LogEvent;
+using chip::Protocols::InteractionModel::Status;
+
 /**
  * @brief   Called when EVSE cluster receives Disable command
  */
@@ -83,7 +85,7 @@ Status EnergyEvseDelegate::Disable()
  * @param minimumChargeCurrent (in mA)
  * @param maximumChargeCurrent (in mA)
  */
-Status EnergyEvseDelegate::EnableCharging(const chip::app::DataModel::Nullable<uint32_t> & chargingEnabledUntil,
+Status EnergyEvseDelegate::EnableCharging(const DataModel::Nullable<uint32_t> & chargingEnabledUntil,
                                           const int64_t & minimumChargeCurrent, const int64_t & maximumChargeCurrent)
 {
     ChipLogProgress(AppServer, "EnergyEvseDelegate::EnableCharging()");
@@ -163,7 +165,7 @@ Status EnergyEvseDelegate::EnableCharging(const chip::app::DataModel::Nullable<u
  * @param dischargingEnabledUntil (can be null to indefinite discharging)
  * @param maximumChargeCurrent (in mA)
  */
-Status EnergyEvseDelegate::EnableDischarging(const chip::app::DataModel::Nullable<uint32_t> & dischargingEnabledUntil,
+Status EnergyEvseDelegate::EnableDischarging(const DataModel::Nullable<uint32_t> & dischargingEnabledUntil,
                                              const int64_t & maximumDischargeCurrent)
 {
     ChipLogProgress(AppServer, "EnergyEvseDelegate::EnableDischarging() called.");
@@ -352,9 +354,32 @@ Status EnergyEvseDelegate::HwSetFault(FaultStateEnum fault)
     return Status::Success;
 }
 
-Status EnergyEvseDelegate::HwSetVehicleID(chip::CharSpan newValue)
+/**
+ * @brief    Called by EVSE Hardware to Send a RFID event
+ *
+ * @param    ByteSpan RFID tag value (max 10 octets)
+ */
+Status EnergyEvseDelegate::HwSetRFID(ByteSpan uid)
+{
+    Events::Rfid::Type event{ .uid = uid };
+    EventNumber eventNumber;
+    CHIP_ERROR error = LogEvent(event, mEndpointId, eventNumber);
+    if (CHIP_NO_ERROR != error)
+    {
+        ChipLogError(Zcl, "[Notify] Unable to send notify event: %s [endpointId=%d]", error.AsString(), mEndpointId);
+        return Status::Failure;
+    }
+
+    return Status::Success;
+}
+/**
+ * @brief    Called by EVSE Hardware to share the VehicleID
+ *
+ * @param    C
+ */
+Status EnergyEvseDelegate::HwSetVehicleID(CharSpan newValue)
 {
-    DataModel::Nullable<chip::CharSpan> oldValue = mVehicleID;
+    DataModel::Nullable<CharSpan> oldValue = mVehicleID;
 
     mVehicleID = MakeNullable(newValue);
     if ((oldValue.IsNull()) || (strcmp(mVehicleID.Value().data(), oldValue.Value().data())))
@@ -668,7 +693,7 @@ DataModel::Nullable<int64_t> EnergyEvseDelegate::GetNextChargeRequiredEnergy()
 {
     return mNextChargeRequiredEnergy;
 }
-DataModel::Nullable<chip::Percent> EnergyEvseDelegate::GetNextChargeTargetSoC()
+DataModel::Nullable<Percent> EnergyEvseDelegate::GetNextChargeTargetSoC()
 {
     return mNextChargeTargetSoC;
 }
@@ -693,7 +718,7 @@ CHIP_ERROR EnergyEvseDelegate::SetApproximateEVEfficiency(uint16_t newValue)
 }
 
 /* SOC attributes */
-DataModel::Nullable<chip::Percent> EnergyEvseDelegate::GetStateOfCharge()
+DataModel::Nullable<Percent> EnergyEvseDelegate::GetStateOfCharge()
 {
     return mStateOfCharge;
 }
@@ -703,7 +728,7 @@ DataModel::Nullable<int64_t> EnergyEvseDelegate::GetBatteryCapacity()
 }
 
 /* PNC attributes*/
-DataModel::Nullable<chip::CharSpan> EnergyEvseDelegate::GetVehicleID()
+DataModel::Nullable<CharSpan> EnergyEvseDelegate::GetVehicleID()
 {
     return mVehicleID;
 }
diff --git a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h
index cbe5468440c60c..6f2d8fda8b63cf 100644
--- a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h
+++ b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h
@@ -74,8 +74,8 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate
     Status HwSetCableAssemblyLimit(int64_t currentmA);
     Status HwSetState(StateEnum state);
     Status HwSetFault(FaultStateEnum fault);
-    Status HwSetRFID(chip::CharSpan RFID);
-    Status HwSetVehicleID(chip::CharSpan);
+    Status HwSetRFID(ByteSpan uid);
+    Status HwSetVehicleID(CharSpan vehID);
 
     // ------------------------------------------------------------------
     // Get attribute methods
@@ -118,16 +118,16 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate
     DataModel::Nullable<uint32_t> GetNextChargeStartTime() override;
     DataModel::Nullable<uint32_t> GetNextChargeTargetTime() override;
     DataModel::Nullable<int64_t> GetNextChargeRequiredEnergy() override;
-    DataModel::Nullable<chip::Percent> GetNextChargeTargetSoC() override;
+    DataModel::Nullable<Percent> GetNextChargeTargetSoC() override;
 
     DataModel::Nullable<uint16_t> GetApproximateEVEfficiency() override;
     CHIP_ERROR SetApproximateEVEfficiency(uint16_t) override;
 
     /* SOC attributes */
-    DataModel::Nullable<chip::Percent> GetStateOfCharge() override;
+    DataModel::Nullable<Percent> GetStateOfCharge() override;
     DataModel::Nullable<int64_t> GetBatteryCapacity() override;
     /* PNC attributes*/
-    DataModel::Nullable<chip::CharSpan> GetVehicleID() override;
+    DataModel::Nullable<CharSpan> GetVehicleID() override;
     /* Session SESS attributes */
     DataModel::Nullable<uint32_t> GetSessionID() override;
     DataModel::Nullable<uint32_t> GetSessionDuration() override;
@@ -170,15 +170,15 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate
     DataModel::Nullable<uint32_t> mNextChargeStartTime;
     DataModel::Nullable<uint32_t> mNextChargeTargetTime;
     DataModel::Nullable<int64_t> mNextChargeRequiredEnergy;
-    DataModel::Nullable<chip::Percent> mNextChargeTargetSoC;
+    DataModel::Nullable<Percent> mNextChargeTargetSoC;
     DataModel::Nullable<uint16_t> mApproximateEVEfficiency;
 
     /* SOC attributes */
-    DataModel::Nullable<chip::Percent> mStateOfCharge;
+    DataModel::Nullable<Percent> mStateOfCharge;
     DataModel::Nullable<int64_t> mBatteryCapacity;
 
     /* PNC attributes*/
-    DataModel::Nullable<chip::CharSpan> mVehicleID;
+    DataModel::Nullable<CharSpan> mVehicleID;
 
     /* Session SESS attributes */
     DataModel::Nullable<uint32_t> mSessionID;
diff --git a/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp b/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp
index 34ac1146c33e2a..74d44fc6a2d1f4 100644
--- a/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp
+++ b/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp
@@ -45,6 +45,10 @@ CHIP_ERROR EVSEManufacturer::Init(EnergyEvseManager * aInstance)
     /* For now let's pretend the vehicle ID is set */
     dg->HwSetVehicleID(CharSpan("TEST_VEHICLE_123456789", 22));
 
+    /* For now let's pretend the RFID sensor was triggered - send an event */
+    uint8_t uid[10] = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE };
+    dg->HwSetRFID(ByteSpan(uid));
+
     return CHIP_NO_ERROR;
 }
 
diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
index de8aafdbc2cb01..00b4563438069d 100644
--- a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
+++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
@@ -19,16 +19,18 @@
 #include <EnergyEvseDelegateImpl.h>
 #include <app-common/zap-generated/attributes/Accessors.h>
 #include <app-common/zap-generated/cluster-objects.h>
+#include <app/EventLogging.h>
 
 using namespace chip;
-using chip::Protocols::InteractionModel::Status;
-
 using namespace chip::app;
 using namespace chip::app::DataModel;
 using namespace chip::app::Clusters;
 using namespace chip::app::Clusters::EnergyEvse;
 using namespace chip::app::Clusters::EnergyEvse::Attributes;
 
+using chip::app::LogEvent;
+using chip::Protocols::InteractionModel::Status;
+
 /**
  * @brief   Called when EVSE cluster receives Disable command
  */
@@ -83,7 +85,7 @@ Status EnergyEvseDelegate::Disable()
  * @param minimumChargeCurrent (in mA)
  * @param maximumChargeCurrent (in mA)
  */
-Status EnergyEvseDelegate::EnableCharging(const chip::app::DataModel::Nullable<uint32_t> & chargingEnabledUntil,
+Status EnergyEvseDelegate::EnableCharging(const DataModel::Nullable<uint32_t> & chargingEnabledUntil,
                                           const int64_t & minimumChargeCurrent, const int64_t & maximumChargeCurrent)
 {
     ChipLogProgress(AppServer, "EnergyEvseDelegate::EnableCharging()");
@@ -163,7 +165,7 @@ Status EnergyEvseDelegate::EnableCharging(const chip::app::DataModel::Nullable<u
  * @param dischargingEnabledUntil (can be null to indefinite discharging)
  * @param maximumChargeCurrent (in mA)
  */
-Status EnergyEvseDelegate::EnableDischarging(const chip::app::DataModel::Nullable<uint32_t> & dischargingEnabledUntil,
+Status EnergyEvseDelegate::EnableDischarging(const DataModel::Nullable<uint32_t> & dischargingEnabledUntil,
                                              const int64_t & maximumDischargeCurrent)
 {
     ChipLogProgress(AppServer, "EnergyEvseDelegate::EnableDischarging() called.");
@@ -352,9 +354,32 @@ Status EnergyEvseDelegate::HwSetFault(FaultStateEnum fault)
     return Status::Success;
 }
 
-Status EnergyEvseDelegate::HwSetVehicleID(chip::CharSpan newValue)
+/**
+ * @brief    Called by EVSE Hardware to Send a RFID event
+ *
+ * @param    ByteSpan RFID tag value (max 10 octets)
+ */
+Status EnergyEvseDelegate::HwSetRFID(ByteSpan uid)
+{
+    Events::Rfid::Type event{ .uid = uid };
+    EventNumber eventNumber;
+    CHIP_ERROR error = LogEvent(event, mEndpointId, eventNumber);
+    if (CHIP_NO_ERROR != error)
+    {
+        ChipLogError(Zcl, "[Notify] Unable to send notify event: %s [endpointId=%d]", error.AsString(), mEndpointId);
+        return Status::Failure;
+    }
+
+    return Status::Success;
+}
+/**
+ * @brief    Called by EVSE Hardware to share the VehicleID
+ *
+ * @param    C
+ */
+Status EnergyEvseDelegate::HwSetVehicleID(CharSpan newValue)
 {
-    DataModel::Nullable<chip::CharSpan> oldValue = mVehicleID;
+    DataModel::Nullable<CharSpan> oldValue = mVehicleID;
 
     mVehicleID = MakeNullable(newValue);
     if ((oldValue.IsNull()) || (strcmp(mVehicleID.Value().data(), oldValue.Value().data())))
@@ -668,7 +693,7 @@ DataModel::Nullable<int64_t> EnergyEvseDelegate::GetNextChargeRequiredEnergy()
 {
     return mNextChargeRequiredEnergy;
 }
-DataModel::Nullable<chip::Percent> EnergyEvseDelegate::GetNextChargeTargetSoC()
+DataModel::Nullable<Percent> EnergyEvseDelegate::GetNextChargeTargetSoC()
 {
     return mNextChargeTargetSoC;
 }
@@ -693,7 +718,7 @@ CHIP_ERROR EnergyEvseDelegate::SetApproximateEVEfficiency(uint16_t newValue)
 }
 
 /* SOC attributes */
-DataModel::Nullable<chip::Percent> EnergyEvseDelegate::GetStateOfCharge()
+DataModel::Nullable<Percent> EnergyEvseDelegate::GetStateOfCharge()
 {
     return mStateOfCharge;
 }
@@ -703,7 +728,7 @@ DataModel::Nullable<int64_t> EnergyEvseDelegate::GetBatteryCapacity()
 }
 
 /* PNC attributes*/
-DataModel::Nullable<chip::CharSpan> EnergyEvseDelegate::GetVehicleID()
+DataModel::Nullable<CharSpan> EnergyEvseDelegate::GetVehicleID()
 {
     return mVehicleID;
 }

From a2917b64c48f3e5d0de174fe77ef1142d6bd8a4d Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Sun, 10 Dec 2023 00:00:08 +0000
Subject: [PATCH 35/80] Added Feature flags, optional commands and optional
 attributes.

---
 .../include/EnergyEvseManager.h               |   4 +-
 examples/energy-management-app/linux/main.cpp |  11 +-
 .../energy-evse-server/energy-evse-server.cpp | 215 ++++++++++++++----
 .../energy-evse-server/energy-evse-server.h   |  21 +-
 4 files changed, 208 insertions(+), 43 deletions(-)

diff --git a/examples/energy-management-app/energy-management-common/include/EnergyEvseManager.h b/examples/energy-management-app/energy-management-common/include/EnergyEvseManager.h
index 9e99fa7c08732b..55fe7ad14bc6e4 100644
--- a/examples/energy-management-app/energy-management-common/include/EnergyEvseManager.h
+++ b/examples/energy-management-app/energy-management-common/include/EnergyEvseManager.h
@@ -31,7 +31,9 @@ using namespace chip::app::Clusters::EnergyEvse;
 class EnergyEvseManager : public Instance
 {
 public:
-    EnergyEvseManager(EndpointId aEndpointId, EnergyEvseDelegate & aDelegate) : EnergyEvse::Instance(aEndpointId, aDelegate)
+    EnergyEvseManager(EndpointId aEndpointId, EnergyEvseDelegate & aDelegate, Feature aFeature, OptionalAttributes aOptionalAttrs,
+                      OptionalCommands aOptionalCmds) :
+        EnergyEvse::Instance(aEndpointId, aDelegate, aFeature, aOptionalAttrs, aOptionalCmds)
     {
         mInstance = this;
         mDelegate = &aDelegate;
diff --git a/examples/energy-management-app/linux/main.cpp b/examples/energy-management-app/linux/main.cpp
index 93c9866fd998dc..904fa77aca2691 100644
--- a/examples/energy-management-app/linux/main.cpp
+++ b/examples/energy-management-app/linux/main.cpp
@@ -46,7 +46,16 @@ void ApplicationInit()
         gDelegate = new EnergyEvseDelegate();
         if (gDelegate != nullptr)
         {
-            gInstance = new EnergyEvseManager(EndpointId(ENERGY_EVSE_ENDPOINT), *gDelegate);
+            /* Manufacturer may optionally not support all features, commands & attributes */
+            gInstance = new EnergyEvseManager(
+                EndpointId(ENERGY_EVSE_ENDPOINT), *gDelegate,
+                BitMask<EnergyEvse::Feature, uint32_t>(EnergyEvse::Feature::kChargingPreferences,
+                                                       EnergyEvse::Feature::kPlugAndCharge, EnergyEvse::Feature::kRfid,
+                                                       EnergyEvse::Feature::kSoCReporting, EnergyEvse::Feature::kV2x),
+                BitMask<OptionalAttributes, uint32_t>(OptionalAttributes::kSupportsUserMaximumChargingCurrent,
+                                                      OptionalAttributes::kSupportsRandomizationWindow,
+                                                      OptionalAttributes::kSupportsApproximateEvEfficiency),
+                BitMask<OptionalCommands, uint32_t>(OptionalCommands::kSupportsStartDiagnostics));
             gInstance->Init(); /* Register Attribute & Command handlers */
         }
     }
diff --git a/src/app/clusters/energy-evse-server/energy-evse-server.cpp b/src/app/clusters/energy-evse-server/energy-evse-server.cpp
index 5d6b8f54c90178..21eddb6f66d28e 100644
--- a/src/app/clusters/energy-evse-server/energy-evse-server.cpp
+++ b/src/app/clusters/energy-evse-server/energy-evse-server.cpp
@@ -51,6 +51,16 @@ bool Instance::HasFeature(Feature aFeature) const
     return mFeature.Has(aFeature);
 }
 
+bool Instance::SupportsOptAttr(OptionalAttributes aOptionalAttrs) const
+{
+    return mOptionalAttrs.Has(aOptionalAttrs);
+}
+
+bool Instance::SupportsOptCmd(OptionalCommands aOptionalCmds) const
+{
+    return mOptionalCmds.Has(aOptionalCmds);
+}
+
 // AttributeAccessInterface
 CHIP_ERROR Instance::Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder)
 {
@@ -66,7 +76,14 @@ CHIP_ERROR Instance::Read(const ConcreteReadAttributePath & aPath, AttributeValu
         return aEncoder.Encode(mDelegate.GetChargingEnabledUntil());
     case DischargingEnabledUntil::Id:
         /* V2X */
-        return aEncoder.Encode(mDelegate.GetDischargingEnabledUntil());
+        if (!HasFeature(Feature::kV2x))
+        {
+            return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
+        }
+        else
+        {
+            return aEncoder.Encode(mDelegate.GetDischargingEnabledUntil());
+        }
     case CircuitCapacity::Id:
         return aEncoder.Encode(mDelegate.GetCircuitCapacity());
     case MinimumChargeCurrent::Id:
@@ -75,41 +92,128 @@ CHIP_ERROR Instance::Read(const ConcreteReadAttributePath & aPath, AttributeValu
         return aEncoder.Encode(mDelegate.GetMaximumChargeCurrent());
     case MaximumDischargeCurrent::Id:
         /* V2X */
-        return aEncoder.Encode(mDelegate.GetMaximumDischargeCurrent());
+        if (!HasFeature(Feature::kV2x))
+        {
+            return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
+        }
+        else
+        {
+            return aEncoder.Encode(mDelegate.GetMaximumDischargeCurrent());
+        }
+
     case UserMaximumChargeCurrent::Id:
-        /* PREF */
-        return aEncoder.Encode(mDelegate.GetUserMaximumChargeCurrent());
+        if (!SupportsOptAttr(OptionalAttributes::kSupportsUserMaximumChargingCurrent))
+        {
+            return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
+        }
+        else
+        {
+            return aEncoder.Encode(mDelegate.GetUserMaximumChargeCurrent());
+        }
     case RandomizationDelayWindow::Id:
         /* Optional */
-        return aEncoder.Encode(mDelegate.GetRandomizationDelayWindow());
-
-    /* PREF attributes */
+        if (!SupportsOptAttr(OptionalAttributes::kSupportsRandomizationWindow))
+        {
+            return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
+        }
+        else
+        {
+            return aEncoder.Encode(mDelegate.GetRandomizationDelayWindow());
+        }
+    /* PREF - ChargingPreferences attributes */
     case NumberOfWeeklyTargets::Id:
-        return aEncoder.Encode(mDelegate.GetNumberOfWeeklyTargets());
+        if (!HasFeature(Feature::kChargingPreferences))
+        {
+            return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
+        }
+        else
+        {
+            return aEncoder.Encode(mDelegate.GetNumberOfWeeklyTargets());
+        }
     case NumberOfDailyTargets::Id:
-        return aEncoder.Encode(mDelegate.GetNumberOfDailyTargets());
+        if (!HasFeature(Feature::kChargingPreferences))
+        {
+            return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
+        }
+        else
+        {
+            return aEncoder.Encode(mDelegate.GetNumberOfDailyTargets());
+        }
     case NextChargeStartTime::Id:
-        return aEncoder.Encode(mDelegate.GetNextChargeStartTime());
+        if (!HasFeature(Feature::kChargingPreferences))
+        {
+            return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
+        }
+        else
+        {
+            return aEncoder.Encode(mDelegate.GetNextChargeStartTime());
+        }
     case NextChargeTargetTime::Id:
-        return aEncoder.Encode(mDelegate.GetNextChargeTargetTime());
-
+        if (!HasFeature(Feature::kChargingPreferences))
+        {
+            return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
+        }
+        else
+        {
+            return aEncoder.Encode(mDelegate.GetNextChargeTargetTime());
+        }
     case NextChargeRequiredEnergy::Id:
-        return aEncoder.Encode(mDelegate.GetNextChargeRequiredEnergy());
+        if (!HasFeature(Feature::kChargingPreferences))
+        {
+            return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
+        }
+        else
+        {
+            return aEncoder.Encode(mDelegate.GetNextChargeRequiredEnergy());
+        }
     case NextChargeTargetSoC::Id:
-        return aEncoder.Encode(mDelegate.GetNextChargeTargetSoC());
+        if (!HasFeature(Feature::kChargingPreferences))
+        {
+            return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
+        }
+        else
+        {
+            return aEncoder.Encode(mDelegate.GetNextChargeTargetSoC());
+        }
     case ApproximateEVEfficiency::Id:
-        return aEncoder.Encode(mDelegate.GetApproximateEVEfficiency());
-
+        if ((!HasFeature(Feature::kChargingPreferences)) ||
+            (!SupportsOptAttr(OptionalAttributes::kSupportsApproximateEvEfficiency)))
+        {
+            return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
+        }
+        else
+        {
+            return aEncoder.Encode(mDelegate.GetApproximateEVEfficiency());
+        }
     /* SOC attributes */
     case StateOfCharge::Id:
-        return aEncoder.Encode(mDelegate.GetStateOfCharge());
+        if (!HasFeature(Feature::kSoCReporting))
+        {
+            return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
+        }
+        else
+        {
+            return aEncoder.Encode(mDelegate.GetStateOfCharge());
+        }
     case BatteryCapacity::Id:
-        return aEncoder.Encode(mDelegate.GetBatteryCapacity());
-
+        if (!HasFeature(Feature::kSoCReporting))
+        {
+            return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
+        }
+        else
+        {
+            return aEncoder.Encode(mDelegate.GetBatteryCapacity());
+        }
     /* PNC attributes*/
     case VehicleID::Id:
-        return aEncoder.Encode(mDelegate.GetVehicleID());
-
+        if (!HasFeature(Feature::kPlugAndCharge))
+        {
+            return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
+        }
+        else
+        {
+            return aEncoder.Encode(mDelegate.GetVehicleID());
+        }
     /* Session SESS attributes */
     case SessionID::Id:
         return aEncoder.Encode(mDelegate.GetSessionID());
@@ -129,22 +233,47 @@ CHIP_ERROR Instance::Write(const ConcreteDataAttributePath & aPath, AttributeVal
     switch (aPath.mAttributeId)
     {
     case UserMaximumChargeCurrent::Id: {
-        int64_t newValue;
-        ReturnErrorOnFailure(aDecoder.Decode(newValue));
-        ReturnErrorOnFailure(mDelegate.SetUserMaximumChargeCurrent(newValue));
-        return CHIP_NO_ERROR;
+        // Optional Attribute
+        if (!SupportsOptAttr(OptionalAttributes::kSupportsUserMaximumChargingCurrent))
+        {
+            return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
+        }
+        else
+        {
+            int64_t newValue;
+            ReturnErrorOnFailure(aDecoder.Decode(newValue));
+            ReturnErrorOnFailure(mDelegate.SetUserMaximumChargeCurrent(newValue));
+            return CHIP_NO_ERROR;
+        }
     }
     case RandomizationDelayWindow::Id: {
-        uint32_t newValue;
-        ReturnErrorOnFailure(aDecoder.Decode(newValue));
-        ReturnErrorOnFailure(mDelegate.SetRandomizationDelayWindow(newValue));
-        return CHIP_NO_ERROR;
+        // Optional Attribute
+        if (!SupportsOptAttr(OptionalAttributes::kSupportsRandomizationWindow))
+        {
+            return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
+        }
+        else
+        {
+            uint32_t newValue;
+            ReturnErrorOnFailure(aDecoder.Decode(newValue));
+            ReturnErrorOnFailure(mDelegate.SetRandomizationDelayWindow(newValue));
+            return CHIP_NO_ERROR;
+        }
     }
     case ApproximateEVEfficiency::Id: {
-        uint16_t newValue;
-        ReturnErrorOnFailure(aDecoder.Decode(newValue));
-        ReturnErrorOnFailure(mDelegate.SetApproximateEVEfficiency(newValue));
-        return CHIP_NO_ERROR;
+        // Optional Attribute if ChargingPreferences is supported
+        if ((!HasFeature(Feature::kChargingPreferences)) ||
+            (!SupportsOptAttr(OptionalAttributes::kSupportsApproximateEvEfficiency)))
+        {
+            return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
+        }
+        else
+        {
+            uint16_t newValue;
+            ReturnErrorOnFailure(aDecoder.Decode(newValue));
+            ReturnErrorOnFailure(mDelegate.SetApproximateEVEfficiency(newValue));
+            return CHIP_NO_ERROR;
+        }
     }
 
     default:
@@ -153,7 +282,6 @@ CHIP_ERROR Instance::Write(const ConcreteDataAttributePath & aPath, AttributeVal
         // start with.
         return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
     }
-    return CHIP_NO_ERROR;
 }
 
 // CommandHandlerInterface
@@ -165,11 +293,6 @@ CHIP_ERROR Instance::EnumerateAcceptedCommands(const ConcreteClusterPath & clust
     for (auto && id : {
              Disable::Id,
              EnableCharging::Id,
-             EnableDischarging::Id,
-             StartDiagnostics::Id,
-             SetTargets::Id,
-             GetTargets::Id,
-             ClearTargets::Id,
          })
     {
         if (callback(id, context) == Loop::Break)
@@ -178,6 +301,20 @@ CHIP_ERROR Instance::EnumerateAcceptedCommands(const ConcreteClusterPath & clust
         }
     }
 
+    if (HasFeature(Feature::kV2x))
+    {
+        callback(EnableDischarging::Id, context);
+    }
+    if (HasFeature(Feature::kChargingPreferences))
+    {
+        callback(SetTargets::Id, context);
+        callback(GetTargets::Id, context);
+        callback(ClearTargets::Id, context);
+    }
+    if (SupportsOptCmd(OptionalCommands::kSupportsStartDiagnostics))
+    {
+        callback(StartDiagnostics::Id, context);
+    }
     return CHIP_NO_ERROR;
 }
 
diff --git a/src/app/clusters/energy-evse-server/energy-evse-server.h b/src/app/clusters/energy-evse-server/energy-evse-server.h
index 397d3a6bdc3f19..b1425ba1f76a11 100644
--- a/src/app/clusters/energy-evse-server/energy-evse-server.h
+++ b/src/app/clusters/energy-evse-server/energy-evse-server.h
@@ -124,12 +124,25 @@ class Delegate
     EndpointId mEndpointId = 0;
 };
 
+enum class OptionalAttributes : uint32_t
+{
+    kSupportsUserMaximumChargingCurrent = 0x1,
+    kSupportsRandomizationWindow        = 0x2,
+    kSupportsApproximateEvEfficiency    = 0x4
+};
+
+enum class OptionalCommands : uint32_t
+{
+    kSupportsStartDiagnostics = 0x1
+};
+
 class Instance : public AttributeAccessInterface, public CommandHandlerInterface
 {
 public:
-    Instance(EndpointId aEndpointId, Delegate & aDelegate) :
+    Instance(EndpointId aEndpointId, Delegate & aDelegate, Feature aFeature, OptionalAttributes aOptionalAttrs,
+             OptionalCommands aOptionalCmds) :
         AttributeAccessInterface(MakeOptional(aEndpointId), Id), CommandHandlerInterface(MakeOptional(aEndpointId), Id),
-        mDelegate(aDelegate)
+        mDelegate(aDelegate), mFeature(aFeature), mOptionalAttrs(aOptionalAttrs), mOptionalCmds(aOptionalCmds)
     {
         /* set the base class delegates endpointId */
         mDelegate.SetEndpointId(aEndpointId);
@@ -140,10 +153,14 @@ class Instance : public AttributeAccessInterface, public CommandHandlerInterface
     void Shutdown();
 
     bool HasFeature(Feature aFeature) const;
+    bool SupportsOptAttr(OptionalAttributes aOptionalAttrs) const;
+    bool SupportsOptCmd(OptionalCommands aOptionalCmds) const;
 
 private:
     Delegate & mDelegate;
     BitMask<Feature> mFeature;
+    BitMask<OptionalAttributes> mOptionalAttrs;
+    BitMask<OptionalCommands> mOptionalCmds;
 
     // AttributeAccessInterface
     CHIP_ERROR Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override;

From e34b5237ec2cebcd3166472c9426db2f1746430c Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Sun, 10 Dec 2023 18:12:51 +0000
Subject: [PATCH 36/80] Made command handling conditional based on features

---
 .../energy-evse-server/energy-evse-server.cpp | 45 +++++++++++++++----
 1 file changed, 37 insertions(+), 8 deletions(-)

diff --git a/src/app/clusters/energy-evse-server/energy-evse-server.cpp b/src/app/clusters/energy-evse-server/energy-evse-server.cpp
index 21eddb6f66d28e..321d7a6546722a 100644
--- a/src/app/clusters/energy-evse-server/energy-evse-server.cpp
+++ b/src/app/clusters/energy-evse-server/energy-evse-server.cpp
@@ -333,24 +333,53 @@ void Instance::InvokeCommand(HandlerContext & handlerContext)
             handlerContext, [this](HandlerContext & ctx, const auto & commandData) { HandleEnableCharging(ctx, commandData); });
         return;
     case EnableDischarging::Id:
-        HandleCommand<EnableDischarging::DecodableType>(
-            handlerContext, [this](HandlerContext & ctx, const auto & commandData) { HandleEnableDischarging(ctx, commandData); });
+        if (!HasFeature(Feature::kV2x))
+        {
+            handlerContext.mCommandHandler.AddStatus(handlerContext.mRequestPath, Status::UnsupportedCommand);
+        }
+        else
+        {
+            HandleCommand<EnableDischarging::DecodableType>(handlerContext, [this](HandlerContext & ctx, const auto & commandData) {
+                HandleEnableDischarging(ctx, commandData);
+            });
+        }
         return;
     case StartDiagnostics::Id:
         HandleCommand<StartDiagnostics::DecodableType>(
             handlerContext, [this](HandlerContext & ctx, const auto & commandData) { HandleStartDiagnostics(ctx, commandData); });
         return;
     case SetTargets::Id:
-        HandleCommand<SetTargets::DecodableType>(
-            handlerContext, [this](HandlerContext & ctx, const auto & commandData) { HandleSetTargets(ctx, commandData); });
+        if (!HasFeature(Feature::kChargingPreferences))
+        {
+            handlerContext.mCommandHandler.AddStatus(handlerContext.mRequestPath, Status::UnsupportedCommand);
+        }
+        else
+        {
+            HandleCommand<SetTargets::DecodableType>(
+                handlerContext, [this](HandlerContext & ctx, const auto & commandData) { HandleSetTargets(ctx, commandData); });
+        }
         return;
     case GetTargets::Id:
-        HandleCommand<GetTargets::DecodableType>(
-            handlerContext, [this](HandlerContext & ctx, const auto & commandData) { HandleGetTargets(ctx, commandData); });
+        if (!HasFeature(Feature::kChargingPreferences))
+        {
+            handlerContext.mCommandHandler.AddStatus(handlerContext.mRequestPath, Status::UnsupportedCommand);
+        }
+        else
+        {
+            HandleCommand<GetTargets::DecodableType>(
+                handlerContext, [this](HandlerContext & ctx, const auto & commandData) { HandleGetTargets(ctx, commandData); });
+        }
         return;
     case ClearTargets::Id:
-        HandleCommand<ClearTargets::DecodableType>(
-            handlerContext, [this](HandlerContext & ctx, const auto & commandData) { HandleClearTargets(ctx, commandData); });
+        if (!HasFeature(Feature::kChargingPreferences))
+        {
+            handlerContext.mCommandHandler.AddStatus(handlerContext.mRequestPath, Status::UnsupportedCommand);
+        }
+        else
+        {
+            HandleCommand<ClearTargets::DecodableType>(
+                handlerContext, [this](HandlerContext & ctx, const auto & commandData) { HandleClearTargets(ctx, commandData); });
+        }
         return;
     }
 }

From 3b97de1ad043cf0e3423c1e0060cf9359df6d8b9 Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Sun, 10 Dec 2023 18:13:27 +0000
Subject: [PATCH 37/80] Added Feature support to all-clusters-app

---
 .../all-clusters-common/include/EnergyEvseManager.h |  4 +++-
 .../all-clusters-common/src/energy-evse-stub.cpp    | 13 ++++++++++++-
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/examples/all-clusters-app/all-clusters-common/include/EnergyEvseManager.h b/examples/all-clusters-app/all-clusters-common/include/EnergyEvseManager.h
index 9e99fa7c08732b..55fe7ad14bc6e4 100644
--- a/examples/all-clusters-app/all-clusters-common/include/EnergyEvseManager.h
+++ b/examples/all-clusters-app/all-clusters-common/include/EnergyEvseManager.h
@@ -31,7 +31,9 @@ using namespace chip::app::Clusters::EnergyEvse;
 class EnergyEvseManager : public Instance
 {
 public:
-    EnergyEvseManager(EndpointId aEndpointId, EnergyEvseDelegate & aDelegate) : EnergyEvse::Instance(aEndpointId, aDelegate)
+    EnergyEvseManager(EndpointId aEndpointId, EnergyEvseDelegate & aDelegate, Feature aFeature, OptionalAttributes aOptionalAttrs,
+                      OptionalCommands aOptionalCmds) :
+        EnergyEvse::Instance(aEndpointId, aDelegate, aFeature, aOptionalAttrs, aOptionalCmds)
     {
         mInstance = this;
         mDelegate = &aDelegate;
diff --git a/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp b/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp
index a8b1444ae3148e..a0773de104c187 100644
--- a/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp
+++ b/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp
@@ -17,6 +17,8 @@
  */
 
 #include <EnergyEvseManager.h>
+
+using namespace chip;
 using namespace chip::app::Clusters;
 using namespace chip::app::Clusters::EnergyEvse;
 
@@ -30,7 +32,16 @@ void emberAfEnergyEvseClusterInitCallback(chip::EndpointId endpointId)
     gDelegate = new EnergyEvseDelegate();
     if (gDelegate != nullptr)
     {
-        gInstance = new EnergyEvseManager(endpointId, *gDelegate);
+        gInstance =
+            new EnergyEvseManager(endpointId, *gDelegate,
+                                  BitMask<EnergyEvse::Feature, uint32_t>(
+                                      EnergyEvse::Feature::kChargingPreferences, EnergyEvse::Feature::kPlugAndCharge,
+                                      EnergyEvse::Feature::kRfid, EnergyEvse::Feature::kSoCReporting, EnergyEvse::Feature::kV2x),
+                                  BitMask<OptionalAttributes, uint32_t>(OptionalAttributes::kSupportsUserMaximumChargingCurrent,
+                                                                        OptionalAttributes::kSupportsRandomizationWindow,
+                                                                        OptionalAttributes::kSupportsApproximateEvEfficiency),
+                                  BitMask<OptionalCommands, uint32_t>(OptionalCommands::kSupportsStartDiagnostics));
+
         gInstance->Init(); /* Register Attribute & Command handlers */
     }
 }

From da7a3fb6141a05f7063479888fc3f42180bf94c2 Mon Sep 17 00:00:00 2001
From: "Restyled.io" <commits@restyled.io>
Date: Sun, 10 Dec 2023 18:37:59 +0000
Subject: [PATCH 38/80] Restyled by clang-format

---
 src/app/clusters/energy-evse-server/energy-evse-server.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/app/clusters/energy-evse-server/energy-evse-server.h b/src/app/clusters/energy-evse-server/energy-evse-server.h
index b1425ba1f76a11..756557da63a113 100644
--- a/src/app/clusters/energy-evse-server/energy-evse-server.h
+++ b/src/app/clusters/energy-evse-server/energy-evse-server.h
@@ -141,8 +141,9 @@ class Instance : public AttributeAccessInterface, public CommandHandlerInterface
 public:
     Instance(EndpointId aEndpointId, Delegate & aDelegate, Feature aFeature, OptionalAttributes aOptionalAttrs,
              OptionalCommands aOptionalCmds) :
-        AttributeAccessInterface(MakeOptional(aEndpointId), Id), CommandHandlerInterface(MakeOptional(aEndpointId), Id),
-        mDelegate(aDelegate), mFeature(aFeature), mOptionalAttrs(aOptionalAttrs), mOptionalCmds(aOptionalCmds)
+        AttributeAccessInterface(MakeOptional(aEndpointId), Id),
+        CommandHandlerInterface(MakeOptional(aEndpointId), Id), mDelegate(aDelegate), mFeature(aFeature),
+        mOptionalAttrs(aOptionalAttrs), mOptionalCmds(aOptionalCmds)
     {
         /* set the base class delegates endpointId */
         mDelegate.SetEndpointId(aEndpointId);

From e2652ec8f5efe67cf90784e404947385debfe6f4 Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Mon, 11 Dec 2023 12:52:25 +0000
Subject: [PATCH 39/80] Fix to Darwin compile error - not checking strcmp
 return

---
 .../all-clusters-common/src/EnergyEvseDelegateImpl.cpp          | 2 +-
 .../energy-management-common/src/EnergyEvseDelegateImpl.cpp     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
index 00b4563438069d..5df53dc97338e5 100644
--- a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
+++ b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
@@ -382,7 +382,7 @@ Status EnergyEvseDelegate::HwSetVehicleID(CharSpan newValue)
     DataModel::Nullable<CharSpan> oldValue = mVehicleID;
 
     mVehicleID = MakeNullable(newValue);
-    if ((oldValue.IsNull()) || (strcmp(mVehicleID.Value().data(), oldValue.Value().data())))
+    if ((oldValue.IsNull()) || (strcmp(mVehicleID.Value().data(), oldValue.Value().data()) != 0))
     {
         ChipLogDetail(AppServer, "VehicleID updated to %s", mVehicleID.Value().data());
         MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, VehicleID::Id);
diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
index 00b4563438069d..5df53dc97338e5 100644
--- a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
+++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
@@ -382,7 +382,7 @@ Status EnergyEvseDelegate::HwSetVehicleID(CharSpan newValue)
     DataModel::Nullable<CharSpan> oldValue = mVehicleID;
 
     mVehicleID = MakeNullable(newValue);
-    if ((oldValue.IsNull()) || (strcmp(mVehicleID.Value().data(), oldValue.Value().data())))
+    if ((oldValue.IsNull()) || (strcmp(mVehicleID.Value().data(), oldValue.Value().data()) != 0))
     {
         ChipLogDetail(AppServer, "VehicleID updated to %s", mVehicleID.Value().data());
         MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, VehicleID::Id);

From a9a7e8f2374114caa37edceae4fde28ba872df8f Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Mon, 11 Dec 2023 15:24:41 +0000
Subject: [PATCH 40/80] Attempt to fix Darwin errors (return after else)

---
 .../energy-evse-server/energy-evse-server.cpp | 104 +++++-------------
 1 file changed, 27 insertions(+), 77 deletions(-)

diff --git a/src/app/clusters/energy-evse-server/energy-evse-server.cpp b/src/app/clusters/energy-evse-server/energy-evse-server.cpp
index 321d7a6546722a..00baabd46b2ad0 100644
--- a/src/app/clusters/energy-evse-server/energy-evse-server.cpp
+++ b/src/app/clusters/energy-evse-server/energy-evse-server.cpp
@@ -80,10 +80,7 @@ CHIP_ERROR Instance::Read(const ConcreteReadAttributePath & aPath, AttributeValu
         {
             return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
         }
-        else
-        {
-            return aEncoder.Encode(mDelegate.GetDischargingEnabledUntil());
-        }
+        return aEncoder.Encode(mDelegate.GetDischargingEnabledUntil());
     case CircuitCapacity::Id:
         return aEncoder.Encode(mDelegate.GetCircuitCapacity());
     case MinimumChargeCurrent::Id:
@@ -96,124 +93,85 @@ CHIP_ERROR Instance::Read(const ConcreteReadAttributePath & aPath, AttributeValu
         {
             return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
         }
-        else
-        {
-            return aEncoder.Encode(mDelegate.GetMaximumDischargeCurrent());
-        }
+        return aEncoder.Encode(mDelegate.GetMaximumDischargeCurrent());
 
     case UserMaximumChargeCurrent::Id:
         if (!SupportsOptAttr(OptionalAttributes::kSupportsUserMaximumChargingCurrent))
         {
             return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
         }
-        else
-        {
-            return aEncoder.Encode(mDelegate.GetUserMaximumChargeCurrent());
-        }
+        return aEncoder.Encode(mDelegate.GetUserMaximumChargeCurrent());
     case RandomizationDelayWindow::Id:
         /* Optional */
         if (!SupportsOptAttr(OptionalAttributes::kSupportsRandomizationWindow))
         {
             return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
         }
-        else
-        {
-            return aEncoder.Encode(mDelegate.GetRandomizationDelayWindow());
-        }
+        return aEncoder.Encode(mDelegate.GetRandomizationDelayWindow());
     /* PREF - ChargingPreferences attributes */
     case NumberOfWeeklyTargets::Id:
         if (!HasFeature(Feature::kChargingPreferences))
         {
             return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
         }
-        else
-        {
-            return aEncoder.Encode(mDelegate.GetNumberOfWeeklyTargets());
-        }
+        return aEncoder.Encode(mDelegate.GetNumberOfWeeklyTargets());
     case NumberOfDailyTargets::Id:
         if (!HasFeature(Feature::kChargingPreferences))
         {
             return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
         }
-        else
-        {
-            return aEncoder.Encode(mDelegate.GetNumberOfDailyTargets());
-        }
+        return aEncoder.Encode(mDelegate.GetNumberOfDailyTargets());
     case NextChargeStartTime::Id:
         if (!HasFeature(Feature::kChargingPreferences))
         {
             return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
         }
-        else
-        {
-            return aEncoder.Encode(mDelegate.GetNextChargeStartTime());
-        }
+        return aEncoder.Encode(mDelegate.GetNextChargeStartTime());
     case NextChargeTargetTime::Id:
         if (!HasFeature(Feature::kChargingPreferences))
         {
             return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
         }
-        else
-        {
-            return aEncoder.Encode(mDelegate.GetNextChargeTargetTime());
-        }
+        return aEncoder.Encode(mDelegate.GetNextChargeTargetTime());
     case NextChargeRequiredEnergy::Id:
         if (!HasFeature(Feature::kChargingPreferences))
         {
             return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
         }
-        else
-        {
-            return aEncoder.Encode(mDelegate.GetNextChargeRequiredEnergy());
-        }
+        return aEncoder.Encode(mDelegate.GetNextChargeRequiredEnergy());
     case NextChargeTargetSoC::Id:
         if (!HasFeature(Feature::kChargingPreferences))
         {
             return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
         }
-        else
-        {
-            return aEncoder.Encode(mDelegate.GetNextChargeTargetSoC());
-        }
+        return aEncoder.Encode(mDelegate.GetNextChargeTargetSoC());
     case ApproximateEVEfficiency::Id:
         if ((!HasFeature(Feature::kChargingPreferences)) ||
             (!SupportsOptAttr(OptionalAttributes::kSupportsApproximateEvEfficiency)))
         {
             return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
         }
-        else
-        {
-            return aEncoder.Encode(mDelegate.GetApproximateEVEfficiency());
-        }
+        return aEncoder.Encode(mDelegate.GetApproximateEVEfficiency());
     /* SOC attributes */
     case StateOfCharge::Id:
         if (!HasFeature(Feature::kSoCReporting))
         {
             return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
         }
-        else
-        {
-            return aEncoder.Encode(mDelegate.GetStateOfCharge());
-        }
+        return aEncoder.Encode(mDelegate.GetStateOfCharge());
     case BatteryCapacity::Id:
         if (!HasFeature(Feature::kSoCReporting))
         {
             return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
         }
-        else
-        {
-            return aEncoder.Encode(mDelegate.GetBatteryCapacity());
-        }
+        return aEncoder.Encode(mDelegate.GetBatteryCapacity());
     /* PNC attributes*/
     case VehicleID::Id:
         if (!HasFeature(Feature::kPlugAndCharge))
         {
             return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
         }
-        else
-        {
-            return aEncoder.Encode(mDelegate.GetVehicleID());
-        }
+        return aEncoder.Encode(mDelegate.GetVehicleID());
     /* Session SESS attributes */
     case SessionID::Id:
         return aEncoder.Encode(mDelegate.GetSessionID());
@@ -238,13 +196,11 @@ CHIP_ERROR Instance::Write(const ConcreteDataAttributePath & aPath, AttributeVal
         {
             return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
         }
-        else
-        {
-            int64_t newValue;
-            ReturnErrorOnFailure(aDecoder.Decode(newValue));
-            ReturnErrorOnFailure(mDelegate.SetUserMaximumChargeCurrent(newValue));
-            return CHIP_NO_ERROR;
-        }
+
+        int64_t newValue;
+        ReturnErrorOnFailure(aDecoder.Decode(newValue));
+        ReturnErrorOnFailure(mDelegate.SetUserMaximumChargeCurrent(newValue));
+        return CHIP_NO_ERROR;
     }
     case RandomizationDelayWindow::Id: {
         // Optional Attribute
@@ -252,13 +208,10 @@ CHIP_ERROR Instance::Write(const ConcreteDataAttributePath & aPath, AttributeVal
         {
             return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
         }
-        else
-        {
-            uint32_t newValue;
-            ReturnErrorOnFailure(aDecoder.Decode(newValue));
-            ReturnErrorOnFailure(mDelegate.SetRandomizationDelayWindow(newValue));
-            return CHIP_NO_ERROR;
-        }
+        uint32_t newValue;
+        ReturnErrorOnFailure(aDecoder.Decode(newValue));
+        ReturnErrorOnFailure(mDelegate.SetRandomizationDelayWindow(newValue));
+        return CHIP_NO_ERROR;
     }
     case ApproximateEVEfficiency::Id: {
         // Optional Attribute if ChargingPreferences is supported
@@ -267,13 +220,10 @@ CHIP_ERROR Instance::Write(const ConcreteDataAttributePath & aPath, AttributeVal
         {
             return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
         }
-        else
-        {
-            uint16_t newValue;
-            ReturnErrorOnFailure(aDecoder.Decode(newValue));
-            ReturnErrorOnFailure(mDelegate.SetApproximateEVEfficiency(newValue));
-            return CHIP_NO_ERROR;
-        }
+        uint16_t newValue;
+        ReturnErrorOnFailure(aDecoder.Decode(newValue));
+        ReturnErrorOnFailure(mDelegate.SetApproximateEVEfficiency(newValue));
+        return CHIP_NO_ERROR;
     }
 
     default:

From 2ff5a27065da596a0ade1b0e4596d7a7173d9346 Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Mon, 11 Dec 2023 16:20:42 +0000
Subject: [PATCH 41/80] Updated based on latest upstream master

---
 .../all-clusters-common/all-clusters-app.zap  | 30 +++++++++++--------
 .../energy-management-app.matter              |  4 ++-
 .../data_model/controller-clusters.zap        |  4 +++
 3 files changed, 24 insertions(+), 14 deletions(-)

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 f5bf4ef9a8991e..8835c4a37f321a 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
@@ -17,12 +17,6 @@
     }
   ],
   "package": [
-    {
-      "pathRelativity": "relativeToZap",
-      "path": "../../../src/app/zap-templates/app-templates.json",
-      "type": "gen-templates-json",
-      "version": "chip-v1"
-    },
     {
       "pathRelativity": "relativeToZap",
       "path": "../../../src/app/zap-templates/zcl/zcl-with-test-extensions.json",
@@ -30,6 +24,12 @@
       "category": "matter",
       "version": 1,
       "description": "Matter SDK ZCL data with some extensions"
+    },
+    {
+      "pathRelativity": "relativeToZap",
+      "path": "../../../src/app/zap-templates/app-templates.json",
+      "type": "gen-templates-json",
+      "version": "chip-v1"
     }
   ],
   "endpointTypes": [
@@ -7099,6 +7099,7 @@
           "define": "ON_OFF_SWITCH_CONFIGURATION_CLUSTER",
           "side": "server",
           "enabled": 1,
+          "apiMaturity": "deprecated",
           "attributes": [
             {
               "name": "switch type",
@@ -7505,6 +7506,7 @@
           "define": "BINARY_INPUT_BASIC_CLUSTER",
           "side": "server",
           "enabled": 1,
+          "apiMaturity": "deprecated",
           "attributes": [
             {
               "name": "out of service",
@@ -12538,6 +12540,7 @@
           "define": "BARRIER_CONTROL_CLUSTER",
           "side": "server",
           "enabled": 1,
+          "apiMaturity": "deprecated",
           "commands": [
             {
               "name": "BarrierControlGoToPercent",
@@ -13168,7 +13171,7 @@
               "code": 17,
               "mfgCode": null,
               "side": "server",
-              "type": "temperature",
+              "type": "int16s",
               "included": 1,
               "storageOption": "RAM",
               "singleton": 0,
@@ -13184,7 +13187,7 @@
               "code": 18,
               "mfgCode": null,
               "side": "server",
-              "type": "temperature",
+              "type": "int16s",
               "included": 1,
               "storageOption": "RAM",
               "singleton": 0,
@@ -13200,7 +13203,7 @@
               "code": 21,
               "mfgCode": null,
               "side": "server",
-              "type": "temperature",
+              "type": "int16s",
               "included": 1,
               "storageOption": "RAM",
               "singleton": 0,
@@ -13216,7 +13219,7 @@
               "code": 22,
               "mfgCode": null,
               "side": "server",
-              "type": "temperature",
+              "type": "int16s",
               "included": 1,
               "storageOption": "RAM",
               "singleton": 0,
@@ -13232,7 +13235,7 @@
               "code": 23,
               "mfgCode": null,
               "side": "server",
-              "type": "temperature",
+              "type": "int16s",
               "included": 1,
               "storageOption": "RAM",
               "singleton": 0,
@@ -13248,7 +13251,7 @@
               "code": 24,
               "mfgCode": null,
               "side": "server",
-              "type": "temperature",
+              "type": "int16s",
               "included": 1,
               "storageOption": "RAM",
               "singleton": 0,
@@ -13349,7 +13352,7 @@
               "storageOption": "External",
               "singleton": 0,
               "bounded": 0,
-              "defaultValue": "",
+              "defaultValue": null,
               "reportable": 1,
               "minInterval": 1,
               "maxInterval": 65534,
@@ -18480,6 +18483,7 @@
           "define": "ELECTRICAL_MEASUREMENT_CLUSTER",
           "side": "server",
           "enabled": 1,
+          "apiMaturity": "deprecated",
           "attributes": [
             {
               "name": "measurement type",
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 c57d13e0e5c5df..b7198f8018aa44 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
@@ -293,11 +293,13 @@ cluster TimeFormatLocalization = 44 {
     kKorean = 9;
     kPersian = 10;
     kTaiwanese = 11;
+    kUseActiveLocale = 255;
   }
 
   enum HourFormatEnum : enum8 {
     k12hr = 0;
     k24hr = 1;
+    kUseActiveLocale = 255;
   }
 
   bitmap Feature : bitmap32 {
@@ -592,7 +594,7 @@ cluster NetworkCommissioning = 49 {
 
 /** The General Diagnostics Cluster, along with other diagnostics clusters, provide a means to acquire standardized diagnostics metrics that MAY be used by a Node to assist a user or Administrative Node in diagnosing potential problems. */
 cluster GeneralDiagnostics = 51 {
-  revision 1; // NOTE: Default/not specifically set
+  revision 2;
 
   enum BootReasonEnum : enum8 {
     kUnspecified = 0;
diff --git a/src/controller/data_model/controller-clusters.zap b/src/controller/data_model/controller-clusters.zap
index fb41ede1f42920..b530fd8f277f05 100644
--- a/src/controller/data_model/controller-clusters.zap
+++ b/src/controller/data_model/controller-clusters.zap
@@ -428,6 +428,7 @@
           "define": "ON_OFF_SWITCH_CONFIGURATION_CLUSTER",
           "side": "client",
           "enabled": 1,
+          "apiMaturity": "deprecated",
           "attributes": [
             {
               "name": "ClusterRevision",
@@ -562,6 +563,7 @@
           "define": "BINARY_INPUT_BASIC_CLUSTER",
           "side": "client",
           "enabled": 1,
+          "apiMaturity": "deprecated",
           "attributes": [
             {
               "name": "ClusterRevision",
@@ -3484,6 +3486,7 @@
           "define": "BARRIER_CONTROL_CLUSTER",
           "side": "client",
           "enabled": 1,
+          "apiMaturity": "deprecated",
           "commands": [
             {
               "name": "BarrierControlGoToPercent",
@@ -5108,6 +5111,7 @@
           "define": "ELECTRICAL_MEASUREMENT_CLUSTER",
           "side": "client",
           "enabled": 1,
+          "apiMaturity": "deprecated",
           "attributes": [
             {
               "name": "ClusterRevision",

From 11b01514dd47429523ca656adc708985fa69eaa3 Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Mon, 11 Dec 2023 23:11:56 +0000
Subject: [PATCH 42/80] Removed unnecessary mInstance and used 'this' instead.

---
 .../all-clusters-common/include/EnergyEvseManager.h           | 3 ---
 .../all-clusters-common/src/EnergyEvseManager.cpp             | 4 ++--
 .../energy-management-common/include/EnergyEvseManager.h      | 3 ---
 .../energy-management-common/src/EnergyEvseManager.cpp        | 4 ++--
 4 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/examples/all-clusters-app/all-clusters-common/include/EnergyEvseManager.h b/examples/all-clusters-app/all-clusters-common/include/EnergyEvseManager.h
index 55fe7ad14bc6e4..9875c397990ef2 100644
--- a/examples/all-clusters-app/all-clusters-common/include/EnergyEvseManager.h
+++ b/examples/all-clusters-app/all-clusters-common/include/EnergyEvseManager.h
@@ -35,7 +35,6 @@ class EnergyEvseManager : public Instance
                       OptionalCommands aOptionalCmds) :
         EnergyEvse::Instance(aEndpointId, aDelegate, aFeature, aOptionalAttrs, aOptionalCmds)
     {
-        mInstance = this;
         mDelegate = &aDelegate;
     }
 
@@ -47,11 +46,9 @@ class EnergyEvseManager : public Instance
     CHIP_ERROR Init();
     void Shutdown();
 
-    EnergyEvse::Instance * GetInstance() { return mInstance; };
     EnergyEvseDelegate * GetDelegate() { return mDelegate; };
 
 private:
-    EnergyEvse::Instance * mInstance;
     EnergyEvseDelegate * mDelegate;
 };
 
diff --git a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp
index 5f8fcaa61dcb6a..9b5cdac4df5f36 100644
--- a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp
+++ b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp
@@ -24,11 +24,11 @@ using namespace chip::app::Clusters::EnergyEvse;
 
 CHIP_ERROR EnergyEvseManager::Init()
 {
-    GetInstance()->Instance::Init();
+    this->Instance::Init();
     return CHIP_NO_ERROR;
 }
 
 void EnergyEvseManager::Shutdown()
 {
-    GetInstance()->Instance::Shutdown();
+    this->Instance::Shutdown();
 }
diff --git a/examples/energy-management-app/energy-management-common/include/EnergyEvseManager.h b/examples/energy-management-app/energy-management-common/include/EnergyEvseManager.h
index 55fe7ad14bc6e4..9875c397990ef2 100644
--- a/examples/energy-management-app/energy-management-common/include/EnergyEvseManager.h
+++ b/examples/energy-management-app/energy-management-common/include/EnergyEvseManager.h
@@ -35,7 +35,6 @@ class EnergyEvseManager : public Instance
                       OptionalCommands aOptionalCmds) :
         EnergyEvse::Instance(aEndpointId, aDelegate, aFeature, aOptionalAttrs, aOptionalCmds)
     {
-        mInstance = this;
         mDelegate = &aDelegate;
     }
 
@@ -47,11 +46,9 @@ class EnergyEvseManager : public Instance
     CHIP_ERROR Init();
     void Shutdown();
 
-    EnergyEvse::Instance * GetInstance() { return mInstance; };
     EnergyEvseDelegate * GetDelegate() { return mDelegate; };
 
 private:
-    EnergyEvse::Instance * mInstance;
     EnergyEvseDelegate * mDelegate;
 };
 
diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp
index 5f8fcaa61dcb6a..9b5cdac4df5f36 100644
--- a/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp
+++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp
@@ -24,11 +24,11 @@ using namespace chip::app::Clusters::EnergyEvse;
 
 CHIP_ERROR EnergyEvseManager::Init()
 {
-    GetInstance()->Instance::Init();
+    this->Instance::Init();
     return CHIP_NO_ERROR;
 }
 
 void EnergyEvseManager::Shutdown()
 {
-    GetInstance()->Instance::Shutdown();
+    this->Instance::Shutdown();
 }

From 893c6e561265e88b713145055aa2ec3512355cfc Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Mon, 11 Dec 2023 23:29:34 +0000
Subject: [PATCH 43/80] Regen_all after merge to master.

---
 .../all-clusters-app.matter                   | 215 +++++
 .../all-clusters-common/all-clusters-app.zap  | 869 ++++++++++++++----
 .../ElectricalEnergyMeasurementCluster.kt     | 439 +++++++--
 .../cluster/clusters/EnergyEvseCluster.kt     |  43 +-
 .../EnergyEvseClusterFaultEvent.kt            |  16 +-
 ...urementClusterMeasurementAccuracyStruct.kt |   4 +-
 6 files changed, 1318 insertions(+), 268 deletions(-)

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 d6345f8867dddd..c60546ede85a7f 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
@@ -3717,6 +3717,187 @@ provisional cluster ElectricalEnergyMeasurement = 145 {
   readonly attribute int16u clusterRevision = 65533;
 }
 
+/** Electric Vehicle Supply Equipment (EVSE) is equipment used to charge an Electric Vehicle (EV) or Plug-In Hybrid Electric Vehicle. This cluster provides an interface to the functionality of Electric Vehicle Supply Equipment (EVSE) management. */
+provisional cluster EnergyEvse = 153 {
+  revision 1; // NOTE: Default/not specifically set
+
+  enum EnergyTransferStoppedReasonEnum : enum8 {
+    kEVStopped = 0;
+    kEVSEStopped = 1;
+    kOther = 2;
+  }
+
+  enum FaultStateEnum : enum8 {
+    kNoError = 0;
+    kMeterFailure = 1;
+    kOverVoltage = 2;
+    kUnderVoltage = 3;
+    kOverCurrent = 4;
+    kContactWetFailure = 5;
+    kContactDryFailure = 6;
+    kGroundFault = 7;
+    kPowerLoss = 8;
+    kPowerQuality = 9;
+    kPilotShortCircuit = 10;
+    kEmergencyStop = 11;
+    kEVDisconnected = 12;
+    kWrongPowerSupply = 13;
+    kLiveNeutralSwap = 14;
+    kOverTemperature = 15;
+    kOther = 255;
+  }
+
+  enum StateEnum : enum8 {
+    kNotPluggedIn = 0;
+    kPluggedInNoDemand = 1;
+    kPluggedInDemand = 2;
+    kPluggedInCharging = 3;
+    kPluggedInDischarging = 4;
+    kSessionEnding = 5;
+    kFault = 6;
+  }
+
+  enum SupplyStateEnum : enum8 {
+    kDisabled = 0;
+    kChargingEnabled = 1;
+    kDischargingEnabled = 2;
+    kDisabledError = 3;
+    kDisabledDiagnostics = 4;
+  }
+
+  bitmap Feature : bitmap32 {
+    kChargingPreferences = 0x1;
+    kSoCReporting = 0x2;
+    kPlugAndCharge = 0x4;
+    kRFID = 0x8;
+    kV2X = 0x10;
+  }
+
+  bitmap TargetDayOfWeekBitmap : bitmap8 {
+    kSunday = 0x1;
+    kMonday = 0x2;
+    kTuesday = 0x4;
+    kWednesday = 0x8;
+    kThursday = 0x10;
+    kFriday = 0x20;
+    kSaturday = 0x40;
+  }
+
+  struct ChargingTargetStruct {
+    int16u targetTimeMinutesPastMidnight = 0;
+    optional percent targetSoC = 1;
+    optional energy_mwh addedEnergy = 2;
+  }
+
+  info event EVConnected = 0 {
+    int32u sessionID = 0;
+  }
+
+  info event EVNotDetected = 1 {
+    int32u sessionID = 0;
+    StateEnum state = 1;
+    elapsed_s sessionDuration = 2;
+    energy_mwh sessionEnergyCharged = 3;
+    optional energy_mwh sessionEnergyDischarged = 4;
+  }
+
+  info event EnergyTransferStarted = 2 {
+    int32u sessionID = 0;
+    StateEnum state = 1;
+    amperage_ma maximumCurrent = 2;
+  }
+
+  info event EnergyTransferStopped = 3 {
+    int32u sessionID = 0;
+    StateEnum state = 1;
+    EnergyTransferStoppedReasonEnum reason = 2;
+    energy_mwh energyTransferred = 4;
+  }
+
+  critical event Fault = 4 {
+    nullable int32u sessionID = 0;
+    StateEnum state = 1;
+    FaultStateEnum faultStatePreviousState = 2;
+    FaultStateEnum faultStateCurrentState = 4;
+  }
+
+  info event RFID = 5 {
+    octet_string uid = 0;
+  }
+
+  readonly attribute nullable StateEnum state = 0;
+  readonly attribute SupplyStateEnum supplyState = 1;
+  readonly attribute FaultStateEnum faultState = 2;
+  readonly attribute nullable epoch_s chargingEnabledUntil = 3;
+  readonly attribute optional nullable epoch_s dischargingEnabledUntil = 4;
+  readonly attribute amperage_ma circuitCapacity = 5;
+  readonly attribute amperage_ma minimumChargeCurrent = 6;
+  readonly attribute amperage_ma maximumChargeCurrent = 7;
+  readonly attribute optional amperage_ma maximumDischargeCurrent = 8;
+  attribute access(write: manage) optional amperage_ma userMaximumChargeCurrent = 9;
+  attribute access(write: manage) optional elapsed_s randomizationDelayWindow = 10;
+  readonly attribute optional int8u numberOfWeeklyTargets = 33;
+  readonly attribute optional int8u numberOfDailyTargets = 34;
+  readonly attribute optional nullable epoch_s nextChargeStartTime = 35;
+  readonly attribute optional nullable epoch_s nextChargeTargetTime = 36;
+  readonly attribute optional nullable energy_mwh nextChargeRequiredEnergy = 37;
+  readonly attribute optional nullable percent nextChargeTargetSoC = 38;
+  attribute access(write: manage) optional nullable int16u approximateEVEfficiency = 39;
+  readonly attribute optional nullable percent stateOfCharge = 48;
+  readonly attribute optional nullable energy_mwh batteryCapacity = 49;
+  readonly attribute optional nullable char_string<32> vehicleID = 50;
+  readonly attribute nullable int32u sessionID = 64;
+  readonly attribute nullable elapsed_s sessionDuration = 65;
+  readonly attribute nullable energy_mwh sessionEnergyCharged = 66;
+  readonly attribute optional nullable energy_mwh sessionEnergyDischarged = 67;
+  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;
+
+  response struct GetTargetsResponse = 0 {
+    TargetDayOfWeekBitmap dayOfWeekforSequence = 0;
+    ChargingTargetStruct chargingTargets[] = 1;
+  }
+
+  request struct EnableChargingRequest {
+    nullable epoch_s chargingEnabledUntil = 0;
+    amperage_ma minimumChargeCurrent = 1;
+    amperage_ma maximumChargeCurrent = 2;
+  }
+
+  request struct EnableDischargingRequest {
+    nullable epoch_s dischargingEnabledUntil = 0;
+    amperage_ma maximumDischargeCurrent = 1;
+  }
+
+  request struct SetTargetsRequest {
+    TargetDayOfWeekBitmap dayOfWeekforSequence = 0;
+    ChargingTargetStruct chargingTargets[] = 1;
+  }
+
+  request struct GetTargetsRequest {
+    TargetDayOfWeekBitmap daysToReturn = 0;
+  }
+
+  /** Allows a client to disable the EVSE from charging and discharging. */
+  timed command Disable(): DefaultSuccess = 1;
+  /** Allows a client to enable the EVSE to charge an EV. */
+  timed command EnableCharging(EnableChargingRequest): DefaultSuccess = 2;
+  /** Allows a client to enable the EVSE to discharge an EV. */
+  timed command EnableDischarging(EnableDischargingRequest): DefaultSuccess = 3;
+  /** Allows a client to put the EVSE into a self-diagnostics mode. */
+  timed command StartDiagnostics(): DefaultSuccess = 4;
+  /** Allows a client to set the user specified charging targets. */
+  timed command SetTargets(SetTargetsRequest): DefaultSuccess = 5;
+  /** Allows a client to retrieve the user specified charging targets. */
+  timed command GetTargets(GetTargetsRequest): GetTargetsResponse = 6;
+  /** Allows a client to clear all stored charging targets. */
+  timed command ClearTargets(): DefaultSuccess = 7;
+}
+
 /** Provides an interface for controlling and adjusting automatic window coverings. */
 cluster WindowCovering = 258 {
   revision 5;
@@ -7141,6 +7322,40 @@ endpoint 1 {
     ram      attribute clusterRevision default = 1;
   }
 
+  server cluster EnergyEvse {
+    callback attribute state default = 0;
+    callback attribute supplyState default = 0;
+    callback attribute faultState default = 0;
+    callback attribute chargingEnabledUntil default = 0;
+    callback attribute dischargingEnabledUntil default = 0;
+    callback attribute circuitCapacity default = 0;
+    callback attribute minimumChargeCurrent default = 6000;
+    callback attribute maximumChargeCurrent default = 0;
+    callback attribute maximumDischargeCurrent default = 0;
+    callback attribute userMaximumChargeCurrent default = 0;
+    callback attribute randomizationDelayWindow default = 600;
+    callback attribute numberOfWeeklyTargets default = 0;
+    callback attribute numberOfDailyTargets default = 1;
+    callback attribute nextChargeStartTime;
+    callback attribute nextChargeTargetTime;
+    callback attribute nextChargeRequiredEnergy;
+    callback attribute nextChargeTargetSoC;
+    callback attribute approximateEVEfficiency default = 0xFFFF;
+    callback attribute stateOfCharge;
+    callback attribute batteryCapacity;
+    callback attribute vehicleID;
+    callback attribute sessionID;
+    callback attribute sessionDuration;
+    callback attribute sessionEnergyCharged;
+    callback attribute sessionEnergyDischarged;
+    callback attribute generatedCommandList;
+    callback attribute acceptedCommandList;
+    callback attribute eventList;
+    callback attribute attributeList;
+    ram      attribute featureMap default = 0;
+    ram      attribute clusterRevision default = 2;
+  }
+
   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 2a331d5674f0e4..69c6f8ec0cb8de 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
@@ -17,12 +17,6 @@
     }
   ],
   "package": [
-    {
-      "pathRelativity": "relativeToZap",
-      "path": "../../../src/app/zap-templates/app-templates.json",
-      "type": "gen-templates-json",
-      "version": "chip-v1"
-    },
     {
       "pathRelativity": "relativeToZap",
       "path": "../../../src/app/zap-templates/zcl/zcl-with-test-extensions.json",
@@ -30,6 +24,12 @@
       "category": "matter",
       "version": 1,
       "description": "Matter SDK ZCL data with some extensions"
+    },
+    {
+      "pathRelativity": "relativeToZap",
+      "path": "../../../src/app/zap-templates/app-templates.json",
+      "type": "gen-templates-json",
+      "version": "chip-v1"
     }
   ],
   "endpointTypes": [
@@ -7099,6 +7099,7 @@
           "define": "ON_OFF_SWITCH_CONFIGURATION_CLUSTER",
           "side": "server",
           "enabled": 1,
+          "apiMaturity": "deprecated",
           "attributes": [
             {
               "name": "switch type",
@@ -7505,6 +7506,7 @@
           "define": "BINARY_INPUT_BASIC_CLUSTER",
           "side": "server",
           "enabled": 1,
+          "apiMaturity": "deprecated",
           "attributes": [
             {
               "name": "out of service",
@@ -11533,25 +11535,9 @@
           "enabled": 1,
           "apiMaturity": "provisional",
           "attributes": [
-            {
-              "name": "Measured",
-              "code": 0,
-              "mfgCode": null,
-              "side": "server",
-              "type": "boolean",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
-              "defaultValue": "false",
-              "reportable": 1,
-              "minInterval": 1,
-              "maxInterval": 65534,
-              "reportableChange": 0
-            },
             {
               "name": "Accuracy",
-              "code": 1,
+              "code": 0,
               "mfgCode": null,
               "side": "server",
               "type": "MeasurementAccuracyStruct",
@@ -11567,7 +11553,7 @@
             },
             {
               "name": "CumulativeEnergyImported",
-              "code": 2,
+              "code": 1,
               "mfgCode": null,
               "side": "server",
               "type": "EnergyMeasurementStruct",
@@ -11583,7 +11569,7 @@
             },
             {
               "name": "CumulativeEnergyExported",
-              "code": 3,
+              "code": 2,
               "mfgCode": null,
               "side": "server",
               "type": "EnergyMeasurementStruct",
@@ -11599,7 +11585,7 @@
             },
             {
               "name": "PeriodicEnergyImported",
-              "code": 4,
+              "code": 3,
               "mfgCode": null,
               "side": "server",
               "type": "EnergyMeasurementStruct",
@@ -11615,7 +11601,7 @@
             },
             {
               "name": "PeriodicEnergyExported",
-              "code": 5,
+              "code": 4,
               "mfgCode": null,
               "side": "server",
               "type": "EnergyMeasurementStruct",
@@ -11744,303 +11730,810 @@
           ]
         },
         {
-          "name": "Window Covering",
-          "code": 258,
+          "name": "Energy EVSE",
+          "code": 153,
           "mfgCode": null,
-          "define": "WINDOW_COVERING_CLUSTER",
+          "define": "ENERGY_EVSE_CLUSTER",
           "side": "server",
           "enabled": 1,
-          "commands": [
-            {
-              "name": "UpOrOpen",
-              "code": 0,
-              "mfgCode": null,
-              "source": "client",
-              "isIncoming": 1,
-              "isEnabled": 1
-            },
-            {
-              "name": "DownOrClose",
-              "code": 1,
-              "mfgCode": null,
-              "source": "client",
-              "isIncoming": 1,
-              "isEnabled": 1
-            },
-            {
-              "name": "StopMotion",
-              "code": 2,
-              "mfgCode": null,
-              "source": "client",
-              "isIncoming": 1,
-              "isEnabled": 1
-            },
-            {
-              "name": "GoToLiftValue",
-              "code": 4,
-              "mfgCode": null,
-              "source": "client",
-              "isIncoming": 1,
-              "isEnabled": 1
-            },
-            {
-              "name": "GoToLiftPercentage",
-              "code": 5,
-              "mfgCode": null,
-              "source": "client",
-              "isIncoming": 1,
-              "isEnabled": 1
-            },
-            {
-              "name": "GoToTiltValue",
-              "code": 7,
-              "mfgCode": null,
-              "source": "client",
-              "isIncoming": 1,
-              "isEnabled": 1
-            },
-            {
-              "name": "GoToTiltPercentage",
-              "code": 8,
-              "mfgCode": null,
-              "source": "client",
-              "isIncoming": 1,
-              "isEnabled": 1
-            }
-          ],
+          "apiMaturity": "provisional",
           "attributes": [
             {
-              "name": "Type",
+              "name": "State",
               "code": 0,
               "mfgCode": null,
               "side": "server",
-              "type": "Type",
+              "type": "StateEnum",
               "included": 1,
-              "storageOption": "RAM",
+              "storageOption": "External",
               "singleton": 0,
               "bounded": 0,
-              "defaultValue": "0x08",
+              "defaultValue": "0",
               "reportable": 1,
-              "minInterval": 0,
-              "maxInterval": 65344,
+              "minInterval": 1,
+              "maxInterval": 65534,
               "reportableChange": 0
             },
             {
-              "name": "PhysicalClosedLimitLift",
+              "name": "SupplyState",
               "code": 1,
               "mfgCode": null,
               "side": "server",
-              "type": "int16u",
+              "type": "SupplyStateEnum",
               "included": 1,
-              "storageOption": "RAM",
+              "storageOption": "External",
               "singleton": 0,
               "bounded": 0,
-              "defaultValue": "0xFFFF",
+              "defaultValue": "0",
               "reportable": 1,
-              "minInterval": 0,
-              "maxInterval": 65545,
+              "minInterval": 1,
+              "maxInterval": 65534,
               "reportableChange": 0
             },
             {
-              "name": "PhysicalClosedLimitTilt",
+              "name": "FaultState",
               "code": 2,
               "mfgCode": null,
               "side": "server",
-              "type": "int16u",
+              "type": "FaultStateEnum",
               "included": 1,
-              "storageOption": "RAM",
+              "storageOption": "External",
               "singleton": 0,
               "bounded": 0,
-              "defaultValue": "0xFFFF",
+              "defaultValue": "0",
               "reportable": 1,
-              "minInterval": 0,
-              "maxInterval": 65545,
+              "minInterval": 1,
+              "maxInterval": 65534,
               "reportableChange": 0
             },
             {
-              "name": "CurrentPositionLift",
+              "name": "ChargingEnabledUntil",
               "code": 3,
               "mfgCode": null,
               "side": "server",
-              "type": "int16u",
+              "type": "epoch_s",
               "included": 1,
-              "storageOption": "NVM",
+              "storageOption": "External",
               "singleton": 0,
               "bounded": 0,
-              "defaultValue": "0x7FFF",
+              "defaultValue": "0",
               "reportable": 1,
-              "minInterval": 0,
-              "maxInterval": 65344,
+              "minInterval": 1,
+              "maxInterval": 65534,
               "reportableChange": 0
             },
             {
-              "name": "CurrentPositionTilt",
+              "name": "DischargingEnabledUntil",
               "code": 4,
               "mfgCode": null,
               "side": "server",
-              "type": "int16u",
+              "type": "epoch_s",
               "included": 1,
-              "storageOption": "NVM",
+              "storageOption": "External",
               "singleton": 0,
               "bounded": 0,
-              "defaultValue": "0x7FFF",
+              "defaultValue": "0",
               "reportable": 1,
-              "minInterval": 0,
-              "maxInterval": 65344,
+              "minInterval": 1,
+              "maxInterval": 65534,
               "reportableChange": 0
             },
             {
-              "name": "NumberOfActuationsLift",
+              "name": "CircuitCapacity",
               "code": 5,
               "mfgCode": null,
               "side": "server",
-              "type": "int16u",
+              "type": "amperage_ma",
               "included": 1,
-              "storageOption": "NVM",
+              "storageOption": "External",
               "singleton": 0,
               "bounded": 0,
-              "defaultValue": "0x0000",
+              "defaultValue": "0",
               "reportable": 1,
-              "minInterval": 0,
-              "maxInterval": 65545,
+              "minInterval": 1,
+              "maxInterval": 65534,
               "reportableChange": 0
             },
             {
-              "name": "NumberOfActuationsTilt",
+              "name": "MinimumChargeCurrent",
               "code": 6,
               "mfgCode": null,
               "side": "server",
-              "type": "int16u",
+              "type": "amperage_ma",
               "included": 1,
-              "storageOption": "NVM",
+              "storageOption": "External",
               "singleton": 0,
               "bounded": 0,
-              "defaultValue": "0x0000",
+              "defaultValue": "6000",
               "reportable": 1,
-              "minInterval": 0,
-              "maxInterval": 65545,
+              "minInterval": 1,
+              "maxInterval": 65534,
               "reportableChange": 0
             },
             {
-              "name": "ConfigStatus",
+              "name": "MaximumChargeCurrent",
               "code": 7,
               "mfgCode": null,
               "side": "server",
-              "type": "ConfigStatus",
+              "type": "amperage_ma",
               "included": 1,
-              "storageOption": "NVM",
+              "storageOption": "External",
               "singleton": 0,
               "bounded": 0,
-              "defaultValue": "0x03",
+              "defaultValue": "0",
               "reportable": 1,
-              "minInterval": 0,
-              "maxInterval": 65344,
+              "minInterval": 1,
+              "maxInterval": 65534,
               "reportableChange": 0
             },
             {
-              "name": "CurrentPositionLiftPercentage",
+              "name": "MaximumDischargeCurrent",
               "code": 8,
               "mfgCode": null,
               "side": "server",
-              "type": "percent",
+              "type": "amperage_ma",
               "included": 1,
-              "storageOption": "NVM",
+              "storageOption": "External",
               "singleton": 0,
               "bounded": 0,
-              "defaultValue": "50",
+              "defaultValue": "0",
               "reportable": 1,
-              "minInterval": 0,
-              "maxInterval": 100,
+              "minInterval": 1,
+              "maxInterval": 65534,
               "reportableChange": 0
             },
             {
-              "name": "CurrentPositionTiltPercentage",
+              "name": "UserMaximumChargeCurrent",
               "code": 9,
               "mfgCode": null,
               "side": "server",
-              "type": "percent",
+              "type": "amperage_ma",
               "included": 1,
-              "storageOption": "NVM",
+              "storageOption": "External",
               "singleton": 0,
               "bounded": 0,
-              "defaultValue": "50",
+              "defaultValue": "0",
               "reportable": 1,
-              "minInterval": 0,
-              "maxInterval": 100,
+              "minInterval": 1,
+              "maxInterval": 65534,
               "reportableChange": 0
             },
             {
-              "name": "OperationalStatus",
+              "name": "RandomizationDelayWindow",
               "code": 10,
               "mfgCode": null,
               "side": "server",
-              "type": "OperationalStatus",
+              "type": "elapsed_s",
               "included": 1,
-              "storageOption": "RAM",
+              "storageOption": "External",
               "singleton": 0,
               "bounded": 0,
-              "defaultValue": "0x00",
+              "defaultValue": "600",
               "reportable": 1,
-              "minInterval": 0,
-              "maxInterval": 127,
+              "minInterval": 1,
+              "maxInterval": 65534,
               "reportableChange": 0
             },
             {
-              "name": "TargetPositionLiftPercent100ths",
-              "code": 11,
+              "name": "NumberOfWeeklyTargets",
+              "code": 33,
               "mfgCode": null,
               "side": "server",
-              "type": "percent100ths",
+              "type": "int8u",
               "included": 1,
-              "storageOption": "RAM",
+              "storageOption": "External",
               "singleton": 0,
               "bounded": 0,
-              "defaultValue": "5000",
+              "defaultValue": "0",
               "reportable": 1,
-              "minInterval": 0,
-              "maxInterval": 10000,
+              "minInterval": 1,
+              "maxInterval": 65534,
               "reportableChange": 0
             },
             {
-              "name": "TargetPositionTiltPercent100ths",
-              "code": 12,
+              "name": "NumberOfDailyTargets",
+              "code": 34,
               "mfgCode": null,
               "side": "server",
-              "type": "percent100ths",
+              "type": "int8u",
               "included": 1,
-              "storageOption": "RAM",
+              "storageOption": "External",
               "singleton": 0,
               "bounded": 0,
-              "defaultValue": "5000",
+              "defaultValue": "1",
               "reportable": 1,
-              "minInterval": 0,
-              "maxInterval": 10000,
+              "minInterval": 1,
+              "maxInterval": 65534,
               "reportableChange": 0
             },
             {
-              "name": "EndProductType",
-              "code": 13,
+              "name": "NextChargeStartTime",
+              "code": 35,
               "mfgCode": null,
               "side": "server",
-              "type": "EndProductType",
+              "type": "epoch_s",
               "included": 1,
-              "storageOption": "RAM",
+              "storageOption": "External",
               "singleton": 0,
               "bounded": 0,
-              "defaultValue": "0x00",
+              "defaultValue": "",
               "reportable": 1,
-              "minInterval": 0,
-              "maxInterval": 65344,
+              "minInterval": 1,
+              "maxInterval": 65534,
               "reportableChange": 0
             },
             {
-              "name": "CurrentPositionLiftPercent100ths",
-              "code": 14,
+              "name": "NextChargeTargetTime",
+              "code": 36,
               "mfgCode": null,
               "side": "server",
-              "type": "percent100ths",
+              "type": "epoch_s",
               "included": 1,
-              "storageOption": "NVM",
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "NextChargeRequiredEnergy",
+              "code": 37,
+              "mfgCode": null,
+              "side": "server",
+              "type": "energy_mwh",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "NextChargeTargetSoC",
+              "code": 38,
+              "mfgCode": null,
+              "side": "server",
+              "type": "percent",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "ApproximateEVEfficiency",
+              "code": 39,
+              "mfgCode": null,
+              "side": "server",
+              "type": "int16u",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0xFFFF",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "StateOfCharge",
+              "code": 48,
+              "mfgCode": null,
+              "side": "server",
+              "type": "percent",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "BatteryCapacity",
+              "code": 49,
+              "mfgCode": null,
+              "side": "server",
+              "type": "energy_mwh",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "VehicleID",
+              "code": 50,
+              "mfgCode": null,
+              "side": "server",
+              "type": "char_string",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "SessionID",
+              "code": 64,
+              "mfgCode": null,
+              "side": "server",
+              "type": "int32u",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "SessionDuration",
+              "code": 65,
+              "mfgCode": null,
+              "side": "server",
+              "type": "elapsed_s",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "SessionEnergyCharged",
+              "code": 66,
+              "mfgCode": null,
+              "side": "server",
+              "type": "energy_mwh",
+              "included": 1,
+              "storageOption": "External",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            },
+            {
+              "name": "SessionEnergyDischarged",
+              "code": 67,
+              "mfgCode": null,
+              "side": "server",
+              "type": "energy_mwh",
+              "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": "RAM",
+              "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": "2",
+              "reportable": 1,
+              "minInterval": 1,
+              "maxInterval": 65534,
+              "reportableChange": 0
+            }
+          ]
+        },
+        {
+          "name": "Window Covering",
+          "code": 258,
+          "mfgCode": null,
+          "define": "WINDOW_COVERING_CLUSTER",
+          "side": "server",
+          "enabled": 1,
+          "commands": [
+            {
+              "name": "UpOrOpen",
+              "code": 0,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "DownOrClose",
+              "code": 1,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "StopMotion",
+              "code": 2,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "GoToLiftValue",
+              "code": 4,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "GoToLiftPercentage",
+              "code": 5,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "GoToTiltValue",
+              "code": 7,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "GoToTiltPercentage",
+              "code": 8,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            }
+          ],
+          "attributes": [
+            {
+              "name": "Type",
+              "code": 0,
+              "mfgCode": null,
+              "side": "server",
+              "type": "Type",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0x08",
+              "reportable": 1,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "PhysicalClosedLimitLift",
+              "code": 1,
+              "mfgCode": null,
+              "side": "server",
+              "type": "int16u",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0xFFFF",
+              "reportable": 1,
+              "minInterval": 0,
+              "maxInterval": 65545,
+              "reportableChange": 0
+            },
+            {
+              "name": "PhysicalClosedLimitTilt",
+              "code": 2,
+              "mfgCode": null,
+              "side": "server",
+              "type": "int16u",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0xFFFF",
+              "reportable": 1,
+              "minInterval": 0,
+              "maxInterval": 65545,
+              "reportableChange": 0
+            },
+            {
+              "name": "CurrentPositionLift",
+              "code": 3,
+              "mfgCode": null,
+              "side": "server",
+              "type": "int16u",
+              "included": 1,
+              "storageOption": "NVM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0x7FFF",
+              "reportable": 1,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "CurrentPositionTilt",
+              "code": 4,
+              "mfgCode": null,
+              "side": "server",
+              "type": "int16u",
+              "included": 1,
+              "storageOption": "NVM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0x7FFF",
+              "reportable": 1,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "NumberOfActuationsLift",
+              "code": 5,
+              "mfgCode": null,
+              "side": "server",
+              "type": "int16u",
+              "included": 1,
+              "storageOption": "NVM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0x0000",
+              "reportable": 1,
+              "minInterval": 0,
+              "maxInterval": 65545,
+              "reportableChange": 0
+            },
+            {
+              "name": "NumberOfActuationsTilt",
+              "code": 6,
+              "mfgCode": null,
+              "side": "server",
+              "type": "int16u",
+              "included": 1,
+              "storageOption": "NVM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0x0000",
+              "reportable": 1,
+              "minInterval": 0,
+              "maxInterval": 65545,
+              "reportableChange": 0
+            },
+            {
+              "name": "ConfigStatus",
+              "code": 7,
+              "mfgCode": null,
+              "side": "server",
+              "type": "ConfigStatus",
+              "included": 1,
+              "storageOption": "NVM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0x03",
+              "reportable": 1,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "CurrentPositionLiftPercentage",
+              "code": 8,
+              "mfgCode": null,
+              "side": "server",
+              "type": "percent",
+              "included": 1,
+              "storageOption": "NVM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "50",
+              "reportable": 1,
+              "minInterval": 0,
+              "maxInterval": 100,
+              "reportableChange": 0
+            },
+            {
+              "name": "CurrentPositionTiltPercentage",
+              "code": 9,
+              "mfgCode": null,
+              "side": "server",
+              "type": "percent",
+              "included": 1,
+              "storageOption": "NVM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "50",
+              "reportable": 1,
+              "minInterval": 0,
+              "maxInterval": 100,
+              "reportableChange": 0
+            },
+            {
+              "name": "OperationalStatus",
+              "code": 10,
+              "mfgCode": null,
+              "side": "server",
+              "type": "OperationalStatus",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0x00",
+              "reportable": 1,
+              "minInterval": 0,
+              "maxInterval": 127,
+              "reportableChange": 0
+            },
+            {
+              "name": "TargetPositionLiftPercent100ths",
+              "code": 11,
+              "mfgCode": null,
+              "side": "server",
+              "type": "percent100ths",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "5000",
+              "reportable": 1,
+              "minInterval": 0,
+              "maxInterval": 10000,
+              "reportableChange": 0
+            },
+            {
+              "name": "TargetPositionTiltPercent100ths",
+              "code": 12,
+              "mfgCode": null,
+              "side": "server",
+              "type": "percent100ths",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "5000",
+              "reportable": 1,
+              "minInterval": 0,
+              "maxInterval": 10000,
+              "reportableChange": 0
+            },
+            {
+              "name": "EndProductType",
+              "code": 13,
+              "mfgCode": null,
+              "side": "server",
+              "type": "EndProductType",
+              "included": 1,
+              "storageOption": "RAM",
+              "singleton": 0,
+              "bounded": 0,
+              "defaultValue": "0x00",
+              "reportable": 1,
+              "minInterval": 0,
+              "maxInterval": 65344,
+              "reportableChange": 0
+            },
+            {
+              "name": "CurrentPositionLiftPercent100ths",
+              "code": 14,
+              "mfgCode": null,
+              "side": "server",
+              "type": "percent100ths",
+              "included": 1,
+              "storageOption": "NVM",
               "singleton": 0,
               "bounded": 0,
               "defaultValue": "5000",
@@ -12250,6 +12743,7 @@
           "define": "BARRIER_CONTROL_CLUSTER",
           "side": "server",
           "enabled": 1,
+          "apiMaturity": "deprecated",
           "commands": [
             {
               "name": "BarrierControlGoToPercent",
@@ -12880,7 +13374,7 @@
               "code": 17,
               "mfgCode": null,
               "side": "server",
-              "type": "temperature",
+              "type": "int16s",
               "included": 1,
               "storageOption": "RAM",
               "singleton": 0,
@@ -12896,7 +13390,7 @@
               "code": 18,
               "mfgCode": null,
               "side": "server",
-              "type": "temperature",
+              "type": "int16s",
               "included": 1,
               "storageOption": "RAM",
               "singleton": 0,
@@ -12912,7 +13406,7 @@
               "code": 21,
               "mfgCode": null,
               "side": "server",
-              "type": "temperature",
+              "type": "int16s",
               "included": 1,
               "storageOption": "RAM",
               "singleton": 0,
@@ -12928,7 +13422,7 @@
               "code": 22,
               "mfgCode": null,
               "side": "server",
-              "type": "temperature",
+              "type": "int16s",
               "included": 1,
               "storageOption": "RAM",
               "singleton": 0,
@@ -12944,7 +13438,7 @@
               "code": 23,
               "mfgCode": null,
               "side": "server",
-              "type": "temperature",
+              "type": "int16s",
               "included": 1,
               "storageOption": "RAM",
               "singleton": 0,
@@ -12960,7 +13454,7 @@
               "code": 24,
               "mfgCode": null,
               "side": "server",
-              "type": "temperature",
+              "type": "int16s",
               "included": 1,
               "storageOption": "RAM",
               "singleton": 0,
@@ -13061,7 +13555,7 @@
               "storageOption": "External",
               "singleton": 0,
               "bounded": 0,
-              "defaultValue": "",
+              "defaultValue": null,
               "reportable": 1,
               "minInterval": 1,
               "maxInterval": 65534,
@@ -18192,6 +18686,7 @@
           "define": "ELECTRICAL_MEASUREMENT_CLUSTER",
           "side": "server",
           "enabled": 1,
+          "apiMaturity": "deprecated",
           "attributes": [
             {
               "name": "measurement type",
@@ -21961,4 +22456,4 @@
     }
   ],
   "log": []
-}
+}
\ No newline at end of file
diff --git a/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/ElectricalEnergyMeasurementCluster.kt b/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/ElectricalEnergyMeasurementCluster.kt
index c51f3bf35e1d55..d9c3677d557c85 100644
--- a/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/ElectricalEnergyMeasurementCluster.kt
+++ b/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/ElectricalEnergyMeasurementCluster.kt
@@ -17,8 +17,13 @@
 
 package matter.devicecontroller.cluster.clusters
 
-import matter.controller.MatterController
+import java.util.logging.Level
+import java.util.logging.Logger
+import matter.controller.*
+import matter.controller.model.AttributePath
 import matter.devicecontroller.cluster.structs.*
+import matter.tlv.AnonymousTag
+import matter.tlv.TlvReader
 
 class ElectricalEnergyMeasurementCluster(
   private val controller: MatterController,
@@ -51,115 +56,417 @@ class ElectricalEnergyMeasurementCluster(
   class AttributeListAttribute(val value: List<UInt>)
 
   suspend fun readAccuracyAttribute(): AccuracyAttribute {
-    // Implementation needs to be added here
-  }
+    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<ReadData.Attribute>().firstOrNull {
+        it.path.attributeId == ATTRIBUTE_ID
+      }
 
-  suspend fun subscribeAccuracyAttribute(minInterval: Int, maxInterval: Int): AccuracyAttribute {
-    // Implementation needs to be added here
+    requireNotNull(attributeData) { "Accuracy attribute not found in response" }
+
+    // Decode the TLV data into the appropriate type
+    val tlvReader = TlvReader(attributeData.data)
+    val decodedValue: ElectricalEnergyMeasurementClusterMeasurementAccuracyStruct =
+      ElectricalEnergyMeasurementClusterMeasurementAccuracyStruct.fromTlv(AnonymousTag, tlvReader)
+
+    return AccuracyAttribute(decodedValue)
   }
 
   suspend fun readCumulativeEnergyImportedAttribute(): CumulativeEnergyImportedAttribute {
-    // Implementation needs to be added here
-  }
+    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)
 
-  suspend fun subscribeCumulativeEnergyImportedAttribute(
-    minInterval: Int,
-    maxInterval: Int
-  ): CumulativeEnergyImportedAttribute {
-    // Implementation needs to be added here
+    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<ReadData.Attribute>().firstOrNull {
+        it.path.attributeId == ATTRIBUTE_ID
+      }
+
+    requireNotNull(attributeData) { "Cumulativeenergyimported attribute not found in response" }
+
+    // Decode the TLV data into the appropriate type
+    val tlvReader = TlvReader(attributeData.data)
+    val decodedValue: ElectricalEnergyMeasurementClusterEnergyMeasurementStruct? =
+      if (!tlvReader.isNull()) {
+        if (tlvReader.isNextTag(AnonymousTag)) {
+          ElectricalEnergyMeasurementClusterEnergyMeasurementStruct.fromTlv(AnonymousTag, tlvReader)
+        } else {
+          null
+        }
+      } else {
+        tlvReader.getNull(AnonymousTag)
+        null
+      }
+
+    return CumulativeEnergyImportedAttribute(decodedValue)
   }
 
   suspend fun readCumulativeEnergyExportedAttribute(): CumulativeEnergyExportedAttribute {
-    // Implementation needs to be added here
-  }
+    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<ReadData.Attribute>().firstOrNull {
+        it.path.attributeId == ATTRIBUTE_ID
+      }
 
-  suspend fun subscribeCumulativeEnergyExportedAttribute(
-    minInterval: Int,
-    maxInterval: Int
-  ): CumulativeEnergyExportedAttribute {
-    // Implementation needs to be added here
+    requireNotNull(attributeData) { "Cumulativeenergyexported attribute not found in response" }
+
+    // Decode the TLV data into the appropriate type
+    val tlvReader = TlvReader(attributeData.data)
+    val decodedValue: ElectricalEnergyMeasurementClusterEnergyMeasurementStruct? =
+      if (!tlvReader.isNull()) {
+        if (tlvReader.isNextTag(AnonymousTag)) {
+          ElectricalEnergyMeasurementClusterEnergyMeasurementStruct.fromTlv(AnonymousTag, tlvReader)
+        } else {
+          null
+        }
+      } else {
+        tlvReader.getNull(AnonymousTag)
+        null
+      }
+
+    return CumulativeEnergyExportedAttribute(decodedValue)
   }
 
   suspend fun readPeriodicEnergyImportedAttribute(): PeriodicEnergyImportedAttribute {
-    // Implementation needs to be added here
-  }
+    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}")
+    }
 
-  suspend fun subscribePeriodicEnergyImportedAttribute(
-    minInterval: Int,
-    maxInterval: Int
-  ): PeriodicEnergyImportedAttribute {
-    // Implementation needs to be added here
+    logger.log(Level.FINE, "Read command succeeded")
+
+    val attributeData =
+      response.successes.filterIsInstance<ReadData.Attribute>().firstOrNull {
+        it.path.attributeId == ATTRIBUTE_ID
+      }
+
+    requireNotNull(attributeData) { "Periodicenergyimported attribute not found in response" }
+
+    // Decode the TLV data into the appropriate type
+    val tlvReader = TlvReader(attributeData.data)
+    val decodedValue: ElectricalEnergyMeasurementClusterEnergyMeasurementStruct? =
+      if (!tlvReader.isNull()) {
+        if (tlvReader.isNextTag(AnonymousTag)) {
+          ElectricalEnergyMeasurementClusterEnergyMeasurementStruct.fromTlv(AnonymousTag, tlvReader)
+        } else {
+          null
+        }
+      } else {
+        tlvReader.getNull(AnonymousTag)
+        null
+      }
+
+    return PeriodicEnergyImportedAttribute(decodedValue)
   }
 
   suspend fun readPeriodicEnergyExportedAttribute(): PeriodicEnergyExportedAttribute {
-    // Implementation needs to be added here
-  }
+    val ATTRIBUTE_ID: UInt = 4u
+
+    val attributePath =
+      AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID)
 
-  suspend fun subscribePeriodicEnergyExportedAttribute(
-    minInterval: Int,
-    maxInterval: Int
-  ): PeriodicEnergyExportedAttribute {
-    // Implementation needs to be added here
+    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<ReadData.Attribute>().firstOrNull {
+        it.path.attributeId == ATTRIBUTE_ID
+      }
+
+    requireNotNull(attributeData) { "Periodicenergyexported attribute not found in response" }
+
+    // Decode the TLV data into the appropriate type
+    val tlvReader = TlvReader(attributeData.data)
+    val decodedValue: ElectricalEnergyMeasurementClusterEnergyMeasurementStruct? =
+      if (!tlvReader.isNull()) {
+        if (tlvReader.isNextTag(AnonymousTag)) {
+          ElectricalEnergyMeasurementClusterEnergyMeasurementStruct.fromTlv(AnonymousTag, tlvReader)
+        } else {
+          null
+        }
+      } else {
+        tlvReader.getNull(AnonymousTag)
+        null
+      }
+
+    return PeriodicEnergyExportedAttribute(decodedValue)
   }
 
   suspend fun readGeneratedCommandListAttribute(): GeneratedCommandListAttribute {
-    // Implementation needs to be added here
-  }
+    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}")
+    }
 
-  suspend fun subscribeGeneratedCommandListAttribute(
-    minInterval: Int,
-    maxInterval: Int
-  ): GeneratedCommandListAttribute {
-    // Implementation needs to be added here
+    logger.log(Level.FINE, "Read command succeeded")
+
+    val attributeData =
+      response.successes.filterIsInstance<ReadData.Attribute>().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<UInt> =
+      buildList<UInt> {
+        tlvReader.enterArray(AnonymousTag)
+        while (!tlvReader.isEndOfContainer()) {
+          add(tlvReader.getUInt(AnonymousTag))
+        }
+        tlvReader.exitContainer()
+      }
+
+    return GeneratedCommandListAttribute(decodedValue)
   }
 
   suspend fun readAcceptedCommandListAttribute(): AcceptedCommandListAttribute {
-    // Implementation needs to be added here
-  }
+    val ATTRIBUTE_ID: UInt = 65529u
+
+    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<ReadData.Attribute>().firstOrNull {
+        it.path.attributeId == ATTRIBUTE_ID
+      }
+
+    requireNotNull(attributeData) { "Acceptedcommandlist attribute not found in response" }
+
+    // Decode the TLV data into the appropriate type
+    val tlvReader = TlvReader(attributeData.data)
+    val decodedValue: List<UInt> =
+      buildList<UInt> {
+        tlvReader.enterArray(AnonymousTag)
+        while (!tlvReader.isEndOfContainer()) {
+          add(tlvReader.getUInt(AnonymousTag))
+        }
+        tlvReader.exitContainer()
+      }
 
-  suspend fun subscribeAcceptedCommandListAttribute(
-    minInterval: Int,
-    maxInterval: Int
-  ): AcceptedCommandListAttribute {
-    // Implementation needs to be added here
+    return AcceptedCommandListAttribute(decodedValue)
   }
 
   suspend fun readEventListAttribute(): EventListAttribute {
-    // Implementation needs to be added here
-  }
+    val ATTRIBUTE_ID: UInt = 65530u
+
+    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")
 
-  suspend fun subscribeEventListAttribute(minInterval: Int, maxInterval: Int): EventListAttribute {
-    // Implementation needs to be added here
+    val attributeData =
+      response.successes.filterIsInstance<ReadData.Attribute>().firstOrNull {
+        it.path.attributeId == ATTRIBUTE_ID
+      }
+
+    requireNotNull(attributeData) { "Eventlist attribute not found in response" }
+
+    // Decode the TLV data into the appropriate type
+    val tlvReader = TlvReader(attributeData.data)
+    val decodedValue: List<UInt> =
+      buildList<UInt> {
+        tlvReader.enterArray(AnonymousTag)
+        while (!tlvReader.isEndOfContainer()) {
+          add(tlvReader.getUInt(AnonymousTag))
+        }
+        tlvReader.exitContainer()
+      }
+
+    return EventListAttribute(decodedValue)
   }
 
   suspend fun readAttributeListAttribute(): AttributeListAttribute {
-    // Implementation needs to be added here
-  }
+    val ATTRIBUTE_ID: UInt = 65531u
+
+    val attributePath =
+      AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID)
+
+    val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath))
 
-  suspend fun subscribeAttributeListAttribute(
-    minInterval: Int,
-    maxInterval: Int
-  ): AttributeListAttribute {
-    // Implementation needs to be added here
+    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<ReadData.Attribute>().firstOrNull {
+        it.path.attributeId == ATTRIBUTE_ID
+      }
+
+    requireNotNull(attributeData) { "Attributelist attribute not found in response" }
+
+    // Decode the TLV data into the appropriate type
+    val tlvReader = TlvReader(attributeData.data)
+    val decodedValue: List<UInt> =
+      buildList<UInt> {
+        tlvReader.enterArray(AnonymousTag)
+        while (!tlvReader.isEndOfContainer()) {
+          add(tlvReader.getUInt(AnonymousTag))
+        }
+        tlvReader.exitContainer()
+      }
+
+    return AttributeListAttribute(decodedValue)
   }
 
   suspend fun readFeatureMapAttribute(): UInt {
-    // Implementation needs to be added here
-  }
+    val ATTRIBUTE_ID: UInt = 65532u
+
+    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")
 
-  suspend fun subscribeFeatureMapAttribute(minInterval: Int, maxInterval: Int): UInt {
-    // Implementation needs to be added here
+    val attributeData =
+      response.successes.filterIsInstance<ReadData.Attribute>().firstOrNull {
+        it.path.attributeId == ATTRIBUTE_ID
+      }
+
+    requireNotNull(attributeData) { "Featuremap attribute not found in response" }
+
+    // Decode the TLV data into the appropriate type
+    val tlvReader = TlvReader(attributeData.data)
+    val decodedValue: UInt = tlvReader.getUInt(AnonymousTag)
+
+    return decodedValue
   }
 
   suspend fun readClusterRevisionAttribute(): UShort {
-    // Implementation needs to be added here
-  }
+    val ATTRIBUTE_ID: UInt = 65533u
+
+    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<ReadData.Attribute>().firstOrNull {
+        it.path.attributeId == ATTRIBUTE_ID
+      }
+
+    requireNotNull(attributeData) { "Clusterrevision attribute not found in response" }
+
+    // Decode the TLV data into the appropriate type
+    val tlvReader = TlvReader(attributeData.data)
+    val decodedValue: UShort = tlvReader.getUShort(AnonymousTag)
 
-  suspend fun subscribeClusterRevisionAttribute(minInterval: Int, maxInterval: Int): UShort {
-    // Implementation needs to be added here
+    return decodedValue
   }
 
   companion object {
+    private val logger = Logger.getLogger(ElectricalEnergyMeasurementCluster::class.java.name)
     const val CLUSTER_ID: UInt = 145u
   }
 }
diff --git a/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/EnergyEvseCluster.kt b/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/EnergyEvseCluster.kt
index 4372be56350bc3..f6df3feb1d75ef 100644
--- a/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/EnergyEvseCluster.kt
+++ b/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/EnergyEvseCluster.kt
@@ -59,6 +59,12 @@ class EnergyEvseCluster(private val controller: MatterController, private val en
 
   class SessionIDAttribute(val value: UInt?)
 
+  class SessionDurationAttribute(val value: UInt?)
+
+  class SessionEnergyChargedAttribute(val value: Long?)
+
+  class SessionEnergyDischargedAttribute(val value: Long?)
+
   class GeneratedCommandListAttribute(val value: List<UInt>)
 
   class AcceptedCommandListAttribute(val value: List<UInt>)
@@ -1237,7 +1243,7 @@ class EnergyEvseCluster(private val controller: MatterController, private val en
     return SessionIDAttribute(decodedValue)
   }
 
-  suspend fun readSessionDurationAttribute(): UInt {
+  suspend fun readSessionDurationAttribute(): SessionDurationAttribute {
     val ATTRIBUTE_ID: UInt = 65u
 
     val attributePath =
@@ -1263,12 +1269,18 @@ class EnergyEvseCluster(private val controller: MatterController, private val en
 
     // Decode the TLV data into the appropriate type
     val tlvReader = TlvReader(attributeData.data)
-    val decodedValue: UInt = tlvReader.getUInt(AnonymousTag)
+    val decodedValue: UInt? =
+      if (!tlvReader.isNull()) {
+        tlvReader.getUInt(AnonymousTag)
+      } else {
+        tlvReader.getNull(AnonymousTag)
+        null
+      }
 
-    return decodedValue
+    return SessionDurationAttribute(decodedValue)
   }
 
-  suspend fun readSessionEnergyChargedAttribute(): Long {
+  suspend fun readSessionEnergyChargedAttribute(): SessionEnergyChargedAttribute {
     val ATTRIBUTE_ID: UInt = 66u
 
     val attributePath =
@@ -1294,12 +1306,18 @@ class EnergyEvseCluster(private val controller: MatterController, private val en
 
     // Decode the TLV data into the appropriate type
     val tlvReader = TlvReader(attributeData.data)
-    val decodedValue: Long = tlvReader.getLong(AnonymousTag)
+    val decodedValue: Long? =
+      if (!tlvReader.isNull()) {
+        tlvReader.getLong(AnonymousTag)
+      } else {
+        tlvReader.getNull(AnonymousTag)
+        null
+      }
 
-    return decodedValue
+    return SessionEnergyChargedAttribute(decodedValue)
   }
 
-  suspend fun readSessionEnergyDischargedAttribute(): Long? {
+  suspend fun readSessionEnergyDischargedAttribute(): SessionEnergyDischargedAttribute {
     val ATTRIBUTE_ID: UInt = 67u
 
     val attributePath =
@@ -1326,13 +1344,18 @@ class EnergyEvseCluster(private val controller: MatterController, private val en
     // Decode the TLV data into the appropriate type
     val tlvReader = TlvReader(attributeData.data)
     val decodedValue: Long? =
-      if (tlvReader.isNextTag(AnonymousTag)) {
-        tlvReader.getLong(AnonymousTag)
+      if (!tlvReader.isNull()) {
+        if (tlvReader.isNextTag(AnonymousTag)) {
+          tlvReader.getLong(AnonymousTag)
+        } else {
+          null
+        }
       } else {
+        tlvReader.getNull(AnonymousTag)
         null
       }
 
-    return decodedValue
+    return SessionEnergyDischargedAttribute(decodedValue)
   }
 
   suspend fun readGeneratedCommandListAttribute(): GeneratedCommandListAttribute {
diff --git a/src/controller/java/generated/java/matter/devicecontroller/cluster/eventstructs/EnergyEvseClusterFaultEvent.kt b/src/controller/java/generated/java/matter/devicecontroller/cluster/eventstructs/EnergyEvseClusterFaultEvent.kt
index e45f41025d3dfb..0a36188a87459f 100644
--- a/src/controller/java/generated/java/matter/devicecontroller/cluster/eventstructs/EnergyEvseClusterFaultEvent.kt
+++ b/src/controller/java/generated/java/matter/devicecontroller/cluster/eventstructs/EnergyEvseClusterFaultEvent.kt
@@ -23,7 +23,7 @@ import matter.tlv.TlvReader
 import matter.tlv.TlvWriter
 
 class EnergyEvseClusterFaultEvent(
-  val sessionID: UInt,
+  val sessionID: UInt?,
   val state: UByte,
   val faultStatePreviousState: UByte,
   val faultStateCurrentState: UByte
@@ -40,7 +40,11 @@ class EnergyEvseClusterFaultEvent(
   fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) {
     tlvWriter.apply {
       startStructure(tlvTag)
-      put(ContextSpecificTag(TAG_SESSION_I_D), sessionID)
+      if (sessionID != null) {
+        put(ContextSpecificTag(TAG_SESSION_I_D), sessionID)
+      } else {
+        putNull(ContextSpecificTag(TAG_SESSION_I_D))
+      }
       put(ContextSpecificTag(TAG_STATE), state)
       put(ContextSpecificTag(TAG_FAULT_STATE_PREVIOUS_STATE), faultStatePreviousState)
       put(ContextSpecificTag(TAG_FAULT_STATE_CURRENT_STATE), faultStateCurrentState)
@@ -56,7 +60,13 @@ class EnergyEvseClusterFaultEvent(
 
     fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyEvseClusterFaultEvent {
       tlvReader.enterStructure(tlvTag)
-      val sessionID = tlvReader.getUInt(ContextSpecificTag(TAG_SESSION_I_D))
+      val sessionID =
+        if (!tlvReader.isNull()) {
+          tlvReader.getUInt(ContextSpecificTag(TAG_SESSION_I_D))
+        } else {
+          tlvReader.getNull(ContextSpecificTag(TAG_SESSION_I_D))
+          null
+        }
       val state = tlvReader.getUByte(ContextSpecificTag(TAG_STATE))
       val faultStatePreviousState =
         tlvReader.getUByte(ContextSpecificTag(TAG_FAULT_STATE_PREVIOUS_STATE))
diff --git a/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/ElectricalEnergyMeasurementClusterMeasurementAccuracyStruct.kt b/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/ElectricalEnergyMeasurementClusterMeasurementAccuracyStruct.kt
index 6fa6a4b048c2a2..9324ea44aebf88 100644
--- a/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/ElectricalEnergyMeasurementClusterMeasurementAccuracyStruct.kt
+++ b/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/ElectricalEnergyMeasurementClusterMeasurementAccuracyStruct.kt
@@ -24,7 +24,7 @@ import matter.tlv.TlvReader
 import matter.tlv.TlvWriter
 
 class ElectricalEnergyMeasurementClusterMeasurementAccuracyStruct(
-  val measurementType: UInt,
+  val measurementType: UShort,
   val measured: Boolean,
   val minMeasuredValue: Long,
   val maxMeasuredValue: Long,
@@ -68,7 +68,7 @@ class ElectricalEnergyMeasurementClusterMeasurementAccuracyStruct(
       tlvReader: TlvReader
     ): ElectricalEnergyMeasurementClusterMeasurementAccuracyStruct {
       tlvReader.enterStructure(tlvTag)
-      val measurementType = tlvReader.getUInt(ContextSpecificTag(TAG_MEASUREMENT_TYPE))
+      val measurementType = tlvReader.getUShort(ContextSpecificTag(TAG_MEASUREMENT_TYPE))
       val measured = tlvReader.getBoolean(ContextSpecificTag(TAG_MEASURED))
       val minMeasuredValue = tlvReader.getLong(ContextSpecificTag(TAG_MIN_MEASURED_VALUE))
       val maxMeasuredValue = tlvReader.getLong(ContextSpecificTag(TAG_MAX_MEASURED_VALUE))

From 30e6e8b5cd76a9c778dd9dff527a318483d79e09 Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Tue, 12 Dec 2023 13:31:39 +0000
Subject: [PATCH 44/80] Fix review comment.

---
 .../all-clusters-common/src/EnergyEvseManager.cpp            | 5 ++---
 .../energy-management-common/src/EnergyEvseManager.cpp       | 5 ++---
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp
index 9b5cdac4df5f36..0d84d8856212e0 100644
--- a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp
+++ b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp
@@ -24,11 +24,10 @@ using namespace chip::app::Clusters::EnergyEvse;
 
 CHIP_ERROR EnergyEvseManager::Init()
 {
-    this->Instance::Init();
-    return CHIP_NO_ERROR;
+    return Instance::Init();
 }
 
 void EnergyEvseManager::Shutdown()
 {
-    this->Instance::Shutdown();
+    Instance::Shutdown();
 }
diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp
index 9b5cdac4df5f36..0d84d8856212e0 100644
--- a/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp
+++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp
@@ -24,11 +24,10 @@ using namespace chip::app::Clusters::EnergyEvse;
 
 CHIP_ERROR EnergyEvseManager::Init()
 {
-    this->Instance::Init();
-    return CHIP_NO_ERROR;
+    return Instance::Init();
 }
 
 void EnergyEvseManager::Shutdown()
 {
-    this->Instance::Shutdown();
+    Instance::Shutdown();
 }

From 51dd8cc0d80398daa760842499c6ae7967c78b9f Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Tue, 12 Dec 2023 22:19:37 +0000
Subject: [PATCH 45/80] Ensure Init() returns a failure if there is one.
 Aligned to mode-base-server.cpp

---
 src/app/clusters/energy-evse-server/energy-evse-server.cpp | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/app/clusters/energy-evse-server/energy-evse-server.cpp b/src/app/clusters/energy-evse-server/energy-evse-server.cpp
index 00baabd46b2ad0..e985b667016900 100644
--- a/src/app/clusters/energy-evse-server/energy-evse-server.cpp
+++ b/src/app/clusters/energy-evse-server/energy-evse-server.cpp
@@ -35,15 +35,16 @@ namespace EnergyEvse {
 
 CHIP_ERROR Instance::Init()
 {
-    registerAttributeAccessOverride(this);
-    InteractionModelEngine::GetInstance()->RegisterCommandHandler(this);
+    ReturnErrorOnFailure(InteractionModelEngine::GetInstance()->RegisterCommandHandler(this));
+    VerifyOrReturnError(registerAttributeAccessOverride(this), CHIP_ERROR_INCORRECT_STATE);
+
     return CHIP_NO_ERROR;
 }
 
 void Instance::Shutdown()
 {
-    unregisterAttributeAccessOverride(this);
     InteractionModelEngine::GetInstance()->UnregisterCommandHandler(this);
+    unregisterAttributeAccessOverride(this);
 }
 
 bool Instance::HasFeature(Feature aFeature) const

From 48dd130cf9a92e04f4e94abc2e3c9901a6abad36 Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Tue, 12 Dec 2023 22:48:57 +0000
Subject: [PATCH 46/80] Backed out Read attr check based on features.

---
 .../energy-evse-server/energy-evse-server.cpp | 57 -------------------
 1 file changed, 57 deletions(-)

diff --git a/src/app/clusters/energy-evse-server/energy-evse-server.cpp b/src/app/clusters/energy-evse-server/energy-evse-server.cpp
index e985b667016900..b6b52dfc72168f 100644
--- a/src/app/clusters/energy-evse-server/energy-evse-server.cpp
+++ b/src/app/clusters/energy-evse-server/energy-evse-server.cpp
@@ -77,10 +77,6 @@ CHIP_ERROR Instance::Read(const ConcreteReadAttributePath & aPath, AttributeValu
         return aEncoder.Encode(mDelegate.GetChargingEnabledUntil());
     case DischargingEnabledUntil::Id:
         /* V2X */
-        if (!HasFeature(Feature::kV2x))
-        {
-            return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
-        }
         return aEncoder.Encode(mDelegate.GetDischargingEnabledUntil());
     case CircuitCapacity::Id:
         return aEncoder.Encode(mDelegate.GetCircuitCapacity());
@@ -90,88 +86,35 @@ CHIP_ERROR Instance::Read(const ConcreteReadAttributePath & aPath, AttributeValu
         return aEncoder.Encode(mDelegate.GetMaximumChargeCurrent());
     case MaximumDischargeCurrent::Id:
         /* V2X */
-        if (!HasFeature(Feature::kV2x))
-        {
-            return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
-        }
         return aEncoder.Encode(mDelegate.GetMaximumDischargeCurrent());
 
     case UserMaximumChargeCurrent::Id:
-        if (!SupportsOptAttr(OptionalAttributes::kSupportsUserMaximumChargingCurrent))
-        {
-            return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
-        }
         return aEncoder.Encode(mDelegate.GetUserMaximumChargeCurrent());
     case RandomizationDelayWindow::Id:
         /* Optional */
-        if (!SupportsOptAttr(OptionalAttributes::kSupportsRandomizationWindow))
-        {
-            return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
-        }
         return aEncoder.Encode(mDelegate.GetRandomizationDelayWindow());
     /* PREF - ChargingPreferences attributes */
     case NumberOfWeeklyTargets::Id:
-        if (!HasFeature(Feature::kChargingPreferences))
-        {
-            return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
-        }
         return aEncoder.Encode(mDelegate.GetNumberOfWeeklyTargets());
     case NumberOfDailyTargets::Id:
-        if (!HasFeature(Feature::kChargingPreferences))
-        {
-            return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
-        }
         return aEncoder.Encode(mDelegate.GetNumberOfDailyTargets());
     case NextChargeStartTime::Id:
-        if (!HasFeature(Feature::kChargingPreferences))
-        {
-            return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
-        }
         return aEncoder.Encode(mDelegate.GetNextChargeStartTime());
     case NextChargeTargetTime::Id:
-        if (!HasFeature(Feature::kChargingPreferences))
-        {
-            return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
-        }
         return aEncoder.Encode(mDelegate.GetNextChargeTargetTime());
     case NextChargeRequiredEnergy::Id:
-        if (!HasFeature(Feature::kChargingPreferences))
-        {
-            return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
-        }
         return aEncoder.Encode(mDelegate.GetNextChargeRequiredEnergy());
     case NextChargeTargetSoC::Id:
-        if (!HasFeature(Feature::kChargingPreferences))
-        {
-            return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
-        }
         return aEncoder.Encode(mDelegate.GetNextChargeTargetSoC());
     case ApproximateEVEfficiency::Id:
-        if ((!HasFeature(Feature::kChargingPreferences)) ||
-            (!SupportsOptAttr(OptionalAttributes::kSupportsApproximateEvEfficiency)))
-        {
-            return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
-        }
         return aEncoder.Encode(mDelegate.GetApproximateEVEfficiency());
     /* SOC attributes */
     case StateOfCharge::Id:
-        if (!HasFeature(Feature::kSoCReporting))
-        {
-            return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
-        }
         return aEncoder.Encode(mDelegate.GetStateOfCharge());
     case BatteryCapacity::Id:
-        if (!HasFeature(Feature::kSoCReporting))
-        {
-            return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
-        }
         return aEncoder.Encode(mDelegate.GetBatteryCapacity());
     /* PNC attributes*/
     case VehicleID::Id:
-        if (!HasFeature(Feature::kPlugAndCharge))
-        {
-            return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute);
-        }
         return aEncoder.Encode(mDelegate.GetVehicleID());
     /* Session SESS attributes */
     case SessionID::Id:

From f5928e70c63a56cba397631c196b05472d9657b4 Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Tue, 12 Dec 2023 22:50:04 +0000
Subject: [PATCH 47/80] Fixed EnumerateAcceptedCommands to handle Loop::Break
 condition.

---
 .../energy-evse-server/energy-evse-server.cpp | 25 +++++++++++--------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/src/app/clusters/energy-evse-server/energy-evse-server.cpp b/src/app/clusters/energy-evse-server/energy-evse-server.cpp
index b6b52dfc72168f..e588cbee689ff4 100644
--- a/src/app/clusters/energy-evse-server/energy-evse-server.cpp
+++ b/src/app/clusters/energy-evse-server/energy-evse-server.cpp
@@ -179,36 +179,41 @@ CHIP_ERROR Instance::Write(const ConcreteDataAttributePath & aPath, AttributeVal
 }
 
 // CommandHandlerInterface
-
 CHIP_ERROR Instance::EnumerateAcceptedCommands(const ConcreteClusterPath & cluster, CommandIdCallback callback, void * context)
 {
     using namespace Commands;
 
-    for (auto && id : {
+    for (auto && cmd : {
              Disable::Id,
              EnableCharging::Id,
          })
     {
-        if (callback(id, context) == Loop::Break)
-        {
-            return CHIP_NO_ERROR;
-        }
+        VerifyOrExit(callback(cmd, context) == Loop::Continue, /**/);
     }
 
     if (HasFeature(Feature::kV2x))
     {
-        callback(EnableDischarging::Id, context);
+        VerifyOrExit(callback(EnableDischarging::Id, context) == Loop::Continue, /**/);
     }
+
     if (HasFeature(Feature::kChargingPreferences))
     {
-        callback(SetTargets::Id, context);
-        callback(GetTargets::Id, context);
-        callback(ClearTargets::Id, context);
+        for (auto && cmd : {
+                 SetTargets::Id,
+                 GetTargets::Id,
+                 ClearTargets::Id,
+             })
+        {
+            VerifyOrExit(callback(cmd, context) == Loop::Continue, /**/);
+        }
     }
+
     if (SupportsOptCmd(OptionalCommands::kSupportsStartDiagnostics))
     {
         callback(StartDiagnostics::Id, context);
     }
+
+exit:
     return CHIP_NO_ERROR;
 }
 

From 2fba294eb98b7f46fe89787fa40e6da8a22cba0b Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Tue, 12 Dec 2023 22:51:41 +0000
Subject: [PATCH 48/80] Had missed StartDiagnostic as an optional command in
 InvokeCommand

---
 .../energy-evse-server/energy-evse-server.cpp        | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/app/clusters/energy-evse-server/energy-evse-server.cpp b/src/app/clusters/energy-evse-server/energy-evse-server.cpp
index e588cbee689ff4..60f9e24be0f962 100644
--- a/src/app/clusters/energy-evse-server/energy-evse-server.cpp
+++ b/src/app/clusters/energy-evse-server/energy-evse-server.cpp
@@ -244,8 +244,16 @@ void Instance::InvokeCommand(HandlerContext & handlerContext)
         }
         return;
     case StartDiagnostics::Id:
-        HandleCommand<StartDiagnostics::DecodableType>(
-            handlerContext, [this](HandlerContext & ctx, const auto & commandData) { HandleStartDiagnostics(ctx, commandData); });
+        if (!SupportsOptCmd(OptionalCommands::kSupportsStartDiagnostics))
+        {
+            handlerContext.mCommandHandler.AddStatus(handlerContext.mRequestPath, Status::UnsupportedCommand);
+        }
+        else
+        {
+            HandleCommand<StartDiagnostics::DecodableType>(handlerContext, [this](HandlerContext & ctx, const auto & commandData) {
+                HandleStartDiagnostics(ctx, commandData);
+            });
+        }
         return;
     case SetTargets::Id:
         if (!HasFeature(Feature::kChargingPreferences))

From 70d9cbe381745490833e6d881274ce051b3083ef Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Tue, 12 Dec 2023 23:14:56 +0000
Subject: [PATCH 49/80] Removed extra chip:: in attr types.

---
 .../energy-evse-server/energy-evse-server.h   | 20 +++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/app/clusters/energy-evse-server/energy-evse-server.h b/src/app/clusters/energy-evse-server/energy-evse-server.h
index 756557da63a113..5df2f0149eb1ed 100644
--- a/src/app/clusters/energy-evse-server/energy-evse-server.h
+++ b/src/app/clusters/energy-evse-server/energy-evse-server.h
@@ -93,20 +93,20 @@ class Delegate
     virtual int64_t GetUserMaximumChargeCurrent()                      = 0;
     virtual uint32_t GetRandomizationDelayWindow()                     = 0;
     /* PREF attributes */
-    virtual uint8_t GetNumberOfWeeklyTargets()                          = 0;
-    virtual uint8_t GetNumberOfDailyTargets()                           = 0;
-    virtual DataModel::Nullable<uint32_t> GetNextChargeStartTime()      = 0;
-    virtual DataModel::Nullable<uint32_t> GetNextChargeTargetTime()     = 0;
-    virtual DataModel::Nullable<int64_t> GetNextChargeRequiredEnergy()  = 0;
-    virtual DataModel::Nullable<chip::Percent> GetNextChargeTargetSoC() = 0;
-    virtual DataModel::Nullable<uint16_t> GetApproximateEVEfficiency()  = 0;
+    virtual uint8_t GetNumberOfWeeklyTargets()                         = 0;
+    virtual uint8_t GetNumberOfDailyTargets()                          = 0;
+    virtual DataModel::Nullable<uint32_t> GetNextChargeStartTime()     = 0;
+    virtual DataModel::Nullable<uint32_t> GetNextChargeTargetTime()    = 0;
+    virtual DataModel::Nullable<int64_t> GetNextChargeRequiredEnergy() = 0;
+    virtual DataModel::Nullable<Percent> GetNextChargeTargetSoC()      = 0;
+    virtual DataModel::Nullable<uint16_t> GetApproximateEVEfficiency() = 0;
 
     /* SOC attributes */
-    virtual DataModel::Nullable<chip::Percent> GetStateOfCharge() = 0;
-    virtual DataModel::Nullable<int64_t> GetBatteryCapacity()     = 0;
+    virtual DataModel::Nullable<Percent> GetStateOfCharge()   = 0;
+    virtual DataModel::Nullable<int64_t> GetBatteryCapacity() = 0;
 
     /* PNC attributes*/
-    virtual DataModel::Nullable<chip::CharSpan> GetVehicleID() = 0;
+    virtual DataModel::Nullable<CharSpan> GetVehicleID() = 0;
 
     /* Session SESS attributes */
     virtual DataModel::Nullable<uint32_t> GetSessionID()              = 0;

From 2feb4937f0ff9fab9e219e50eeafbbc69191f533 Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Wed, 13 Dec 2023 00:47:20 +0000
Subject: [PATCH 50/80] Updated HwSetVehicleID to copy the value from callee

---
 .../include/EnergyEvseDelegateImpl.h          |  3 +-
 .../src/EnergyEvseDelegateImpl.cpp            | 31 +++++++++++++++----
 .../include/EnergyEvseDelegateImpl.h          |  3 +-
 .../src/EVSEManufacturerImpl.cpp              |  6 +++-
 .../src/EnergyEvseDelegateImpl.cpp            | 31 +++++++++++++++----
 5 files changed, 59 insertions(+), 15 deletions(-)

diff --git a/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h b/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h
index 6f2d8fda8b63cf..608f0e1e443cad 100644
--- a/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h
+++ b/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h
@@ -75,7 +75,7 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate
     Status HwSetState(StateEnum state);
     Status HwSetFault(FaultStateEnum fault);
     Status HwSetRFID(ByteSpan uid);
-    Status HwSetVehicleID(CharSpan vehID);
+    Status HwSetVehicleID(const CharSpan & vehID);
 
     // ------------------------------------------------------------------
     // Get attribute methods
@@ -139,6 +139,7 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate
     static constexpr int DEFAULT_MIN_CHARGE_CURRENT          = 6000;                  /* 6A */
     static constexpr int DEFAULT_USER_MAXIMUM_CHARGE_CURRENT = kMaximumChargeCurrent; /* 80A */
     static constexpr int DEFAULT_RANDOMIZATION_DELAY_WINDOW  = 600;                   /* 600s */
+    static constexpr int kMaxVehicleIDBufSize                = 32;
 
     /* private variables for controlling the hardware - these are not attributes */
     int64_t mMaxHardwareCurrentLimit                = 0; /* Hardware current limit in mA */
diff --git a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
index 5df53dc97338e5..4016f8310317ea 100644
--- a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
+++ b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
@@ -375,15 +375,34 @@ Status EnergyEvseDelegate::HwSetRFID(ByteSpan uid)
 /**
  * @brief    Called by EVSE Hardware to share the VehicleID
  *
- * @param    C
+ * This routine will make a copy of the string so the callee doesn't
+ * have to hold onto it forever.
+ *
+ * @param    CharSpan containing up to 32 chars.
  */
-Status EnergyEvseDelegate::HwSetVehicleID(CharSpan newValue)
+Status EnergyEvseDelegate::HwSetVehicleID(const CharSpan & newValue)
 {
-    DataModel::Nullable<CharSpan> oldValue = mVehicleID;
-
-    mVehicleID = MakeNullable(newValue);
-    if ((oldValue.IsNull()) || (strcmp(mVehicleID.Value().data(), oldValue.Value().data()) != 0))
+    if ((mVehicleID.IsNull()) || (strcmp(newValue.data(), mVehicleID.Value().data()) != 0))
     {
+        /* create a copy of the string so the callee doesn't have to keep it */
+        char * destinationBuffer = new char[kMaxVehicleIDBufSize];
+
+        MutableCharSpan destinationString(destinationBuffer, kMaxVehicleIDBufSize);
+        CHIP_ERROR err = CopyCharSpanToMutableCharSpan(newValue, destinationString);
+        if (err != CHIP_NO_ERROR)
+        {
+            ChipLogError(AppServer, "HwSetVehicleID - could not copy vehicleID");
+            delete[] destinationBuffer;
+            return Status::Failure;
+        }
+
+        if (!mVehicleID.IsNull())
+        {
+            delete[] mVehicleID.Value().data();
+        }
+
+        mVehicleID = MakeNullable(static_cast<CharSpan>(destinationString));
+
         ChipLogDetail(AppServer, "VehicleID updated to %s", mVehicleID.Value().data());
         MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, VehicleID::Id);
     }
diff --git a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h
index 6f2d8fda8b63cf..608f0e1e443cad 100644
--- a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h
+++ b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h
@@ -75,7 +75,7 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate
     Status HwSetState(StateEnum state);
     Status HwSetFault(FaultStateEnum fault);
     Status HwSetRFID(ByteSpan uid);
-    Status HwSetVehicleID(CharSpan vehID);
+    Status HwSetVehicleID(const CharSpan & vehID);
 
     // ------------------------------------------------------------------
     // Get attribute methods
@@ -139,6 +139,7 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate
     static constexpr int DEFAULT_MIN_CHARGE_CURRENT          = 6000;                  /* 6A */
     static constexpr int DEFAULT_USER_MAXIMUM_CHARGE_CURRENT = kMaximumChargeCurrent; /* 80A */
     static constexpr int DEFAULT_RANDOMIZATION_DELAY_WINDOW  = 600;                   /* 600s */
+    static constexpr int kMaxVehicleIDBufSize                = 32;
 
     /* private variables for controlling the hardware - these are not attributes */
     int64_t mMaxHardwareCurrentLimit                = 0; /* Hardware current limit in mA */
diff --git a/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp b/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp
index 74d44fc6a2d1f4..330e5e23e7a8aa 100644
--- a/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp
+++ b/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp
@@ -43,7 +43,11 @@ CHIP_ERROR EVSEManufacturer::Init(EnergyEvseManager * aInstance)
     dg->HwSetCableAssemblyLimit(63000);
 
     /* For now let's pretend the vehicle ID is set */
-    dg->HwSetVehicleID(CharSpan("TEST_VEHICLE_123456789", 22));
+    dg->HwSetVehicleID(CharSpan::fromCharString("TEST_VEHICLE_123456789"));
+    dg->HwSetVehicleID(CharSpan::fromCharString("TEST_VEHICLE_9876543210"));
+
+    /* This next one will fail because it is too long */
+    dg->HwSetVehicleID(CharSpan::fromCharString("TEST_VEHICLE_9876543210TOOOOOOOOOOOOOOOOOOO"));
 
     /* For now let's pretend the RFID sensor was triggered - send an event */
     uint8_t uid[10] = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE };
diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
index 5df53dc97338e5..4016f8310317ea 100644
--- a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
+++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
@@ -375,15 +375,34 @@ Status EnergyEvseDelegate::HwSetRFID(ByteSpan uid)
 /**
  * @brief    Called by EVSE Hardware to share the VehicleID
  *
- * @param    C
+ * This routine will make a copy of the string so the callee doesn't
+ * have to hold onto it forever.
+ *
+ * @param    CharSpan containing up to 32 chars.
  */
-Status EnergyEvseDelegate::HwSetVehicleID(CharSpan newValue)
+Status EnergyEvseDelegate::HwSetVehicleID(const CharSpan & newValue)
 {
-    DataModel::Nullable<CharSpan> oldValue = mVehicleID;
-
-    mVehicleID = MakeNullable(newValue);
-    if ((oldValue.IsNull()) || (strcmp(mVehicleID.Value().data(), oldValue.Value().data()) != 0))
+    if ((mVehicleID.IsNull()) || (strcmp(newValue.data(), mVehicleID.Value().data()) != 0))
     {
+        /* create a copy of the string so the callee doesn't have to keep it */
+        char * destinationBuffer = new char[kMaxVehicleIDBufSize];
+
+        MutableCharSpan destinationString(destinationBuffer, kMaxVehicleIDBufSize);
+        CHIP_ERROR err = CopyCharSpanToMutableCharSpan(newValue, destinationString);
+        if (err != CHIP_NO_ERROR)
+        {
+            ChipLogError(AppServer, "HwSetVehicleID - could not copy vehicleID");
+            delete[] destinationBuffer;
+            return Status::Failure;
+        }
+
+        if (!mVehicleID.IsNull())
+        {
+            delete[] mVehicleID.Value().data();
+        }
+
+        mVehicleID = MakeNullable(static_cast<CharSpan>(destinationString));
+
         ChipLogDetail(AppServer, "VehicleID updated to %s", mVehicleID.Value().data());
         MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, VehicleID::Id);
     }

From ebe0d14eafd38dc984a67061070872e72e07b32d Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Wed, 13 Dec 2023 20:39:08 +0000
Subject: [PATCH 51/80] Fixed potential buffer overrun in HwSetVehicleID.

---
 .../all-clusters-common/src/EnergyEvseDelegateImpl.cpp        | 4 ++--
 .../energy-management-common/src/EnergyEvseDelegateImpl.cpp   | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
index 4016f8310317ea..82dc9c82aaf3f3 100644
--- a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
+++ b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
@@ -382,7 +382,7 @@ Status EnergyEvseDelegate::HwSetRFID(ByteSpan uid)
  */
 Status EnergyEvseDelegate::HwSetVehicleID(const CharSpan & newValue)
 {
-    if ((mVehicleID.IsNull()) || (strcmp(newValue.data(), mVehicleID.Value().data()) != 0))
+    if (mVehicleID.IsNull() || !newValue.data_equal(mVehicleID.Value()))
     {
         /* create a copy of the string so the callee doesn't have to keep it */
         char * destinationBuffer = new char[kMaxVehicleIDBufSize];
@@ -403,7 +403,7 @@ Status EnergyEvseDelegate::HwSetVehicleID(const CharSpan & newValue)
 
         mVehicleID = MakeNullable(static_cast<CharSpan>(destinationString));
 
-        ChipLogDetail(AppServer, "VehicleID updated to %s", mVehicleID.Value().data());
+        ChipLogDetail(AppServer, "VehicleID updated");
         MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, VehicleID::Id);
     }
 
diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
index 4016f8310317ea..82dc9c82aaf3f3 100644
--- a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
+++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
@@ -382,7 +382,7 @@ Status EnergyEvseDelegate::HwSetRFID(ByteSpan uid)
  */
 Status EnergyEvseDelegate::HwSetVehicleID(const CharSpan & newValue)
 {
-    if ((mVehicleID.IsNull()) || (strcmp(newValue.data(), mVehicleID.Value().data()) != 0))
+    if (mVehicleID.IsNull() || !newValue.data_equal(mVehicleID.Value()))
     {
         /* create a copy of the string so the callee doesn't have to keep it */
         char * destinationBuffer = new char[kMaxVehicleIDBufSize];
@@ -403,7 +403,7 @@ Status EnergyEvseDelegate::HwSetVehicleID(const CharSpan & newValue)
 
         mVehicleID = MakeNullable(static_cast<CharSpan>(destinationString));
 
-        ChipLogDetail(AppServer, "VehicleID updated to %s", mVehicleID.Value().data());
+        ChipLogDetail(AppServer, "VehicleID updated");
         MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, VehicleID::Id);
     }
 

From 90d5c0f79842c92c2444516a0e32da4b0b635db4 Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Wed, 13 Dec 2023 22:38:30 +0000
Subject: [PATCH 52/80] Fixed simple to address comments raised by Andrei in PR
 30857

---
 .../src/EnergyEvseDelegateImpl.cpp            | 109 ++++++++++--------
 1 file changed, 60 insertions(+), 49 deletions(-)

diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
index 82dc9c82aaf3f3..15a784e0ab5e0e 100644
--- a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
+++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
@@ -54,7 +54,7 @@ Status EnergyEvseDelegate::Disable()
         break;
 
     default:
-        ChipLogError(AppServer, "Unexpected EVSE hardware state\n");
+        ChipLogError(AppServer, "Unexpected EVSE hardware state");
         SetState(StateEnum::kFault);
         break;
     }
@@ -128,10 +128,13 @@ Status EnergyEvseDelegate::EnableCharging(const DataModel::Nullable<uint32_t> &
     switch (mHwState)
     {
     case StateEnum::kNotPluggedIn:
+        // TODO handle errors here
         SetState(StateEnum::kNotPluggedIn);
         break;
 
     case StateEnum::kPluggedInNoDemand:
+        // TODO handle errors here
+        //  TODO REFACTOR per Andrei's comment in PR30857 - can we collapse this switch statement?
         SetState(StateEnum::kPluggedInNoDemand);
         break;
 
@@ -141,12 +144,12 @@ Status EnergyEvseDelegate::EnableCharging(const DataModel::Nullable<uint32_t> &
         break;
 
     default:
-        ChipLogError(AppServer, "Unexpected EVSE hardware state\n");
+        ChipLogError(AppServer, "Unexpected EVSE hardware state");
         SetState(StateEnum::kFault);
         break;
     }
 
-    /* update SupplyState */
+    /* update SupplyState to say that charging is now enabled */
     SetSupplyState(SupplyStateEnum::kChargingEnabled);
 
     /* If it looks ok, store the min & max charging current */
@@ -198,7 +201,6 @@ Status EnergyEvseDelegate::StartDiagnostics()
  * FUNCTIONS BELOW:
  *    - EVSE Hardware interface
  *
- *  RegisterEvseHardwareCallback( callbackType, callbackFnc )
  *  SetMaxHardwareCurrentLimit( currentmA )
  *  SetCircuitCapacity( currentmA )
  *  SetCableAssemblyLimit( currentmA )
@@ -207,25 +209,13 @@ Status EnergyEvseDelegate::StartDiagnostics()
  *
  */
 
-/**
- * @brief    Called by EVSE Hardware to register a callback
- *
- * @param    Callback function
- */
-#if 0
-Status EnergyEvseDelegate::HwRegisterEvseHardwareCallback(int Callback) // TODO
-{
-    // TODO
-    return CHIP_NO_ERROR;
-}
-#endif
 /**
  * @brief    Called by EVSE Hardware to notify the delegate of the maximum
  *           current limit supported by the hardware.
  *
  *           This is normally called at start-up.
  *
- * @param    currentmA
+ * @param    currentmA - Maximum current limit supported by the hardware
  */
 Status EnergyEvseDelegate::HwSetMaxHardwareCurrentLimit(int64_t currentmA)
 {
@@ -247,7 +237,7 @@ Status EnergyEvseDelegate::HwSetMaxHardwareCurrentLimit(int64_t currentmA)
  *           This is normally called at start-up when reading from DIP-switch
  *           settings.
  *
- * @param    currentmA
+ * @param    currentmA - Maximum current limit specified by electrician
  */
 Status EnergyEvseDelegate::HwSetCircuitCapacity(int64_t currentmA)
 {
@@ -272,7 +262,7 @@ Status EnergyEvseDelegate::HwSetCircuitCapacity(int64_t currentmA)
  *           using different resistors, which results in different voltages
  *           measured by the EVSE.
  *
- * @param    currentmA
+ * @param    currentmA - Maximum current limit detected from Cable assembly
  */
 Status EnergyEvseDelegate::HwSetCableAssemblyLimit(int64_t currentmA)
 {
@@ -288,17 +278,17 @@ Status EnergyEvseDelegate::HwSetCableAssemblyLimit(int64_t currentmA)
 }
 
 /**
- * @brief    Called by EVSE Hardware to indicate a fault
+ * @brief    Called by EVSE Hardware to indicate if EV is detected
  *
- * @param    StateEnum
+ * The only allowed states that the EVSE hardware can set are:
+ *  kNotPluggedIn
+ *  kPluggedInNoDemand
+ *  kPluggedInDemand
+ *
+ * @param    StateEnum - the state of the EV being plugged in and asking for demand etc
  */
 Status EnergyEvseDelegate::HwSetState(StateEnum state)
 {
-    /* the only allowed states that the EVSE hardware can set are:
-     *  kNotPluggedIn
-     *  kPluggedInNoDemand
-     *  kPluggedInDemand
-     */
     switch (state)
     {
     case StateEnum::kNotPluggedIn:
@@ -326,7 +316,7 @@ Status EnergyEvseDelegate::HwSetState(StateEnum state)
 /**
  * @brief    Called by EVSE Hardware to indicate a fault
  *
- * @param    FaultStateEnum
+ * @param    FaultStateEnum - the fault condition detected
  */
 Status EnergyEvseDelegate::HwSetFault(FaultStateEnum fault)
 {
@@ -372,6 +362,7 @@ Status EnergyEvseDelegate::HwSetRFID(ByteSpan uid)
 
     return Status::Success;
 }
+
 /**
  * @brief    Called by EVSE Hardware to share the VehicleID
  *
@@ -382,31 +373,33 @@ Status EnergyEvseDelegate::HwSetRFID(ByteSpan uid)
  */
 Status EnergyEvseDelegate::HwSetVehicleID(const CharSpan & newValue)
 {
-    if (mVehicleID.IsNull() || !newValue.data_equal(mVehicleID.Value()))
+    if (!mVehicleID.IsNull() && newValue.data_equal(mVehicleID.Value()))
     {
-        /* create a copy of the string so the callee doesn't have to keep it */
-        char * destinationBuffer = new char[kMaxVehicleIDBufSize];
-
-        MutableCharSpan destinationString(destinationBuffer, kMaxVehicleIDBufSize);
-        CHIP_ERROR err = CopyCharSpanToMutableCharSpan(newValue, destinationString);
-        if (err != CHIP_NO_ERROR)
-        {
-            ChipLogError(AppServer, "HwSetVehicleID - could not copy vehicleID");
-            delete[] destinationBuffer;
-            return Status::Failure;
-        }
+        return Status::Success;
+    }
 
-        if (!mVehicleID.IsNull())
-        {
-            delete[] mVehicleID.Value().data();
-        }
+    /* create a copy of the string so the callee doesn't have to keep it */
+    char * destinationBuffer = new char[kMaxVehicleIDBufSize];
 
-        mVehicleID = MakeNullable(static_cast<CharSpan>(destinationString));
+    MutableCharSpan destinationString(destinationBuffer, kMaxVehicleIDBufSize);
+    CHIP_ERROR err = CopyCharSpanToMutableCharSpan(newValue, destinationString);
+    if (err != CHIP_NO_ERROR)
+    {
+        ChipLogError(AppServer, "HwSetVehicleID - could not copy vehicleID");
+        delete[] destinationBuffer;
+        return Status::Failure;
+    }
 
-        ChipLogDetail(AppServer, "VehicleID updated");
-        MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, VehicleID::Id);
+    if (!mVehicleID.IsNull())
+    {
+        delete[] mVehicleID.Value().data();
     }
 
+    mVehicleID = MakeNullable(static_cast<CharSpan>(destinationString));
+
+    ChipLogDetail(AppServer, "VehicleID updated %.*s", static_cast<int>(mVehicleID.Value().size()), mVehicleID.Value().data());
+    MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, VehicleID::Id);
+
     return Status::Success;
 }
 
@@ -457,6 +450,7 @@ StateEnum EnergyEvseDelegate::GetState()
 {
     return mState;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetState(StateEnum newValue)
 {
     StateEnum oldValue = mState;
@@ -468,7 +462,7 @@ CHIP_ERROR EnergyEvseDelegate::SetState(StateEnum newValue)
     mState = newValue;
     if (oldValue != mState)
     {
-        ChipLogDetail(AppServer, "State updated to %d", (int) mState);
+        ChipLogDetail(AppServer, "State updated to %d", static_cast<int>(mState));
         MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, State::Id);
     }
 
@@ -480,6 +474,7 @@ SupplyStateEnum EnergyEvseDelegate::GetSupplyState()
 {
     return mSupplyState;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetSupplyState(SupplyStateEnum newValue)
 {
     SupplyStateEnum oldValue = mSupplyState;
@@ -492,7 +487,7 @@ CHIP_ERROR EnergyEvseDelegate::SetSupplyState(SupplyStateEnum newValue)
     mSupplyState = newValue;
     if (oldValue != mSupplyState)
     {
-        ChipLogDetail(AppServer, "SupplyState updated to %d", (int) mSupplyState);
+        ChipLogDetail(AppServer, "SupplyState updated to %d", static_cast<int>(mSupplyState));
         MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, SupplyState::Id);
     }
     return CHIP_NO_ERROR;
@@ -503,6 +498,7 @@ FaultStateEnum EnergyEvseDelegate::GetFaultState()
 {
     return mFaultState;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetFaultState(FaultStateEnum newValue)
 {
     FaultStateEnum oldValue = mFaultState;
@@ -515,7 +511,7 @@ CHIP_ERROR EnergyEvseDelegate::SetFaultState(FaultStateEnum newValue)
     mFaultState = newValue;
     if (oldValue != mFaultState)
     {
-        ChipLogDetail(AppServer, "FaultState updated to %d", (int) mFaultState);
+        ChipLogDetail(AppServer, "FaultState updated to %d", static_cast<int>(mFaultState));
         MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, FaultState::Id);
     }
     return CHIP_NO_ERROR;
@@ -526,6 +522,7 @@ DataModel::Nullable<uint32_t> EnergyEvseDelegate::GetChargingEnabledUntil()
 {
     return mChargingEnabledUntil;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetChargingEnabledUntil(uint32_t newValue)
 {
     DataModel::Nullable<uint32_t> oldValue = mChargingEnabledUntil;
@@ -539,11 +536,13 @@ CHIP_ERROR EnergyEvseDelegate::SetChargingEnabledUntil(uint32_t newValue)
     }
     return CHIP_NO_ERROR;
 }
+
 /* DischargingEnabledUntil */
 DataModel::Nullable<uint32_t> EnergyEvseDelegate::GetDischargingEnabledUntil()
 {
     return mDischargingEnabledUntil;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetDischargingEnabledUntil(uint32_t newValue)
 {
     DataModel::Nullable<uint32_t> oldValue = mDischargingEnabledUntil;
@@ -557,11 +556,13 @@ CHIP_ERROR EnergyEvseDelegate::SetDischargingEnabledUntil(uint32_t newValue)
     }
     return CHIP_NO_ERROR;
 }
+
 /* CircuitCapacity */
 int64_t EnergyEvseDelegate::GetCircuitCapacity()
 {
     return mCircuitCapacity;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetCircuitCapacity(int64_t newValue)
 {
     int64_t oldValue = mCircuitCapacity;
@@ -579,11 +580,13 @@ CHIP_ERROR EnergyEvseDelegate::SetCircuitCapacity(int64_t newValue)
     }
     return CHIP_NO_ERROR;
 }
+
 /* MinimumChargeCurrent */
 int64_t EnergyEvseDelegate::GetMinimumChargeCurrent()
 {
     return mMinimumChargeCurrent;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetMinimumChargeCurrent(int64_t newValue)
 {
     int64_t oldValue = mMinimumChargeCurrent;
@@ -607,6 +610,7 @@ int64_t EnergyEvseDelegate::GetMaximumChargeCurrent()
 {
     return mMaximumChargeCurrent;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetMaximumChargeCurrent(int64_t newValue)
 {
     int64_t oldValue = mMaximumChargeCurrent;
@@ -624,11 +628,13 @@ CHIP_ERROR EnergyEvseDelegate::SetMaximumChargeCurrent(int64_t newValue)
     }
     return CHIP_NO_ERROR;
 }
+
 /* MaximumDischargeCurrent */
 int64_t EnergyEvseDelegate::GetMaximumDischargeCurrent()
 {
     return mMaximumDischargeCurrent;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetMaximumDischargeCurrent(int64_t newValue)
 {
     int64_t oldValue = mMaximumDischargeCurrent;
@@ -646,11 +652,13 @@ CHIP_ERROR EnergyEvseDelegate::SetMaximumDischargeCurrent(int64_t newValue)
     }
     return CHIP_NO_ERROR;
 }
+
 /* UserMaximumChargeCurrent */
 int64_t EnergyEvseDelegate::GetUserMaximumChargeCurrent()
 {
     return mUserMaximumChargeCurrent;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetUserMaximumChargeCurrent(int64_t newValue)
 {
     if ((newValue < 0) || (newValue > kMaximumChargeCurrent))
@@ -668,11 +676,13 @@ CHIP_ERROR EnergyEvseDelegate::SetUserMaximumChargeCurrent(int64_t newValue)
 
     return CHIP_NO_ERROR;
 }
+
 /* RandomizationDelayWindow */
 uint32_t EnergyEvseDelegate::GetRandomizationDelayWindow()
 {
     return mRandomizationDelayWindow;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetRandomizationDelayWindow(uint32_t newValue)
 {
     uint32_t oldValue = mRandomizationDelayWindow;
@@ -722,6 +732,7 @@ DataModel::Nullable<uint16_t> EnergyEvseDelegate::GetApproximateEVEfficiency()
 {
     return mApproximateEVEfficiency;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetApproximateEVEfficiency(uint16_t newValue)
 {
     DataModel::Nullable<uint16_t> oldValue = mApproximateEVEfficiency;

From 3f7560dc2c24f13562ce69b1fe6d0297d9b001aa Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Wed, 13 Dec 2023 22:38:30 +0000
Subject: [PATCH 53/80] Fixed simple to address comments raised by Andrei in PR
 30857

---
 .../src/EnergyEvseDelegateImpl.cpp            | 109 ++++++++++--------
 1 file changed, 60 insertions(+), 49 deletions(-)

diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
index 82dc9c82aaf3f3..15a784e0ab5e0e 100644
--- a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
+++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
@@ -54,7 +54,7 @@ Status EnergyEvseDelegate::Disable()
         break;
 
     default:
-        ChipLogError(AppServer, "Unexpected EVSE hardware state\n");
+        ChipLogError(AppServer, "Unexpected EVSE hardware state");
         SetState(StateEnum::kFault);
         break;
     }
@@ -128,10 +128,13 @@ Status EnergyEvseDelegate::EnableCharging(const DataModel::Nullable<uint32_t> &
     switch (mHwState)
     {
     case StateEnum::kNotPluggedIn:
+        // TODO handle errors here
         SetState(StateEnum::kNotPluggedIn);
         break;
 
     case StateEnum::kPluggedInNoDemand:
+        // TODO handle errors here
+        //  TODO REFACTOR per Andrei's comment in PR30857 - can we collapse this switch statement?
         SetState(StateEnum::kPluggedInNoDemand);
         break;
 
@@ -141,12 +144,12 @@ Status EnergyEvseDelegate::EnableCharging(const DataModel::Nullable<uint32_t> &
         break;
 
     default:
-        ChipLogError(AppServer, "Unexpected EVSE hardware state\n");
+        ChipLogError(AppServer, "Unexpected EVSE hardware state");
         SetState(StateEnum::kFault);
         break;
     }
 
-    /* update SupplyState */
+    /* update SupplyState to say that charging is now enabled */
     SetSupplyState(SupplyStateEnum::kChargingEnabled);
 
     /* If it looks ok, store the min & max charging current */
@@ -198,7 +201,6 @@ Status EnergyEvseDelegate::StartDiagnostics()
  * FUNCTIONS BELOW:
  *    - EVSE Hardware interface
  *
- *  RegisterEvseHardwareCallback( callbackType, callbackFnc )
  *  SetMaxHardwareCurrentLimit( currentmA )
  *  SetCircuitCapacity( currentmA )
  *  SetCableAssemblyLimit( currentmA )
@@ -207,25 +209,13 @@ Status EnergyEvseDelegate::StartDiagnostics()
  *
  */
 
-/**
- * @brief    Called by EVSE Hardware to register a callback
- *
- * @param    Callback function
- */
-#if 0
-Status EnergyEvseDelegate::HwRegisterEvseHardwareCallback(int Callback) // TODO
-{
-    // TODO
-    return CHIP_NO_ERROR;
-}
-#endif
 /**
  * @brief    Called by EVSE Hardware to notify the delegate of the maximum
  *           current limit supported by the hardware.
  *
  *           This is normally called at start-up.
  *
- * @param    currentmA
+ * @param    currentmA - Maximum current limit supported by the hardware
  */
 Status EnergyEvseDelegate::HwSetMaxHardwareCurrentLimit(int64_t currentmA)
 {
@@ -247,7 +237,7 @@ Status EnergyEvseDelegate::HwSetMaxHardwareCurrentLimit(int64_t currentmA)
  *           This is normally called at start-up when reading from DIP-switch
  *           settings.
  *
- * @param    currentmA
+ * @param    currentmA - Maximum current limit specified by electrician
  */
 Status EnergyEvseDelegate::HwSetCircuitCapacity(int64_t currentmA)
 {
@@ -272,7 +262,7 @@ Status EnergyEvseDelegate::HwSetCircuitCapacity(int64_t currentmA)
  *           using different resistors, which results in different voltages
  *           measured by the EVSE.
  *
- * @param    currentmA
+ * @param    currentmA - Maximum current limit detected from Cable assembly
  */
 Status EnergyEvseDelegate::HwSetCableAssemblyLimit(int64_t currentmA)
 {
@@ -288,17 +278,17 @@ Status EnergyEvseDelegate::HwSetCableAssemblyLimit(int64_t currentmA)
 }
 
 /**
- * @brief    Called by EVSE Hardware to indicate a fault
+ * @brief    Called by EVSE Hardware to indicate if EV is detected
  *
- * @param    StateEnum
+ * The only allowed states that the EVSE hardware can set are:
+ *  kNotPluggedIn
+ *  kPluggedInNoDemand
+ *  kPluggedInDemand
+ *
+ * @param    StateEnum - the state of the EV being plugged in and asking for demand etc
  */
 Status EnergyEvseDelegate::HwSetState(StateEnum state)
 {
-    /* the only allowed states that the EVSE hardware can set are:
-     *  kNotPluggedIn
-     *  kPluggedInNoDemand
-     *  kPluggedInDemand
-     */
     switch (state)
     {
     case StateEnum::kNotPluggedIn:
@@ -326,7 +316,7 @@ Status EnergyEvseDelegate::HwSetState(StateEnum state)
 /**
  * @brief    Called by EVSE Hardware to indicate a fault
  *
- * @param    FaultStateEnum
+ * @param    FaultStateEnum - the fault condition detected
  */
 Status EnergyEvseDelegate::HwSetFault(FaultStateEnum fault)
 {
@@ -372,6 +362,7 @@ Status EnergyEvseDelegate::HwSetRFID(ByteSpan uid)
 
     return Status::Success;
 }
+
 /**
  * @brief    Called by EVSE Hardware to share the VehicleID
  *
@@ -382,31 +373,33 @@ Status EnergyEvseDelegate::HwSetRFID(ByteSpan uid)
  */
 Status EnergyEvseDelegate::HwSetVehicleID(const CharSpan & newValue)
 {
-    if (mVehicleID.IsNull() || !newValue.data_equal(mVehicleID.Value()))
+    if (!mVehicleID.IsNull() && newValue.data_equal(mVehicleID.Value()))
     {
-        /* create a copy of the string so the callee doesn't have to keep it */
-        char * destinationBuffer = new char[kMaxVehicleIDBufSize];
-
-        MutableCharSpan destinationString(destinationBuffer, kMaxVehicleIDBufSize);
-        CHIP_ERROR err = CopyCharSpanToMutableCharSpan(newValue, destinationString);
-        if (err != CHIP_NO_ERROR)
-        {
-            ChipLogError(AppServer, "HwSetVehicleID - could not copy vehicleID");
-            delete[] destinationBuffer;
-            return Status::Failure;
-        }
+        return Status::Success;
+    }
 
-        if (!mVehicleID.IsNull())
-        {
-            delete[] mVehicleID.Value().data();
-        }
+    /* create a copy of the string so the callee doesn't have to keep it */
+    char * destinationBuffer = new char[kMaxVehicleIDBufSize];
 
-        mVehicleID = MakeNullable(static_cast<CharSpan>(destinationString));
+    MutableCharSpan destinationString(destinationBuffer, kMaxVehicleIDBufSize);
+    CHIP_ERROR err = CopyCharSpanToMutableCharSpan(newValue, destinationString);
+    if (err != CHIP_NO_ERROR)
+    {
+        ChipLogError(AppServer, "HwSetVehicleID - could not copy vehicleID");
+        delete[] destinationBuffer;
+        return Status::Failure;
+    }
 
-        ChipLogDetail(AppServer, "VehicleID updated");
-        MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, VehicleID::Id);
+    if (!mVehicleID.IsNull())
+    {
+        delete[] mVehicleID.Value().data();
     }
 
+    mVehicleID = MakeNullable(static_cast<CharSpan>(destinationString));
+
+    ChipLogDetail(AppServer, "VehicleID updated %.*s", static_cast<int>(mVehicleID.Value().size()), mVehicleID.Value().data());
+    MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, VehicleID::Id);
+
     return Status::Success;
 }
 
@@ -457,6 +450,7 @@ StateEnum EnergyEvseDelegate::GetState()
 {
     return mState;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetState(StateEnum newValue)
 {
     StateEnum oldValue = mState;
@@ -468,7 +462,7 @@ CHIP_ERROR EnergyEvseDelegate::SetState(StateEnum newValue)
     mState = newValue;
     if (oldValue != mState)
     {
-        ChipLogDetail(AppServer, "State updated to %d", (int) mState);
+        ChipLogDetail(AppServer, "State updated to %d", static_cast<int>(mState));
         MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, State::Id);
     }
 
@@ -480,6 +474,7 @@ SupplyStateEnum EnergyEvseDelegate::GetSupplyState()
 {
     return mSupplyState;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetSupplyState(SupplyStateEnum newValue)
 {
     SupplyStateEnum oldValue = mSupplyState;
@@ -492,7 +487,7 @@ CHIP_ERROR EnergyEvseDelegate::SetSupplyState(SupplyStateEnum newValue)
     mSupplyState = newValue;
     if (oldValue != mSupplyState)
     {
-        ChipLogDetail(AppServer, "SupplyState updated to %d", (int) mSupplyState);
+        ChipLogDetail(AppServer, "SupplyState updated to %d", static_cast<int>(mSupplyState));
         MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, SupplyState::Id);
     }
     return CHIP_NO_ERROR;
@@ -503,6 +498,7 @@ FaultStateEnum EnergyEvseDelegate::GetFaultState()
 {
     return mFaultState;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetFaultState(FaultStateEnum newValue)
 {
     FaultStateEnum oldValue = mFaultState;
@@ -515,7 +511,7 @@ CHIP_ERROR EnergyEvseDelegate::SetFaultState(FaultStateEnum newValue)
     mFaultState = newValue;
     if (oldValue != mFaultState)
     {
-        ChipLogDetail(AppServer, "FaultState updated to %d", (int) mFaultState);
+        ChipLogDetail(AppServer, "FaultState updated to %d", static_cast<int>(mFaultState));
         MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, FaultState::Id);
     }
     return CHIP_NO_ERROR;
@@ -526,6 +522,7 @@ DataModel::Nullable<uint32_t> EnergyEvseDelegate::GetChargingEnabledUntil()
 {
     return mChargingEnabledUntil;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetChargingEnabledUntil(uint32_t newValue)
 {
     DataModel::Nullable<uint32_t> oldValue = mChargingEnabledUntil;
@@ -539,11 +536,13 @@ CHIP_ERROR EnergyEvseDelegate::SetChargingEnabledUntil(uint32_t newValue)
     }
     return CHIP_NO_ERROR;
 }
+
 /* DischargingEnabledUntil */
 DataModel::Nullable<uint32_t> EnergyEvseDelegate::GetDischargingEnabledUntil()
 {
     return mDischargingEnabledUntil;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetDischargingEnabledUntil(uint32_t newValue)
 {
     DataModel::Nullable<uint32_t> oldValue = mDischargingEnabledUntil;
@@ -557,11 +556,13 @@ CHIP_ERROR EnergyEvseDelegate::SetDischargingEnabledUntil(uint32_t newValue)
     }
     return CHIP_NO_ERROR;
 }
+
 /* CircuitCapacity */
 int64_t EnergyEvseDelegate::GetCircuitCapacity()
 {
     return mCircuitCapacity;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetCircuitCapacity(int64_t newValue)
 {
     int64_t oldValue = mCircuitCapacity;
@@ -579,11 +580,13 @@ CHIP_ERROR EnergyEvseDelegate::SetCircuitCapacity(int64_t newValue)
     }
     return CHIP_NO_ERROR;
 }
+
 /* MinimumChargeCurrent */
 int64_t EnergyEvseDelegate::GetMinimumChargeCurrent()
 {
     return mMinimumChargeCurrent;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetMinimumChargeCurrent(int64_t newValue)
 {
     int64_t oldValue = mMinimumChargeCurrent;
@@ -607,6 +610,7 @@ int64_t EnergyEvseDelegate::GetMaximumChargeCurrent()
 {
     return mMaximumChargeCurrent;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetMaximumChargeCurrent(int64_t newValue)
 {
     int64_t oldValue = mMaximumChargeCurrent;
@@ -624,11 +628,13 @@ CHIP_ERROR EnergyEvseDelegate::SetMaximumChargeCurrent(int64_t newValue)
     }
     return CHIP_NO_ERROR;
 }
+
 /* MaximumDischargeCurrent */
 int64_t EnergyEvseDelegate::GetMaximumDischargeCurrent()
 {
     return mMaximumDischargeCurrent;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetMaximumDischargeCurrent(int64_t newValue)
 {
     int64_t oldValue = mMaximumDischargeCurrent;
@@ -646,11 +652,13 @@ CHIP_ERROR EnergyEvseDelegate::SetMaximumDischargeCurrent(int64_t newValue)
     }
     return CHIP_NO_ERROR;
 }
+
 /* UserMaximumChargeCurrent */
 int64_t EnergyEvseDelegate::GetUserMaximumChargeCurrent()
 {
     return mUserMaximumChargeCurrent;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetUserMaximumChargeCurrent(int64_t newValue)
 {
     if ((newValue < 0) || (newValue > kMaximumChargeCurrent))
@@ -668,11 +676,13 @@ CHIP_ERROR EnergyEvseDelegate::SetUserMaximumChargeCurrent(int64_t newValue)
 
     return CHIP_NO_ERROR;
 }
+
 /* RandomizationDelayWindow */
 uint32_t EnergyEvseDelegate::GetRandomizationDelayWindow()
 {
     return mRandomizationDelayWindow;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetRandomizationDelayWindow(uint32_t newValue)
 {
     uint32_t oldValue = mRandomizationDelayWindow;
@@ -722,6 +732,7 @@ DataModel::Nullable<uint16_t> EnergyEvseDelegate::GetApproximateEVEfficiency()
 {
     return mApproximateEVEfficiency;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetApproximateEVEfficiency(uint16_t newValue)
 {
     DataModel::Nullable<uint16_t> oldValue = mApproximateEVEfficiency;

From 50cad6192039f036fdba298c4b0ef38f45c73b0b Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Thu, 14 Dec 2023 14:08:06 +0000
Subject: [PATCH 54/80] Check Delegate is initialized before calling functions.

---
 .../energy-management-common/src/EVSEManufacturerImpl.cpp   | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp b/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp
index 330e5e23e7a8aa..e5ad19306ea239 100644
--- a/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp
+++ b/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp
@@ -29,6 +29,12 @@ CHIP_ERROR EVSEManufacturer::Init(EnergyEvseManager * aInstance)
 
     /* Register callbacks */
     EnergyEvseDelegate * dg = aInstance->GetDelegate();
+    if (dg == nullptr)
+    {
+        ChipLogError(AppServer, "Delegate is not initialized");
+        return CHIP_ERROR_UNINITIALIZED;
+    }
+
     // TODO EnergyEvseManager::GetInstance()->GetDelegate()->RegisterCallbacks();
 
     /* Set the EVSE Hardware Maximum current limit */

From 848fb882a2a26a2b92564af8daa9d22681daefad Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Thu, 14 Dec 2023 14:08:06 +0000
Subject: [PATCH 55/80] Check Delegate is initialized before calling functions.

---
 .../energy-management-common/src/EVSEManufacturerImpl.cpp   | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp b/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp
index 330e5e23e7a8aa..e5ad19306ea239 100644
--- a/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp
+++ b/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp
@@ -29,6 +29,12 @@ CHIP_ERROR EVSEManufacturer::Init(EnergyEvseManager * aInstance)
 
     /* Register callbacks */
     EnergyEvseDelegate * dg = aInstance->GetDelegate();
+    if (dg == nullptr)
+    {
+        ChipLogError(AppServer, "Delegate is not initialized");
+        return CHIP_ERROR_UNINITIALIZED;
+    }
+
     // TODO EnergyEvseManager::GetInstance()->GetDelegate()->RegisterCallbacks();
 
     /* Set the EVSE Hardware Maximum current limit */

From 5a97d39089f337d1f5f1146d3c6a45c72169052e Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Thu, 14 Dec 2023 15:14:23 +0000
Subject: [PATCH 56/80] Added callbacks into Application code

---
 .../include/EVSECallbacks.h                   | 74 ++++++++++++++
 .../include/EVSEManufacturerImpl.h            |  5 +
 .../include/EnergyEvseDelegateImpl.h          |  8 +-
 .../src/EVSEManufacturerImpl.cpp              | 26 ++++-
 .../src/EnergyEvseDelegateImpl.cpp            | 96 +++++++++++++++----
 5 files changed, 186 insertions(+), 23 deletions(-)
 create mode 100644 examples/energy-management-app/energy-management-common/include/EVSECallbacks.h

diff --git a/examples/energy-management-app/energy-management-common/include/EVSECallbacks.h b/examples/energy-management-app/energy-management-common/include/EVSECallbacks.h
new file mode 100644
index 00000000000000..d318467dc301e6
--- /dev/null
+++ b/examples/energy-management-app/energy-management-common/include/EVSECallbacks.h
@@ -0,0 +1,74 @@
+/*
+ *
+ *    Copyright (c) 2023 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
+
+using namespace chip::app::Clusters::EnergyEvse;
+
+/* This callbacks mechanism is intended to allow different delegates to callback
+ * and inform the manufacturer that something has changed.
+ *
+ * This is not specific to the EnergyEVSE cluster, but includes DeviceEnergyManagement
+ * and potential future clusters.
+ */
+enum EVSECallbackType
+{
+    /*
+     * The State has changed (e.g. from Disabled to Charging, or vice-versa)
+     */
+    StateChanged,
+    /*
+     * ChargeCurrent has changed
+     */
+    ChargeCurrentChanged,
+    /*
+     * Charging Preferences have changed
+     */
+    ChargingPreferencesChanged,
+    /*
+     * DeviceEnergyManagement has changed
+     */
+    DeviceEnergyManagementChanged,
+};
+
+struct EVSECbInfo
+{
+    EVSECallbackType type;
+
+    union
+    {
+        struct
+        {
+            StateEnum state;
+            SupplyStateEnum supplyState;
+        } StateChange;
+
+        struct
+        {
+            int64_t maximumChargeCurrent;
+        } ChargingCurrent;
+    };
+};
+
+typedef void (*EVSECallbackFunc)(const EVSECbInfo * cb, intptr_t arg);
+
+struct EVSECallbackWrapper
+{
+    EVSECallbackFunc handler;
+    intptr_t arg;
+};
\ No newline at end of file
diff --git a/examples/energy-management-app/energy-management-common/include/EVSEManufacturerImpl.h b/examples/energy-management-app/energy-management-common/include/EVSEManufacturerImpl.h
index 34e9027e626ad5..4ff45e925674aa 100644
--- a/examples/energy-management-app/energy-management-common/include/EVSEManufacturerImpl.h
+++ b/examples/energy-management-app/energy-management-common/include/EVSEManufacturerImpl.h
@@ -43,6 +43,11 @@ class EVSEManufacturer
      */
     CHIP_ERROR Shutdown(EnergyEvseManager * aInstance);
 
+    /**
+     * @brief   Main Callback handler from delegate to user code
+     */
+    static void ApplicationCallbackHandler(const EVSECbInfo * cb, intptr_t arg);
+
 private:
 };
 
diff --git a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h
index 608f0e1e443cad..022c6f590ba49d 100644
--- a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h
+++ b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h
@@ -19,6 +19,7 @@
 #pragma once
 
 #include "app/clusters/energy-evse-server/energy-evse-server.h"
+#include <EVSECallbacks.h>
 
 #include <app/util/af.h>
 #include <app/util/config.h>
@@ -68,7 +69,7 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate
 
     // -----------------------------------------------------------------
     // Internal API to allow an EVSE to change its internal state etc
-    // TODO Status HwRegisterEvseHardwareCallback(Callback);
+    Status HwRegisterEvseCallbackHandler(EVSECallbackFunc handler, intptr_t arg);
     Status HwSetMaxHardwareCurrentLimit(int64_t currentmA);
     Status HwSetCircuitCapacity(int64_t currentmA);
     Status HwSetCableAssemblyLimit(int64_t currentmA);
@@ -148,6 +149,11 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate
     int64_t mActualChargingCurrentLimit             = 0;
     StateEnum mHwState                              = StateEnum::kNotPluggedIn; /* Hardware state */
 
+    /* Callback related */
+    EVSECallbackWrapper mCallbacks = { .handler = nullptr }; /* Wrapper to allow callbacks to be registered */
+    Status NotifyApplicationCurrentLimitChange(int64_t maximumChargeCurrent);
+    Status NotifyApplicationStateChange(void);
+
     /**
      * @brief Helper function to work out the charge limit based on conditions and settings
      */
diff --git a/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp b/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp
index e5ad19306ea239..a6de2c576c228f 100644
--- a/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp
+++ b/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp
@@ -35,7 +35,7 @@ CHIP_ERROR EVSEManufacturer::Init(EnergyEvseManager * aInstance)
         return CHIP_ERROR_UNINITIALIZED;
     }
 
-    // TODO EnergyEvseManager::GetInstance()->GetDelegate()->RegisterCallbacks();
+    dg->HwRegisterEvseCallbackHandler(ApplicationCallbackHandler, reinterpret_cast<intptr_t>(nullptr));
 
     /* Set the EVSE Hardware Maximum current limit */
     // For Manufacturer to specify the hardware capability in mA
@@ -67,3 +67,27 @@ CHIP_ERROR EVSEManufacturer::Shutdown(EnergyEvseManager * aInstance)
 
     return CHIP_NO_ERROR;
 }
+
+/**
+ * @brief    Main Callback handler - to be implemented by Manufacturer
+ *
+ * @param    EVSECbInfo describes the type of call back, and a union of structs
+ *           which contain relevant info for the specific callback type
+ *
+ * @param    arg - optional pointer to some context information (see register function)
+ */
+void EVSEManufacturer::ApplicationCallbackHandler(const EVSECbInfo * cb, intptr_t arg)
+{
+    switch (cb->type)
+    {
+    case EVSECallbackType::StateChanged:
+        ChipLogProgress(AppServer, "EVSE callback - state changed");
+        break;
+    case EVSECallbackType::ChargeCurrentChanged:
+        ChipLogProgress(AppServer, "EVSE callback - maxChargeCurrent changed to %ld",
+                        static_cast<long>(cb->ChargingCurrent.maximumChargeCurrent));
+        break;
+    default:
+        ChipLogError(AppServer, "Unhandler EVSE Callback type %d", static_cast<int>(cb->type));
+    }
+}
\ No newline at end of file
diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
index 15a784e0ab5e0e..9793fbe7c38ea3 100644
--- a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
+++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
@@ -73,6 +73,7 @@ Status EnergyEvseDelegate::Disable()
     /* update MaximumDischargeCurrent to 0 */
     SetMaximumDischargeCurrent(0);
 
+    NotifyApplicationStateChange();
     // TODO: Generate events
 
     return Status::Success;
@@ -92,31 +93,31 @@ Status EnergyEvseDelegate::EnableCharging(const DataModel::Nullable<uint32_t> &
 
     if (maximumChargeCurrent < kMinimumChargeCurrent || maximumChargeCurrent > kMaximumChargeCurrent)
     {
-        ChipLogError(NotSpecified, "Maximum Current outside limits");
+        ChipLogError(AppServer, "Maximum Current outside limits");
         return Status::ConstraintError;
     }
 
     if (minimumChargeCurrent < kMinimumChargeCurrent || minimumChargeCurrent > kMaximumChargeCurrent)
     {
-        ChipLogError(NotSpecified, "Maximum Current outside limits");
+        ChipLogError(AppServer, "Maximum Current outside limits");
         return Status::ConstraintError;
     }
 
     if (minimumChargeCurrent > maximumChargeCurrent)
     {
-        ChipLogError(NotSpecified, "Minium Current > Maximum Current!");
+        ChipLogError(AppServer, "Minium Current > Maximum Current!");
         return Status::ConstraintError;
     }
 
     if (chargingEnabledUntil.IsNull())
     {
         /* Charging enabled indefinitely */
-        ChipLogError(NotSpecified, "Charging enabled indefinitely");
+        ChipLogError(AppServer, "Charging enabled indefinitely");
     }
     else
     {
         /* check chargingEnabledUntil is in the future */
-        ChipLogError(NotSpecified, "Charging enabled until: %lu", static_cast<long unsigned int>(chargingEnabledUntil.Value()));
+        ChipLogError(AppServer, "Charging enabled until: %lu", static_cast<long unsigned int>(chargingEnabledUntil.Value()));
         // TODO
         // if (checkChargingEnabled)
     }
@@ -159,6 +160,8 @@ Status EnergyEvseDelegate::EnableCharging(const DataModel::Nullable<uint32_t> &
 
     // TODO: Generate events
 
+    NotifyApplicationStateChange();
+
     return this->ComputeMaxChargeCurrentLimit();
 }
 
@@ -178,6 +181,8 @@ Status EnergyEvseDelegate::EnableDischarging(const DataModel::Nullable<uint32_t>
 
     // TODO: Generate events
 
+    NotifyApplicationStateChange();
+
     return Status::Success;
 }
 
@@ -189,25 +194,42 @@ Status EnergyEvseDelegate::StartDiagnostics()
     /* For EVSE manufacturers to customize */
     ChipLogProgress(AppServer, "EnergyEvseDelegate::StartDiagnostics()");
 
-    /* update SupplyState */
+    /* update SupplyState to indicate in Diagnostics mode */
     SetSupplyState(SupplyStateEnum::kDisabledDiagnostics);
 
     // TODO: Generate events
 
+    // TODO: Notify Application to implement Diagnostics
+
+    NotifyApplicationStateChange();
+
     return Status::Success;
 }
 
 /* ---------------------------------------------------------------------------
- * FUNCTIONS BELOW:
- *    - EVSE Hardware interface
+ *  EVSE Hardware interface below
+ */
+
+/**
+ * @brief    Called by EVSE Hardware to register a callback handler mechanism
  *
- *  SetMaxHardwareCurrentLimit( currentmA )
- *  SetCircuitCapacity( currentmA )
- *  SetCableAssemblyLimit( currentmA )
- *  SetState( EVSEStateEnum )
- *  SetFault
+ *           This is normally called at start-up.
  *
+ * @param    EVSECallbackFunct - function pointer to call
+ * @param    intptr_t          - optional context to provide back to callback handler
  */
+Status EnergyEvseDelegate::HwRegisterEvseCallbackHandler(EVSECallbackFunc handler, intptr_t arg)
+{
+    if (mCallbacks.handler != nullptr)
+    {
+        ChipLogError(AppServer, "Callback handler already initialized");
+        return Status::Failure;
+    }
+    mCallbacks.handler = handler;
+    mCallbacks.arg     = arg;
+
+    return Status::Success;
+}
 
 /**
  * @brief    Called by EVSE Hardware to notify the delegate of the maximum
@@ -409,17 +431,18 @@ Status EnergyEvseDelegate::HwSetVehicleID(const CharSpan & newValue)
 
 /**
  *  @brief   Called to compute the safe charging current limit
+ *
+ * mActualChargingCurrentLimit is the minimum of:
+ *   - MaxHardwareCurrentLimit (of the hardware)
+ *   - CircuitCapacity (set by the electrician - less than the hardware)
+ *   - CableAssemblyLimit (detected when the cable is inserted)
+ *   - MaximumChargeCurrent (from charging command)
+ *   - UserMaximumChargeCurrent (could dynamically change)
+ *
  */
 Status EnergyEvseDelegate::ComputeMaxChargeCurrentLimit()
 {
     int64_t oldValue;
-    /* mActualChargingCurrentLimit is the minimum of:
-     *   - MaxHardwareCurrentLimit (of the hardware)
-     *   - CircuitCapacity (set by the electrician - less than the hardware)
-     *   - CableAssemblyLimit (detected when the cable is inserted)
-     *   - MaximumChargeCurrent (from charging command)
-     *   - UserMaximumChargeCurrent (could dynamically change)
-     */
 
     oldValue                    = mActualChargingCurrentLimit;
     mActualChargingCurrentLimit = mMaxHardwareCurrentLimit;
@@ -437,11 +460,42 @@ Status EnergyEvseDelegate::ComputeMaxChargeCurrentLimit()
         MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, MaximumChargeCurrent::Id);
 
         /* Call the EV Charger hardware current limit callback */
-        // TODO
+        NotifyApplicationCurrentLimitChange(mMaximumChargeCurrent);
     }
     return Status::Success;
 }
 
+Status EnergyEvseDelegate::NotifyApplicationCurrentLimitChange(int64_t maximumChargeCurrent)
+{
+    EVSECbInfo cbInfo;
+
+    cbInfo.type                                 = EVSECallbackType::ChargeCurrentChanged;
+    cbInfo.ChargingCurrent.maximumChargeCurrent = maximumChargeCurrent;
+
+    if (mCallbacks.handler != nullptr)
+    {
+        mCallbacks.handler(&cbInfo, mCallbacks.arg);
+    }
+
+    return Status::Success;
+}
+
+Status EnergyEvseDelegate::NotifyApplicationStateChange(void)
+{
+    EVSECbInfo cbInfo;
+
+    cbInfo.type                    = EVSECallbackType::StateChanged;
+    cbInfo.StateChange.state       = mState;
+    cbInfo.StateChange.supplyState = mSupplyState;
+
+    if (mCallbacks.handler != nullptr)
+    {
+        mCallbacks.handler(&cbInfo, mCallbacks.arg);
+    }
+
+    return Status::Success;
+}
+
 /**
  * Attribute methods
  */

From eaa65f939b1b6e5285b319e38783c3bf9d9ecac7 Mon Sep 17 00:00:00 2001
From: "Restyled.io" <commits@restyled.io>
Date: Thu, 14 Dec 2023 15:15:05 +0000
Subject: [PATCH 57/80] Restyled by whitespace

---
 .../energy-management-common/include/EVSECallbacks.h            | 2 +-
 .../energy-management-common/src/EVSEManufacturerImpl.cpp       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/examples/energy-management-app/energy-management-common/include/EVSECallbacks.h b/examples/energy-management-app/energy-management-common/include/EVSECallbacks.h
index d318467dc301e6..84b6f232fca02e 100644
--- a/examples/energy-management-app/energy-management-common/include/EVSECallbacks.h
+++ b/examples/energy-management-app/energy-management-common/include/EVSECallbacks.h
@@ -71,4 +71,4 @@ struct EVSECallbackWrapper
 {
     EVSECallbackFunc handler;
     intptr_t arg;
-};
\ No newline at end of file
+};
diff --git a/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp b/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp
index a6de2c576c228f..8daf1781103831 100644
--- a/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp
+++ b/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp
@@ -90,4 +90,4 @@ void EVSEManufacturer::ApplicationCallbackHandler(const EVSECbInfo * cb, intptr_
     default:
         ChipLogError(AppServer, "Unhandler EVSE Callback type %d", static_cast<int>(cb->type));
     }
-}
\ No newline at end of file
+}

From e00f848549e6f0bc64e6e0ecf90e9219dde30871 Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Thu, 14 Dec 2023 16:22:33 +0000
Subject: [PATCH 58/80] Ensured that mVehicleID free's any malloc'd CharSpan in
 destructor

---
 .../include/EnergyEvseDelegateImpl.h                  |  2 ++
 .../src/EnergyEvseDelegateImpl.cpp                    | 11 +++++++++++
 .../include/EnergyEvseDelegateImpl.h                  |  2 ++
 .../src/EnergyEvseDelegateImpl.cpp                    | 11 +++++++++++
 4 files changed, 26 insertions(+)

diff --git a/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h b/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h
index 608f0e1e443cad..0a967e2472be8b 100644
--- a/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h
+++ b/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h
@@ -37,6 +37,8 @@ namespace EnergyEvse {
 class EnergyEvseDelegate : public EnergyEvse::Delegate
 {
 public:
+    ~EnergyEvseDelegate();
+
     /**
      * @brief   Called when EVSE cluster receives Disable command
      */
diff --git a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
index 82dc9c82aaf3f3..82adf275eedeb6 100644
--- a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
+++ b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
@@ -31,6 +31,16 @@ using namespace chip::app::Clusters::EnergyEvse::Attributes;
 using chip::app::LogEvent;
 using chip::Protocols::InteractionModel::Status;
 
+EnergyEvseDelegate::~EnergyEvseDelegate()
+{
+    // TODO Fix this as part of issue #30993 refactoring
+    if (!mVehicleID.IsNull())
+    {
+        ChipLogDetail(AppServer, "Freeing VehicleID");
+        delete[] mVehicleID.Value().data();
+    }
+}
+
 /**
  * @brief   Called when EVSE cluster receives Disable command
  */
@@ -382,6 +392,7 @@ Status EnergyEvseDelegate::HwSetRFID(ByteSpan uid)
  */
 Status EnergyEvseDelegate::HwSetVehicleID(const CharSpan & newValue)
 {
+    // TODO this code to be refactored - See Issue #30993
     if (mVehicleID.IsNull() || !newValue.data_equal(mVehicleID.Value()))
     {
         /* create a copy of the string so the callee doesn't have to keep it */
diff --git a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h
index 608f0e1e443cad..0a967e2472be8b 100644
--- a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h
+++ b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h
@@ -37,6 +37,8 @@ namespace EnergyEvse {
 class EnergyEvseDelegate : public EnergyEvse::Delegate
 {
 public:
+    ~EnergyEvseDelegate();
+
     /**
      * @brief   Called when EVSE cluster receives Disable command
      */
diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
index 15a784e0ab5e0e..7ad16c3737dacb 100644
--- a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
+++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
@@ -31,6 +31,16 @@ using namespace chip::app::Clusters::EnergyEvse::Attributes;
 using chip::app::LogEvent;
 using chip::Protocols::InteractionModel::Status;
 
+EnergyEvseDelegate::~EnergyEvseDelegate()
+{
+    // TODO Fix this as part of issue #30993 refactoring
+    if (!mVehicleID.IsNull())
+    {
+        ChipLogDetail(AppServer, "Freeing VehicleID");
+        delete[] mVehicleID.Value().data();
+    }
+}
+
 /**
  * @brief   Called when EVSE cluster receives Disable command
  */
@@ -373,6 +383,7 @@ Status EnergyEvseDelegate::HwSetRFID(ByteSpan uid)
  */
 Status EnergyEvseDelegate::HwSetVehicleID(const CharSpan & newValue)
 {
+    // TODO this code to be refactored - See Issue #30993
     if (!mVehicleID.IsNull() && newValue.data_equal(mVehicleID.Value()))
     {
         return Status::Success;

From 0939d3bc790fcbef332446d5cda4a6fb5ea56b28 Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Thu, 14 Dec 2023 16:29:36 +0000
Subject: [PATCH 59/80] Sync EnergyEvseDelegateImpl.cpp from Example Energy
 Management

---
 .../src/EnergyEvseDelegateImpl.cpp            | 109 ++++++++++--------
 1 file changed, 60 insertions(+), 49 deletions(-)

diff --git a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
index 82adf275eedeb6..7ad16c3737dacb 100644
--- a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
+++ b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
@@ -64,7 +64,7 @@ Status EnergyEvseDelegate::Disable()
         break;
 
     default:
-        ChipLogError(AppServer, "Unexpected EVSE hardware state\n");
+        ChipLogError(AppServer, "Unexpected EVSE hardware state");
         SetState(StateEnum::kFault);
         break;
     }
@@ -138,10 +138,13 @@ Status EnergyEvseDelegate::EnableCharging(const DataModel::Nullable<uint32_t> &
     switch (mHwState)
     {
     case StateEnum::kNotPluggedIn:
+        // TODO handle errors here
         SetState(StateEnum::kNotPluggedIn);
         break;
 
     case StateEnum::kPluggedInNoDemand:
+        // TODO handle errors here
+        //  TODO REFACTOR per Andrei's comment in PR30857 - can we collapse this switch statement?
         SetState(StateEnum::kPluggedInNoDemand);
         break;
 
@@ -151,12 +154,12 @@ Status EnergyEvseDelegate::EnableCharging(const DataModel::Nullable<uint32_t> &
         break;
 
     default:
-        ChipLogError(AppServer, "Unexpected EVSE hardware state\n");
+        ChipLogError(AppServer, "Unexpected EVSE hardware state");
         SetState(StateEnum::kFault);
         break;
     }
 
-    /* update SupplyState */
+    /* update SupplyState to say that charging is now enabled */
     SetSupplyState(SupplyStateEnum::kChargingEnabled);
 
     /* If it looks ok, store the min & max charging current */
@@ -208,7 +211,6 @@ Status EnergyEvseDelegate::StartDiagnostics()
  * FUNCTIONS BELOW:
  *    - EVSE Hardware interface
  *
- *  RegisterEvseHardwareCallback( callbackType, callbackFnc )
  *  SetMaxHardwareCurrentLimit( currentmA )
  *  SetCircuitCapacity( currentmA )
  *  SetCableAssemblyLimit( currentmA )
@@ -217,25 +219,13 @@ Status EnergyEvseDelegate::StartDiagnostics()
  *
  */
 
-/**
- * @brief    Called by EVSE Hardware to register a callback
- *
- * @param    Callback function
- */
-#if 0
-Status EnergyEvseDelegate::HwRegisterEvseHardwareCallback(int Callback) // TODO
-{
-    // TODO
-    return CHIP_NO_ERROR;
-}
-#endif
 /**
  * @brief    Called by EVSE Hardware to notify the delegate of the maximum
  *           current limit supported by the hardware.
  *
  *           This is normally called at start-up.
  *
- * @param    currentmA
+ * @param    currentmA - Maximum current limit supported by the hardware
  */
 Status EnergyEvseDelegate::HwSetMaxHardwareCurrentLimit(int64_t currentmA)
 {
@@ -257,7 +247,7 @@ Status EnergyEvseDelegate::HwSetMaxHardwareCurrentLimit(int64_t currentmA)
  *           This is normally called at start-up when reading from DIP-switch
  *           settings.
  *
- * @param    currentmA
+ * @param    currentmA - Maximum current limit specified by electrician
  */
 Status EnergyEvseDelegate::HwSetCircuitCapacity(int64_t currentmA)
 {
@@ -282,7 +272,7 @@ Status EnergyEvseDelegate::HwSetCircuitCapacity(int64_t currentmA)
  *           using different resistors, which results in different voltages
  *           measured by the EVSE.
  *
- * @param    currentmA
+ * @param    currentmA - Maximum current limit detected from Cable assembly
  */
 Status EnergyEvseDelegate::HwSetCableAssemblyLimit(int64_t currentmA)
 {
@@ -298,17 +288,17 @@ Status EnergyEvseDelegate::HwSetCableAssemblyLimit(int64_t currentmA)
 }
 
 /**
- * @brief    Called by EVSE Hardware to indicate a fault
+ * @brief    Called by EVSE Hardware to indicate if EV is detected
  *
- * @param    StateEnum
+ * The only allowed states that the EVSE hardware can set are:
+ *  kNotPluggedIn
+ *  kPluggedInNoDemand
+ *  kPluggedInDemand
+ *
+ * @param    StateEnum - the state of the EV being plugged in and asking for demand etc
  */
 Status EnergyEvseDelegate::HwSetState(StateEnum state)
 {
-    /* the only allowed states that the EVSE hardware can set are:
-     *  kNotPluggedIn
-     *  kPluggedInNoDemand
-     *  kPluggedInDemand
-     */
     switch (state)
     {
     case StateEnum::kNotPluggedIn:
@@ -336,7 +326,7 @@ Status EnergyEvseDelegate::HwSetState(StateEnum state)
 /**
  * @brief    Called by EVSE Hardware to indicate a fault
  *
- * @param    FaultStateEnum
+ * @param    FaultStateEnum - the fault condition detected
  */
 Status EnergyEvseDelegate::HwSetFault(FaultStateEnum fault)
 {
@@ -382,6 +372,7 @@ Status EnergyEvseDelegate::HwSetRFID(ByteSpan uid)
 
     return Status::Success;
 }
+
 /**
  * @brief    Called by EVSE Hardware to share the VehicleID
  *
@@ -393,31 +384,33 @@ Status EnergyEvseDelegate::HwSetRFID(ByteSpan uid)
 Status EnergyEvseDelegate::HwSetVehicleID(const CharSpan & newValue)
 {
     // TODO this code to be refactored - See Issue #30993
-    if (mVehicleID.IsNull() || !newValue.data_equal(mVehicleID.Value()))
+    if (!mVehicleID.IsNull() && newValue.data_equal(mVehicleID.Value()))
     {
-        /* create a copy of the string so the callee doesn't have to keep it */
-        char * destinationBuffer = new char[kMaxVehicleIDBufSize];
-
-        MutableCharSpan destinationString(destinationBuffer, kMaxVehicleIDBufSize);
-        CHIP_ERROR err = CopyCharSpanToMutableCharSpan(newValue, destinationString);
-        if (err != CHIP_NO_ERROR)
-        {
-            ChipLogError(AppServer, "HwSetVehicleID - could not copy vehicleID");
-            delete[] destinationBuffer;
-            return Status::Failure;
-        }
+        return Status::Success;
+    }
 
-        if (!mVehicleID.IsNull())
-        {
-            delete[] mVehicleID.Value().data();
-        }
+    /* create a copy of the string so the callee doesn't have to keep it */
+    char * destinationBuffer = new char[kMaxVehicleIDBufSize];
 
-        mVehicleID = MakeNullable(static_cast<CharSpan>(destinationString));
+    MutableCharSpan destinationString(destinationBuffer, kMaxVehicleIDBufSize);
+    CHIP_ERROR err = CopyCharSpanToMutableCharSpan(newValue, destinationString);
+    if (err != CHIP_NO_ERROR)
+    {
+        ChipLogError(AppServer, "HwSetVehicleID - could not copy vehicleID");
+        delete[] destinationBuffer;
+        return Status::Failure;
+    }
 
-        ChipLogDetail(AppServer, "VehicleID updated");
-        MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, VehicleID::Id);
+    if (!mVehicleID.IsNull())
+    {
+        delete[] mVehicleID.Value().data();
     }
 
+    mVehicleID = MakeNullable(static_cast<CharSpan>(destinationString));
+
+    ChipLogDetail(AppServer, "VehicleID updated %.*s", static_cast<int>(mVehicleID.Value().size()), mVehicleID.Value().data());
+    MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, VehicleID::Id);
+
     return Status::Success;
 }
 
@@ -468,6 +461,7 @@ StateEnum EnergyEvseDelegate::GetState()
 {
     return mState;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetState(StateEnum newValue)
 {
     StateEnum oldValue = mState;
@@ -479,7 +473,7 @@ CHIP_ERROR EnergyEvseDelegate::SetState(StateEnum newValue)
     mState = newValue;
     if (oldValue != mState)
     {
-        ChipLogDetail(AppServer, "State updated to %d", (int) mState);
+        ChipLogDetail(AppServer, "State updated to %d", static_cast<int>(mState));
         MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, State::Id);
     }
 
@@ -491,6 +485,7 @@ SupplyStateEnum EnergyEvseDelegate::GetSupplyState()
 {
     return mSupplyState;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetSupplyState(SupplyStateEnum newValue)
 {
     SupplyStateEnum oldValue = mSupplyState;
@@ -503,7 +498,7 @@ CHIP_ERROR EnergyEvseDelegate::SetSupplyState(SupplyStateEnum newValue)
     mSupplyState = newValue;
     if (oldValue != mSupplyState)
     {
-        ChipLogDetail(AppServer, "SupplyState updated to %d", (int) mSupplyState);
+        ChipLogDetail(AppServer, "SupplyState updated to %d", static_cast<int>(mSupplyState));
         MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, SupplyState::Id);
     }
     return CHIP_NO_ERROR;
@@ -514,6 +509,7 @@ FaultStateEnum EnergyEvseDelegate::GetFaultState()
 {
     return mFaultState;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetFaultState(FaultStateEnum newValue)
 {
     FaultStateEnum oldValue = mFaultState;
@@ -526,7 +522,7 @@ CHIP_ERROR EnergyEvseDelegate::SetFaultState(FaultStateEnum newValue)
     mFaultState = newValue;
     if (oldValue != mFaultState)
     {
-        ChipLogDetail(AppServer, "FaultState updated to %d", (int) mFaultState);
+        ChipLogDetail(AppServer, "FaultState updated to %d", static_cast<int>(mFaultState));
         MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, FaultState::Id);
     }
     return CHIP_NO_ERROR;
@@ -537,6 +533,7 @@ DataModel::Nullable<uint32_t> EnergyEvseDelegate::GetChargingEnabledUntil()
 {
     return mChargingEnabledUntil;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetChargingEnabledUntil(uint32_t newValue)
 {
     DataModel::Nullable<uint32_t> oldValue = mChargingEnabledUntil;
@@ -550,11 +547,13 @@ CHIP_ERROR EnergyEvseDelegate::SetChargingEnabledUntil(uint32_t newValue)
     }
     return CHIP_NO_ERROR;
 }
+
 /* DischargingEnabledUntil */
 DataModel::Nullable<uint32_t> EnergyEvseDelegate::GetDischargingEnabledUntil()
 {
     return mDischargingEnabledUntil;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetDischargingEnabledUntil(uint32_t newValue)
 {
     DataModel::Nullable<uint32_t> oldValue = mDischargingEnabledUntil;
@@ -568,11 +567,13 @@ CHIP_ERROR EnergyEvseDelegate::SetDischargingEnabledUntil(uint32_t newValue)
     }
     return CHIP_NO_ERROR;
 }
+
 /* CircuitCapacity */
 int64_t EnergyEvseDelegate::GetCircuitCapacity()
 {
     return mCircuitCapacity;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetCircuitCapacity(int64_t newValue)
 {
     int64_t oldValue = mCircuitCapacity;
@@ -590,11 +591,13 @@ CHIP_ERROR EnergyEvseDelegate::SetCircuitCapacity(int64_t newValue)
     }
     return CHIP_NO_ERROR;
 }
+
 /* MinimumChargeCurrent */
 int64_t EnergyEvseDelegate::GetMinimumChargeCurrent()
 {
     return mMinimumChargeCurrent;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetMinimumChargeCurrent(int64_t newValue)
 {
     int64_t oldValue = mMinimumChargeCurrent;
@@ -618,6 +621,7 @@ int64_t EnergyEvseDelegate::GetMaximumChargeCurrent()
 {
     return mMaximumChargeCurrent;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetMaximumChargeCurrent(int64_t newValue)
 {
     int64_t oldValue = mMaximumChargeCurrent;
@@ -635,11 +639,13 @@ CHIP_ERROR EnergyEvseDelegate::SetMaximumChargeCurrent(int64_t newValue)
     }
     return CHIP_NO_ERROR;
 }
+
 /* MaximumDischargeCurrent */
 int64_t EnergyEvseDelegate::GetMaximumDischargeCurrent()
 {
     return mMaximumDischargeCurrent;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetMaximumDischargeCurrent(int64_t newValue)
 {
     int64_t oldValue = mMaximumDischargeCurrent;
@@ -657,11 +663,13 @@ CHIP_ERROR EnergyEvseDelegate::SetMaximumDischargeCurrent(int64_t newValue)
     }
     return CHIP_NO_ERROR;
 }
+
 /* UserMaximumChargeCurrent */
 int64_t EnergyEvseDelegate::GetUserMaximumChargeCurrent()
 {
     return mUserMaximumChargeCurrent;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetUserMaximumChargeCurrent(int64_t newValue)
 {
     if ((newValue < 0) || (newValue > kMaximumChargeCurrent))
@@ -679,11 +687,13 @@ CHIP_ERROR EnergyEvseDelegate::SetUserMaximumChargeCurrent(int64_t newValue)
 
     return CHIP_NO_ERROR;
 }
+
 /* RandomizationDelayWindow */
 uint32_t EnergyEvseDelegate::GetRandomizationDelayWindow()
 {
     return mRandomizationDelayWindow;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetRandomizationDelayWindow(uint32_t newValue)
 {
     uint32_t oldValue = mRandomizationDelayWindow;
@@ -733,6 +743,7 @@ DataModel::Nullable<uint16_t> EnergyEvseDelegate::GetApproximateEVEfficiency()
 {
     return mApproximateEVEfficiency;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetApproximateEVEfficiency(uint16_t newValue)
 {
     DataModel::Nullable<uint16_t> oldValue = mApproximateEVEfficiency;

From 0fdf9ccfcd68dca048be054685753e1a20ae606d Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Thu, 14 Dec 2023 16:22:33 +0000
Subject: [PATCH 60/80] Ensured that mVehicleID free's any malloc'd CharSpan in
 destructor

---
 .../include/EnergyEvseDelegateImpl.h                  |  2 ++
 .../src/EnergyEvseDelegateImpl.cpp                    | 11 +++++++++++
 2 files changed, 13 insertions(+)

diff --git a/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h b/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h
index 608f0e1e443cad..0a967e2472be8b 100644
--- a/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h
+++ b/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h
@@ -37,6 +37,8 @@ namespace EnergyEvse {
 class EnergyEvseDelegate : public EnergyEvse::Delegate
 {
 public:
+    ~EnergyEvseDelegate();
+
     /**
      * @brief   Called when EVSE cluster receives Disable command
      */
diff --git a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
index 82dc9c82aaf3f3..82adf275eedeb6 100644
--- a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
+++ b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
@@ -31,6 +31,16 @@ using namespace chip::app::Clusters::EnergyEvse::Attributes;
 using chip::app::LogEvent;
 using chip::Protocols::InteractionModel::Status;
 
+EnergyEvseDelegate::~EnergyEvseDelegate()
+{
+    // TODO Fix this as part of issue #30993 refactoring
+    if (!mVehicleID.IsNull())
+    {
+        ChipLogDetail(AppServer, "Freeing VehicleID");
+        delete[] mVehicleID.Value().data();
+    }
+}
+
 /**
  * @brief   Called when EVSE cluster receives Disable command
  */
@@ -382,6 +392,7 @@ Status EnergyEvseDelegate::HwSetRFID(ByteSpan uid)
  */
 Status EnergyEvseDelegate::HwSetVehicleID(const CharSpan & newValue)
 {
+    // TODO this code to be refactored - See Issue #30993
     if (mVehicleID.IsNull() || !newValue.data_equal(mVehicleID.Value()))
     {
         /* create a copy of the string so the callee doesn't have to keep it */

From c92a4e247df37f65eef4ee682132592f683a803b Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Thu, 14 Dec 2023 16:29:36 +0000
Subject: [PATCH 61/80] Sync EnergyEvseDelegateImpl.cpp from Example Energy
 Management

---
 .../src/EnergyEvseDelegateImpl.cpp            | 109 ++++++++++--------
 1 file changed, 60 insertions(+), 49 deletions(-)

diff --git a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
index 82adf275eedeb6..7ad16c3737dacb 100644
--- a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
+++ b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
@@ -64,7 +64,7 @@ Status EnergyEvseDelegate::Disable()
         break;
 
     default:
-        ChipLogError(AppServer, "Unexpected EVSE hardware state\n");
+        ChipLogError(AppServer, "Unexpected EVSE hardware state");
         SetState(StateEnum::kFault);
         break;
     }
@@ -138,10 +138,13 @@ Status EnergyEvseDelegate::EnableCharging(const DataModel::Nullable<uint32_t> &
     switch (mHwState)
     {
     case StateEnum::kNotPluggedIn:
+        // TODO handle errors here
         SetState(StateEnum::kNotPluggedIn);
         break;
 
     case StateEnum::kPluggedInNoDemand:
+        // TODO handle errors here
+        //  TODO REFACTOR per Andrei's comment in PR30857 - can we collapse this switch statement?
         SetState(StateEnum::kPluggedInNoDemand);
         break;
 
@@ -151,12 +154,12 @@ Status EnergyEvseDelegate::EnableCharging(const DataModel::Nullable<uint32_t> &
         break;
 
     default:
-        ChipLogError(AppServer, "Unexpected EVSE hardware state\n");
+        ChipLogError(AppServer, "Unexpected EVSE hardware state");
         SetState(StateEnum::kFault);
         break;
     }
 
-    /* update SupplyState */
+    /* update SupplyState to say that charging is now enabled */
     SetSupplyState(SupplyStateEnum::kChargingEnabled);
 
     /* If it looks ok, store the min & max charging current */
@@ -208,7 +211,6 @@ Status EnergyEvseDelegate::StartDiagnostics()
  * FUNCTIONS BELOW:
  *    - EVSE Hardware interface
  *
- *  RegisterEvseHardwareCallback( callbackType, callbackFnc )
  *  SetMaxHardwareCurrentLimit( currentmA )
  *  SetCircuitCapacity( currentmA )
  *  SetCableAssemblyLimit( currentmA )
@@ -217,25 +219,13 @@ Status EnergyEvseDelegate::StartDiagnostics()
  *
  */
 
-/**
- * @brief    Called by EVSE Hardware to register a callback
- *
- * @param    Callback function
- */
-#if 0
-Status EnergyEvseDelegate::HwRegisterEvseHardwareCallback(int Callback) // TODO
-{
-    // TODO
-    return CHIP_NO_ERROR;
-}
-#endif
 /**
  * @brief    Called by EVSE Hardware to notify the delegate of the maximum
  *           current limit supported by the hardware.
  *
  *           This is normally called at start-up.
  *
- * @param    currentmA
+ * @param    currentmA - Maximum current limit supported by the hardware
  */
 Status EnergyEvseDelegate::HwSetMaxHardwareCurrentLimit(int64_t currentmA)
 {
@@ -257,7 +247,7 @@ Status EnergyEvseDelegate::HwSetMaxHardwareCurrentLimit(int64_t currentmA)
  *           This is normally called at start-up when reading from DIP-switch
  *           settings.
  *
- * @param    currentmA
+ * @param    currentmA - Maximum current limit specified by electrician
  */
 Status EnergyEvseDelegate::HwSetCircuitCapacity(int64_t currentmA)
 {
@@ -282,7 +272,7 @@ Status EnergyEvseDelegate::HwSetCircuitCapacity(int64_t currentmA)
  *           using different resistors, which results in different voltages
  *           measured by the EVSE.
  *
- * @param    currentmA
+ * @param    currentmA - Maximum current limit detected from Cable assembly
  */
 Status EnergyEvseDelegate::HwSetCableAssemblyLimit(int64_t currentmA)
 {
@@ -298,17 +288,17 @@ Status EnergyEvseDelegate::HwSetCableAssemblyLimit(int64_t currentmA)
 }
 
 /**
- * @brief    Called by EVSE Hardware to indicate a fault
+ * @brief    Called by EVSE Hardware to indicate if EV is detected
  *
- * @param    StateEnum
+ * The only allowed states that the EVSE hardware can set are:
+ *  kNotPluggedIn
+ *  kPluggedInNoDemand
+ *  kPluggedInDemand
+ *
+ * @param    StateEnum - the state of the EV being plugged in and asking for demand etc
  */
 Status EnergyEvseDelegate::HwSetState(StateEnum state)
 {
-    /* the only allowed states that the EVSE hardware can set are:
-     *  kNotPluggedIn
-     *  kPluggedInNoDemand
-     *  kPluggedInDemand
-     */
     switch (state)
     {
     case StateEnum::kNotPluggedIn:
@@ -336,7 +326,7 @@ Status EnergyEvseDelegate::HwSetState(StateEnum state)
 /**
  * @brief    Called by EVSE Hardware to indicate a fault
  *
- * @param    FaultStateEnum
+ * @param    FaultStateEnum - the fault condition detected
  */
 Status EnergyEvseDelegate::HwSetFault(FaultStateEnum fault)
 {
@@ -382,6 +372,7 @@ Status EnergyEvseDelegate::HwSetRFID(ByteSpan uid)
 
     return Status::Success;
 }
+
 /**
  * @brief    Called by EVSE Hardware to share the VehicleID
  *
@@ -393,31 +384,33 @@ Status EnergyEvseDelegate::HwSetRFID(ByteSpan uid)
 Status EnergyEvseDelegate::HwSetVehicleID(const CharSpan & newValue)
 {
     // TODO this code to be refactored - See Issue #30993
-    if (mVehicleID.IsNull() || !newValue.data_equal(mVehicleID.Value()))
+    if (!mVehicleID.IsNull() && newValue.data_equal(mVehicleID.Value()))
     {
-        /* create a copy of the string so the callee doesn't have to keep it */
-        char * destinationBuffer = new char[kMaxVehicleIDBufSize];
-
-        MutableCharSpan destinationString(destinationBuffer, kMaxVehicleIDBufSize);
-        CHIP_ERROR err = CopyCharSpanToMutableCharSpan(newValue, destinationString);
-        if (err != CHIP_NO_ERROR)
-        {
-            ChipLogError(AppServer, "HwSetVehicleID - could not copy vehicleID");
-            delete[] destinationBuffer;
-            return Status::Failure;
-        }
+        return Status::Success;
+    }
 
-        if (!mVehicleID.IsNull())
-        {
-            delete[] mVehicleID.Value().data();
-        }
+    /* create a copy of the string so the callee doesn't have to keep it */
+    char * destinationBuffer = new char[kMaxVehicleIDBufSize];
 
-        mVehicleID = MakeNullable(static_cast<CharSpan>(destinationString));
+    MutableCharSpan destinationString(destinationBuffer, kMaxVehicleIDBufSize);
+    CHIP_ERROR err = CopyCharSpanToMutableCharSpan(newValue, destinationString);
+    if (err != CHIP_NO_ERROR)
+    {
+        ChipLogError(AppServer, "HwSetVehicleID - could not copy vehicleID");
+        delete[] destinationBuffer;
+        return Status::Failure;
+    }
 
-        ChipLogDetail(AppServer, "VehicleID updated");
-        MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, VehicleID::Id);
+    if (!mVehicleID.IsNull())
+    {
+        delete[] mVehicleID.Value().data();
     }
 
+    mVehicleID = MakeNullable(static_cast<CharSpan>(destinationString));
+
+    ChipLogDetail(AppServer, "VehicleID updated %.*s", static_cast<int>(mVehicleID.Value().size()), mVehicleID.Value().data());
+    MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, VehicleID::Id);
+
     return Status::Success;
 }
 
@@ -468,6 +461,7 @@ StateEnum EnergyEvseDelegate::GetState()
 {
     return mState;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetState(StateEnum newValue)
 {
     StateEnum oldValue = mState;
@@ -479,7 +473,7 @@ CHIP_ERROR EnergyEvseDelegate::SetState(StateEnum newValue)
     mState = newValue;
     if (oldValue != mState)
     {
-        ChipLogDetail(AppServer, "State updated to %d", (int) mState);
+        ChipLogDetail(AppServer, "State updated to %d", static_cast<int>(mState));
         MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, State::Id);
     }
 
@@ -491,6 +485,7 @@ SupplyStateEnum EnergyEvseDelegate::GetSupplyState()
 {
     return mSupplyState;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetSupplyState(SupplyStateEnum newValue)
 {
     SupplyStateEnum oldValue = mSupplyState;
@@ -503,7 +498,7 @@ CHIP_ERROR EnergyEvseDelegate::SetSupplyState(SupplyStateEnum newValue)
     mSupplyState = newValue;
     if (oldValue != mSupplyState)
     {
-        ChipLogDetail(AppServer, "SupplyState updated to %d", (int) mSupplyState);
+        ChipLogDetail(AppServer, "SupplyState updated to %d", static_cast<int>(mSupplyState));
         MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, SupplyState::Id);
     }
     return CHIP_NO_ERROR;
@@ -514,6 +509,7 @@ FaultStateEnum EnergyEvseDelegate::GetFaultState()
 {
     return mFaultState;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetFaultState(FaultStateEnum newValue)
 {
     FaultStateEnum oldValue = mFaultState;
@@ -526,7 +522,7 @@ CHIP_ERROR EnergyEvseDelegate::SetFaultState(FaultStateEnum newValue)
     mFaultState = newValue;
     if (oldValue != mFaultState)
     {
-        ChipLogDetail(AppServer, "FaultState updated to %d", (int) mFaultState);
+        ChipLogDetail(AppServer, "FaultState updated to %d", static_cast<int>(mFaultState));
         MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, FaultState::Id);
     }
     return CHIP_NO_ERROR;
@@ -537,6 +533,7 @@ DataModel::Nullable<uint32_t> EnergyEvseDelegate::GetChargingEnabledUntil()
 {
     return mChargingEnabledUntil;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetChargingEnabledUntil(uint32_t newValue)
 {
     DataModel::Nullable<uint32_t> oldValue = mChargingEnabledUntil;
@@ -550,11 +547,13 @@ CHIP_ERROR EnergyEvseDelegate::SetChargingEnabledUntil(uint32_t newValue)
     }
     return CHIP_NO_ERROR;
 }
+
 /* DischargingEnabledUntil */
 DataModel::Nullable<uint32_t> EnergyEvseDelegate::GetDischargingEnabledUntil()
 {
     return mDischargingEnabledUntil;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetDischargingEnabledUntil(uint32_t newValue)
 {
     DataModel::Nullable<uint32_t> oldValue = mDischargingEnabledUntil;
@@ -568,11 +567,13 @@ CHIP_ERROR EnergyEvseDelegate::SetDischargingEnabledUntil(uint32_t newValue)
     }
     return CHIP_NO_ERROR;
 }
+
 /* CircuitCapacity */
 int64_t EnergyEvseDelegate::GetCircuitCapacity()
 {
     return mCircuitCapacity;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetCircuitCapacity(int64_t newValue)
 {
     int64_t oldValue = mCircuitCapacity;
@@ -590,11 +591,13 @@ CHIP_ERROR EnergyEvseDelegate::SetCircuitCapacity(int64_t newValue)
     }
     return CHIP_NO_ERROR;
 }
+
 /* MinimumChargeCurrent */
 int64_t EnergyEvseDelegate::GetMinimumChargeCurrent()
 {
     return mMinimumChargeCurrent;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetMinimumChargeCurrent(int64_t newValue)
 {
     int64_t oldValue = mMinimumChargeCurrent;
@@ -618,6 +621,7 @@ int64_t EnergyEvseDelegate::GetMaximumChargeCurrent()
 {
     return mMaximumChargeCurrent;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetMaximumChargeCurrent(int64_t newValue)
 {
     int64_t oldValue = mMaximumChargeCurrent;
@@ -635,11 +639,13 @@ CHIP_ERROR EnergyEvseDelegate::SetMaximumChargeCurrent(int64_t newValue)
     }
     return CHIP_NO_ERROR;
 }
+
 /* MaximumDischargeCurrent */
 int64_t EnergyEvseDelegate::GetMaximumDischargeCurrent()
 {
     return mMaximumDischargeCurrent;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetMaximumDischargeCurrent(int64_t newValue)
 {
     int64_t oldValue = mMaximumDischargeCurrent;
@@ -657,11 +663,13 @@ CHIP_ERROR EnergyEvseDelegate::SetMaximumDischargeCurrent(int64_t newValue)
     }
     return CHIP_NO_ERROR;
 }
+
 /* UserMaximumChargeCurrent */
 int64_t EnergyEvseDelegate::GetUserMaximumChargeCurrent()
 {
     return mUserMaximumChargeCurrent;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetUserMaximumChargeCurrent(int64_t newValue)
 {
     if ((newValue < 0) || (newValue > kMaximumChargeCurrent))
@@ -679,11 +687,13 @@ CHIP_ERROR EnergyEvseDelegate::SetUserMaximumChargeCurrent(int64_t newValue)
 
     return CHIP_NO_ERROR;
 }
+
 /* RandomizationDelayWindow */
 uint32_t EnergyEvseDelegate::GetRandomizationDelayWindow()
 {
     return mRandomizationDelayWindow;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetRandomizationDelayWindow(uint32_t newValue)
 {
     uint32_t oldValue = mRandomizationDelayWindow;
@@ -733,6 +743,7 @@ DataModel::Nullable<uint16_t> EnergyEvseDelegate::GetApproximateEVEfficiency()
 {
     return mApproximateEVEfficiency;
 }
+
 CHIP_ERROR EnergyEvseDelegate::SetApproximateEVEfficiency(uint16_t newValue)
 {
     DataModel::Nullable<uint16_t> oldValue = mApproximateEVEfficiency;

From 5bda6420fd2b796ceb66f881d264fbd22e8470bd Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Thu, 14 Dec 2023 16:56:58 +0000
Subject: [PATCH 62/80] Sync'd changes from example energy management app, and
 commits from #30857 & #30727

---
 .../include/EVSECallbacks.h                   | 74 ++++++++++++++
 .../include/EnergyEvseDelegateImpl.h          |  8 +-
 .../src/EnergyEvseDelegateImpl.cpp            | 96 +++++++++++++++----
 .../include/EnergyEvseDelegateImpl.h          |  2 +
 .../src/EnergyEvseDelegateImpl.cpp            | 11 +++
 5 files changed, 169 insertions(+), 22 deletions(-)
 create mode 100644 examples/all-clusters-app/all-clusters-common/include/EVSECallbacks.h

diff --git a/examples/all-clusters-app/all-clusters-common/include/EVSECallbacks.h b/examples/all-clusters-app/all-clusters-common/include/EVSECallbacks.h
new file mode 100644
index 00000000000000..84b6f232fca02e
--- /dev/null
+++ b/examples/all-clusters-app/all-clusters-common/include/EVSECallbacks.h
@@ -0,0 +1,74 @@
+/*
+ *
+ *    Copyright (c) 2023 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
+
+using namespace chip::app::Clusters::EnergyEvse;
+
+/* This callbacks mechanism is intended to allow different delegates to callback
+ * and inform the manufacturer that something has changed.
+ *
+ * This is not specific to the EnergyEVSE cluster, but includes DeviceEnergyManagement
+ * and potential future clusters.
+ */
+enum EVSECallbackType
+{
+    /*
+     * The State has changed (e.g. from Disabled to Charging, or vice-versa)
+     */
+    StateChanged,
+    /*
+     * ChargeCurrent has changed
+     */
+    ChargeCurrentChanged,
+    /*
+     * Charging Preferences have changed
+     */
+    ChargingPreferencesChanged,
+    /*
+     * DeviceEnergyManagement has changed
+     */
+    DeviceEnergyManagementChanged,
+};
+
+struct EVSECbInfo
+{
+    EVSECallbackType type;
+
+    union
+    {
+        struct
+        {
+            StateEnum state;
+            SupplyStateEnum supplyState;
+        } StateChange;
+
+        struct
+        {
+            int64_t maximumChargeCurrent;
+        } ChargingCurrent;
+    };
+};
+
+typedef void (*EVSECallbackFunc)(const EVSECbInfo * cb, intptr_t arg);
+
+struct EVSECallbackWrapper
+{
+    EVSECallbackFunc handler;
+    intptr_t arg;
+};
diff --git a/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h b/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h
index 0a967e2472be8b..026a9d984dee2f 100644
--- a/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h
+++ b/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h
@@ -19,6 +19,7 @@
 #pragma once
 
 #include "app/clusters/energy-evse-server/energy-evse-server.h"
+#include <EVSECallbacks.h>
 
 #include <app/util/af.h>
 #include <app/util/config.h>
@@ -70,7 +71,7 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate
 
     // -----------------------------------------------------------------
     // Internal API to allow an EVSE to change its internal state etc
-    // TODO Status HwRegisterEvseHardwareCallback(Callback);
+    Status HwRegisterEvseCallbackHandler(EVSECallbackFunc handler, intptr_t arg);
     Status HwSetMaxHardwareCurrentLimit(int64_t currentmA);
     Status HwSetCircuitCapacity(int64_t currentmA);
     Status HwSetCableAssemblyLimit(int64_t currentmA);
@@ -150,6 +151,11 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate
     int64_t mActualChargingCurrentLimit             = 0;
     StateEnum mHwState                              = StateEnum::kNotPluggedIn; /* Hardware state */
 
+    /* Callback related */
+    EVSECallbackWrapper mCallbacks = { .handler = nullptr }; /* Wrapper to allow callbacks to be registered */
+    Status NotifyApplicationCurrentLimitChange(int64_t maximumChargeCurrent);
+    Status NotifyApplicationStateChange(void);
+
     /**
      * @brief Helper function to work out the charge limit based on conditions and settings
      */
diff --git a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
index 7ad16c3737dacb..124e84b834541b 100644
--- a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
+++ b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
@@ -83,6 +83,7 @@ Status EnergyEvseDelegate::Disable()
     /* update MaximumDischargeCurrent to 0 */
     SetMaximumDischargeCurrent(0);
 
+    NotifyApplicationStateChange();
     // TODO: Generate events
 
     return Status::Success;
@@ -102,31 +103,31 @@ Status EnergyEvseDelegate::EnableCharging(const DataModel::Nullable<uint32_t> &
 
     if (maximumChargeCurrent < kMinimumChargeCurrent || maximumChargeCurrent > kMaximumChargeCurrent)
     {
-        ChipLogError(NotSpecified, "Maximum Current outside limits");
+        ChipLogError(AppServer, "Maximum Current outside limits");
         return Status::ConstraintError;
     }
 
     if (minimumChargeCurrent < kMinimumChargeCurrent || minimumChargeCurrent > kMaximumChargeCurrent)
     {
-        ChipLogError(NotSpecified, "Maximum Current outside limits");
+        ChipLogError(AppServer, "Maximum Current outside limits");
         return Status::ConstraintError;
     }
 
     if (minimumChargeCurrent > maximumChargeCurrent)
     {
-        ChipLogError(NotSpecified, "Minium Current > Maximum Current!");
+        ChipLogError(AppServer, "Minium Current > Maximum Current!");
         return Status::ConstraintError;
     }
 
     if (chargingEnabledUntil.IsNull())
     {
         /* Charging enabled indefinitely */
-        ChipLogError(NotSpecified, "Charging enabled indefinitely");
+        ChipLogError(AppServer, "Charging enabled indefinitely");
     }
     else
     {
         /* check chargingEnabledUntil is in the future */
-        ChipLogError(NotSpecified, "Charging enabled until: %lu", static_cast<long unsigned int>(chargingEnabledUntil.Value()));
+        ChipLogError(AppServer, "Charging enabled until: %lu", static_cast<long unsigned int>(chargingEnabledUntil.Value()));
         // TODO
         // if (checkChargingEnabled)
     }
@@ -169,6 +170,8 @@ Status EnergyEvseDelegate::EnableCharging(const DataModel::Nullable<uint32_t> &
 
     // TODO: Generate events
 
+    NotifyApplicationStateChange();
+
     return this->ComputeMaxChargeCurrentLimit();
 }
 
@@ -188,6 +191,8 @@ Status EnergyEvseDelegate::EnableDischarging(const DataModel::Nullable<uint32_t>
 
     // TODO: Generate events
 
+    NotifyApplicationStateChange();
+
     return Status::Success;
 }
 
@@ -199,25 +204,42 @@ Status EnergyEvseDelegate::StartDiagnostics()
     /* For EVSE manufacturers to customize */
     ChipLogProgress(AppServer, "EnergyEvseDelegate::StartDiagnostics()");
 
-    /* update SupplyState */
+    /* update SupplyState to indicate in Diagnostics mode */
     SetSupplyState(SupplyStateEnum::kDisabledDiagnostics);
 
     // TODO: Generate events
 
+    // TODO: Notify Application to implement Diagnostics
+
+    NotifyApplicationStateChange();
+
     return Status::Success;
 }
 
 /* ---------------------------------------------------------------------------
- * FUNCTIONS BELOW:
- *    - EVSE Hardware interface
+ *  EVSE Hardware interface below
+ */
+
+/**
+ * @brief    Called by EVSE Hardware to register a callback handler mechanism
  *
- *  SetMaxHardwareCurrentLimit( currentmA )
- *  SetCircuitCapacity( currentmA )
- *  SetCableAssemblyLimit( currentmA )
- *  SetState( EVSEStateEnum )
- *  SetFault
+ *           This is normally called at start-up.
  *
+ * @param    EVSECallbackFunct - function pointer to call
+ * @param    intptr_t          - optional context to provide back to callback handler
  */
+Status EnergyEvseDelegate::HwRegisterEvseCallbackHandler(EVSECallbackFunc handler, intptr_t arg)
+{
+    if (mCallbacks.handler != nullptr)
+    {
+        ChipLogError(AppServer, "Callback handler already initialized");
+        return Status::Failure;
+    }
+    mCallbacks.handler = handler;
+    mCallbacks.arg     = arg;
+
+    return Status::Success;
+}
 
 /**
  * @brief    Called by EVSE Hardware to notify the delegate of the maximum
@@ -420,17 +442,18 @@ Status EnergyEvseDelegate::HwSetVehicleID(const CharSpan & newValue)
 
 /**
  *  @brief   Called to compute the safe charging current limit
+ *
+ * mActualChargingCurrentLimit is the minimum of:
+ *   - MaxHardwareCurrentLimit (of the hardware)
+ *   - CircuitCapacity (set by the electrician - less than the hardware)
+ *   - CableAssemblyLimit (detected when the cable is inserted)
+ *   - MaximumChargeCurrent (from charging command)
+ *   - UserMaximumChargeCurrent (could dynamically change)
+ *
  */
 Status EnergyEvseDelegate::ComputeMaxChargeCurrentLimit()
 {
     int64_t oldValue;
-    /* mActualChargingCurrentLimit is the minimum of:
-     *   - MaxHardwareCurrentLimit (of the hardware)
-     *   - CircuitCapacity (set by the electrician - less than the hardware)
-     *   - CableAssemblyLimit (detected when the cable is inserted)
-     *   - MaximumChargeCurrent (from charging command)
-     *   - UserMaximumChargeCurrent (could dynamically change)
-     */
 
     oldValue                    = mActualChargingCurrentLimit;
     mActualChargingCurrentLimit = mMaxHardwareCurrentLimit;
@@ -448,11 +471,42 @@ Status EnergyEvseDelegate::ComputeMaxChargeCurrentLimit()
         MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, MaximumChargeCurrent::Id);
 
         /* Call the EV Charger hardware current limit callback */
-        // TODO
+        NotifyApplicationCurrentLimitChange(mMaximumChargeCurrent);
     }
     return Status::Success;
 }
 
+Status EnergyEvseDelegate::NotifyApplicationCurrentLimitChange(int64_t maximumChargeCurrent)
+{
+    EVSECbInfo cbInfo;
+
+    cbInfo.type                                 = EVSECallbackType::ChargeCurrentChanged;
+    cbInfo.ChargingCurrent.maximumChargeCurrent = maximumChargeCurrent;
+
+    if (mCallbacks.handler != nullptr)
+    {
+        mCallbacks.handler(&cbInfo, mCallbacks.arg);
+    }
+
+    return Status::Success;
+}
+
+Status EnergyEvseDelegate::NotifyApplicationStateChange(void)
+{
+    EVSECbInfo cbInfo;
+
+    cbInfo.type                    = EVSECallbackType::StateChanged;
+    cbInfo.StateChange.state       = mState;
+    cbInfo.StateChange.supplyState = mSupplyState;
+
+    if (mCallbacks.handler != nullptr)
+    {
+        mCallbacks.handler(&cbInfo, mCallbacks.arg);
+    }
+
+    return Status::Success;
+}
+
 /**
  * Attribute methods
  */
diff --git a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h
index 022c6f590ba49d..026a9d984dee2f 100644
--- a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h
+++ b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h
@@ -38,6 +38,8 @@ namespace EnergyEvse {
 class EnergyEvseDelegate : public EnergyEvse::Delegate
 {
 public:
+    ~EnergyEvseDelegate();
+
     /**
      * @brief   Called when EVSE cluster receives Disable command
      */
diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
index 9793fbe7c38ea3..124e84b834541b 100644
--- a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
+++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
@@ -31,6 +31,16 @@ using namespace chip::app::Clusters::EnergyEvse::Attributes;
 using chip::app::LogEvent;
 using chip::Protocols::InteractionModel::Status;
 
+EnergyEvseDelegate::~EnergyEvseDelegate()
+{
+    // TODO Fix this as part of issue #30993 refactoring
+    if (!mVehicleID.IsNull())
+    {
+        ChipLogDetail(AppServer, "Freeing VehicleID");
+        delete[] mVehicleID.Value().data();
+    }
+}
+
 /**
  * @brief   Called when EVSE cluster receives Disable command
  */
@@ -395,6 +405,7 @@ Status EnergyEvseDelegate::HwSetRFID(ByteSpan uid)
  */
 Status EnergyEvseDelegate::HwSetVehicleID(const CharSpan & newValue)
 {
+    // TODO this code to be refactored - See Issue #30993
     if (!mVehicleID.IsNull() && newValue.data_equal(mVehicleID.Value()))
     {
         return Status::Success;

From 339196ce0b2919e130caab7bdbf26e9e7a6c379a Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Thu, 14 Dec 2023 18:15:57 +0000
Subject: [PATCH 63/80] Added namespace to avoid global namespace error in
 header file.

---
 .../all-clusters-common/include/EVSECallbacks.h           | 8 ++++++++
 .../energy-management-common/include/EVSECallbacks.h      | 8 ++++++++
 2 files changed, 16 insertions(+)

diff --git a/examples/all-clusters-app/all-clusters-common/include/EVSECallbacks.h b/examples/all-clusters-app/all-clusters-common/include/EVSECallbacks.h
index 84b6f232fca02e..d0329227727db0 100644
--- a/examples/all-clusters-app/all-clusters-common/include/EVSECallbacks.h
+++ b/examples/all-clusters-app/all-clusters-common/include/EVSECallbacks.h
@@ -18,6 +18,10 @@
 
 #pragma once
 
+namespace chip {
+namespace app {
+namespace Clusters {
+
 using namespace chip::app::Clusters::EnergyEvse;
 
 /* This callbacks mechanism is intended to allow different delegates to callback
@@ -72,3 +76,7 @@ struct EVSECallbackWrapper
     EVSECallbackFunc handler;
     intptr_t arg;
 };
+
+} // namespace Clusters
+} // namespace app
+} // namespace chip
\ No newline at end of file
diff --git a/examples/energy-management-app/energy-management-common/include/EVSECallbacks.h b/examples/energy-management-app/energy-management-common/include/EVSECallbacks.h
index 84b6f232fca02e..d0329227727db0 100644
--- a/examples/energy-management-app/energy-management-common/include/EVSECallbacks.h
+++ b/examples/energy-management-app/energy-management-common/include/EVSECallbacks.h
@@ -18,6 +18,10 @@
 
 #pragma once
 
+namespace chip {
+namespace app {
+namespace Clusters {
+
 using namespace chip::app::Clusters::EnergyEvse;
 
 /* This callbacks mechanism is intended to allow different delegates to callback
@@ -72,3 +76,7 @@ struct EVSECallbackWrapper
     EVSECallbackFunc handler;
     intptr_t arg;
 };
+
+} // namespace Clusters
+} // namespace app
+} // namespace chip
\ No newline at end of file

From 6ab439b1ef10fe396b072dd1ef7b55b364b29630 Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Thu, 14 Dec 2023 22:56:41 +0000
Subject: [PATCH 64/80] Re-write of ApplicationInit to handle potential errors

---
 examples/energy-management-app/linux/main.cpp | 82 ++++++++++++++-----
 1 file changed, 60 insertions(+), 22 deletions(-)

diff --git a/examples/energy-management-app/linux/main.cpp b/examples/energy-management-app/linux/main.cpp
index 904fa77aca2691..dddc6f53d76b20 100644
--- a/examples/energy-management-app/linux/main.cpp
+++ b/examples/energy-management-app/linux/main.cpp
@@ -41,37 +41,75 @@ static EVSEManufacturer * gEvseManufacturer = nullptr;
 
 void ApplicationInit()
 {
-    if ((gDelegate == nullptr) && (gInstance == nullptr))
+    CHIP_ERROR err;
+
+    if ((gDelegate != nullptr) || (gInstance != nullptr) || (gEvseManufacturer != nullptr))
+    {
+        ChipLogError(AppServer, "EVSE Instance or Delegate, EvseManufacturer already exist.");
+        return;
+    }
+
+    gDelegate = new EnergyEvseDelegate();
+    if (gDelegate == nullptr)
+    {
+        ChipLogError(AppServer, "Failed to allocate memory for EnergyEvseDelegate");
+        return;
+    }
+
+    /* Manufacturer may optionally not support all features, commands & attributes */
+    gInstance =
+        new EnergyEvseManager(EndpointId(ENERGY_EVSE_ENDPOINT), *gDelegate,
+                              BitMask<EnergyEvse::Feature, uint32_t>(
+                                  EnergyEvse::Feature::kChargingPreferences, EnergyEvse::Feature::kPlugAndCharge,
+                                  EnergyEvse::Feature::kRfid, EnergyEvse::Feature::kSoCReporting, EnergyEvse::Feature::kV2x),
+                              BitMask<OptionalAttributes, uint32_t>(OptionalAttributes::kSupportsUserMaximumChargingCurrent,
+                                                                    OptionalAttributes::kSupportsRandomizationWindow,
+                                                                    OptionalAttributes::kSupportsApproximateEvEfficiency),
+                              BitMask<OptionalCommands, uint32_t>(OptionalCommands::kSupportsStartDiagnostics));
+
+    if (gInstance == nullptr)
     {
-        gDelegate = new EnergyEvseDelegate();
-        if (gDelegate != nullptr)
-        {
-            /* Manufacturer may optionally not support all features, commands & attributes */
-            gInstance = new EnergyEvseManager(
-                EndpointId(ENERGY_EVSE_ENDPOINT), *gDelegate,
-                BitMask<EnergyEvse::Feature, uint32_t>(EnergyEvse::Feature::kChargingPreferences,
-                                                       EnergyEvse::Feature::kPlugAndCharge, EnergyEvse::Feature::kRfid,
-                                                       EnergyEvse::Feature::kSoCReporting, EnergyEvse::Feature::kV2x),
-                BitMask<OptionalAttributes, uint32_t>(OptionalAttributes::kSupportsUserMaximumChargingCurrent,
-                                                      OptionalAttributes::kSupportsRandomizationWindow,
-                                                      OptionalAttributes::kSupportsApproximateEvEfficiency),
-                BitMask<OptionalCommands, uint32_t>(OptionalCommands::kSupportsStartDiagnostics));
-            gInstance->Init(); /* Register Attribute & Command handlers */
-        }
+        ChipLogError(AppServer, "Failed to allocate memory for EnergyEvseManager");
+        delete gDelegate;
+        gDelegate = nullptr;
+        return;
     }
-    else
+
+    err = gInstance->Init(); /* Register Attribute & Command handlers */
+    if (err != CHIP_NO_ERROR)
     {
-        ChipLogError(AppServer, "EVSE Instance or Delegate already exist.")
+        ChipLogError(AppServer, "Init failed on gInstance");
+        delete gInstance;
+        delete gDelegate;
+        gInstance = nullptr;
+        gDelegate = nullptr;
+        return;
     }
 
+    /* Now create EVSEManufacturer*/
+    gEvseManufacturer = new EVSEManufacturer();
     if (gEvseManufacturer == nullptr)
     {
-        gEvseManufacturer = new EVSEManufacturer();
-        gEvseManufacturer->Init(gInstance);
+        ChipLogError(AppServer, "Failed to allocate memory for EvseManufacturer");
+        delete gInstance;
+        delete gDelegate;
+        gInstance = nullptr;
+        gDelegate = nullptr;
+        return;
     }
-    else
+
+    /* Call Manufacturer specific init */
+    err = gEvseManufacturer->Init(gInstance);
+    if (err != CHIP_NO_ERROR)
     {
-        ChipLogError(AppServer, "EVSEManufacturer already exists.")
+        ChipLogError(AppServer, "Init failed on gEvseManufacturer");
+        delete gEvseManufacturer;
+        delete gInstance;
+        delete gDelegate;
+        gEvseManufacturer = nullptr;
+        gInstance         = nullptr;
+        gDelegate         = nullptr;
+        return;
     }
 }
 

From 58cc794c00a6545be8b92b5874d00f56661296ee Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Thu, 14 Dec 2023 22:56:41 +0000
Subject: [PATCH 65/80] Re-write of ApplicationInit to handle potential errors

---
 examples/energy-management-app/linux/main.cpp | 82 ++++++++++++++-----
 1 file changed, 60 insertions(+), 22 deletions(-)

diff --git a/examples/energy-management-app/linux/main.cpp b/examples/energy-management-app/linux/main.cpp
index 904fa77aca2691..dddc6f53d76b20 100644
--- a/examples/energy-management-app/linux/main.cpp
+++ b/examples/energy-management-app/linux/main.cpp
@@ -41,37 +41,75 @@ static EVSEManufacturer * gEvseManufacturer = nullptr;
 
 void ApplicationInit()
 {
-    if ((gDelegate == nullptr) && (gInstance == nullptr))
+    CHIP_ERROR err;
+
+    if ((gDelegate != nullptr) || (gInstance != nullptr) || (gEvseManufacturer != nullptr))
+    {
+        ChipLogError(AppServer, "EVSE Instance or Delegate, EvseManufacturer already exist.");
+        return;
+    }
+
+    gDelegate = new EnergyEvseDelegate();
+    if (gDelegate == nullptr)
+    {
+        ChipLogError(AppServer, "Failed to allocate memory for EnergyEvseDelegate");
+        return;
+    }
+
+    /* Manufacturer may optionally not support all features, commands & attributes */
+    gInstance =
+        new EnergyEvseManager(EndpointId(ENERGY_EVSE_ENDPOINT), *gDelegate,
+                              BitMask<EnergyEvse::Feature, uint32_t>(
+                                  EnergyEvse::Feature::kChargingPreferences, EnergyEvse::Feature::kPlugAndCharge,
+                                  EnergyEvse::Feature::kRfid, EnergyEvse::Feature::kSoCReporting, EnergyEvse::Feature::kV2x),
+                              BitMask<OptionalAttributes, uint32_t>(OptionalAttributes::kSupportsUserMaximumChargingCurrent,
+                                                                    OptionalAttributes::kSupportsRandomizationWindow,
+                                                                    OptionalAttributes::kSupportsApproximateEvEfficiency),
+                              BitMask<OptionalCommands, uint32_t>(OptionalCommands::kSupportsStartDiagnostics));
+
+    if (gInstance == nullptr)
     {
-        gDelegate = new EnergyEvseDelegate();
-        if (gDelegate != nullptr)
-        {
-            /* Manufacturer may optionally not support all features, commands & attributes */
-            gInstance = new EnergyEvseManager(
-                EndpointId(ENERGY_EVSE_ENDPOINT), *gDelegate,
-                BitMask<EnergyEvse::Feature, uint32_t>(EnergyEvse::Feature::kChargingPreferences,
-                                                       EnergyEvse::Feature::kPlugAndCharge, EnergyEvse::Feature::kRfid,
-                                                       EnergyEvse::Feature::kSoCReporting, EnergyEvse::Feature::kV2x),
-                BitMask<OptionalAttributes, uint32_t>(OptionalAttributes::kSupportsUserMaximumChargingCurrent,
-                                                      OptionalAttributes::kSupportsRandomizationWindow,
-                                                      OptionalAttributes::kSupportsApproximateEvEfficiency),
-                BitMask<OptionalCommands, uint32_t>(OptionalCommands::kSupportsStartDiagnostics));
-            gInstance->Init(); /* Register Attribute & Command handlers */
-        }
+        ChipLogError(AppServer, "Failed to allocate memory for EnergyEvseManager");
+        delete gDelegate;
+        gDelegate = nullptr;
+        return;
     }
-    else
+
+    err = gInstance->Init(); /* Register Attribute & Command handlers */
+    if (err != CHIP_NO_ERROR)
     {
-        ChipLogError(AppServer, "EVSE Instance or Delegate already exist.")
+        ChipLogError(AppServer, "Init failed on gInstance");
+        delete gInstance;
+        delete gDelegate;
+        gInstance = nullptr;
+        gDelegate = nullptr;
+        return;
     }
 
+    /* Now create EVSEManufacturer*/
+    gEvseManufacturer = new EVSEManufacturer();
     if (gEvseManufacturer == nullptr)
     {
-        gEvseManufacturer = new EVSEManufacturer();
-        gEvseManufacturer->Init(gInstance);
+        ChipLogError(AppServer, "Failed to allocate memory for EvseManufacturer");
+        delete gInstance;
+        delete gDelegate;
+        gInstance = nullptr;
+        gDelegate = nullptr;
+        return;
     }
-    else
+
+    /* Call Manufacturer specific init */
+    err = gEvseManufacturer->Init(gInstance);
+    if (err != CHIP_NO_ERROR)
     {
-        ChipLogError(AppServer, "EVSEManufacturer already exists.")
+        ChipLogError(AppServer, "Init failed on gEvseManufacturer");
+        delete gEvseManufacturer;
+        delete gInstance;
+        delete gDelegate;
+        gEvseManufacturer = nullptr;
+        gInstance         = nullptr;
+        gDelegate         = nullptr;
+        return;
     }
 }
 

From c8322080f86e982db4f0f179254e1d1ba9911600 Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Thu, 14 Dec 2023 23:05:49 +0000
Subject: [PATCH 66/80] Removed unnecessary void in function decl.

---
 .../all-clusters-common/include/EnergyEvseDelegateImpl.h        | 2 +-
 .../all-clusters-common/src/EnergyEvseDelegateImpl.cpp          | 2 +-
 .../energy-management-common/include/EnergyEvseDelegateImpl.h   | 2 +-
 .../energy-management-common/src/EnergyEvseDelegateImpl.cpp     | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h b/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h
index 026a9d984dee2f..4d6a508b6bc8d1 100644
--- a/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h
+++ b/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h
@@ -154,7 +154,7 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate
     /* Callback related */
     EVSECallbackWrapper mCallbacks = { .handler = nullptr }; /* Wrapper to allow callbacks to be registered */
     Status NotifyApplicationCurrentLimitChange(int64_t maximumChargeCurrent);
-    Status NotifyApplicationStateChange(void);
+    Status NotifyApplicationStateChange();
 
     /**
      * @brief Helper function to work out the charge limit based on conditions and settings
diff --git a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
index 124e84b834541b..4b1be52538273a 100644
--- a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
+++ b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
@@ -491,7 +491,7 @@ Status EnergyEvseDelegate::NotifyApplicationCurrentLimitChange(int64_t maximumCh
     return Status::Success;
 }
 
-Status EnergyEvseDelegate::NotifyApplicationStateChange(void)
+Status EnergyEvseDelegate::NotifyApplicationStateChange()
 {
     EVSECbInfo cbInfo;
 
diff --git a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h
index 026a9d984dee2f..4d6a508b6bc8d1 100644
--- a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h
+++ b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h
@@ -154,7 +154,7 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate
     /* Callback related */
     EVSECallbackWrapper mCallbacks = { .handler = nullptr }; /* Wrapper to allow callbacks to be registered */
     Status NotifyApplicationCurrentLimitChange(int64_t maximumChargeCurrent);
-    Status NotifyApplicationStateChange(void);
+    Status NotifyApplicationStateChange();
 
     /**
      * @brief Helper function to work out the charge limit based on conditions and settings
diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
index 124e84b834541b..4b1be52538273a 100644
--- a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
+++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
@@ -491,7 +491,7 @@ Status EnergyEvseDelegate::NotifyApplicationCurrentLimitChange(int64_t maximumCh
     return Status::Success;
 }
 
-Status EnergyEvseDelegate::NotifyApplicationStateChange(void)
+Status EnergyEvseDelegate::NotifyApplicationStateChange()
 {
     EVSECbInfo cbInfo;
 

From 34dd424673945347fdefc5fd653ea1ebd572c069 Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Fri, 15 Dec 2023 00:38:23 +0000
Subject: [PATCH 67/80] Open and saved in ZAP, then regen_all

---
 .../all-clusters-common/all-clusters-app.zap              | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

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 69c6f8ec0cb8de..0bba4b8871e6c2 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
@@ -12148,7 +12148,7 @@
               "storageOption": "External",
               "singleton": 0,
               "bounded": 0,
-              "defaultValue": "",
+              "defaultValue": null,
               "reportable": 1,
               "minInterval": 1,
               "maxInterval": 65534,
@@ -12164,7 +12164,7 @@
               "storageOption": "External",
               "singleton": 0,
               "bounded": 0,
-              "defaultValue": "",
+              "defaultValue": null,
               "reportable": 1,
               "minInterval": 1,
               "maxInterval": 65534,
@@ -12180,7 +12180,7 @@
               "storageOption": "External",
               "singleton": 0,
               "bounded": 0,
-              "defaultValue": "",
+              "defaultValue": null,
               "reportable": 1,
               "minInterval": 1,
               "maxInterval": 65534,
@@ -12196,7 +12196,7 @@
               "storageOption": "External",
               "singleton": 0,
               "bounded": 0,
-              "defaultValue": "",
+              "defaultValue": null,
               "reportable": 1,
               "minInterval": 1,
               "maxInterval": 65534,

From 23910e236584ba4169f4a6ef26f96a56b0b87d24 Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Fri, 15 Dec 2023 12:55:24 +0000
Subject: [PATCH 68/80] Updated Energy-management-app.zap / .matter after
 change to general-diagnostics.xml change to MS.

---
 .../energy-management-app.matter              | 13 +++-
 .../energy-management-app.zap                 | 66 +++++++++++++++++++
 2 files changed, 77 insertions(+), 2 deletions(-)

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 b7198f8018aa44..3c715f9bfc9253 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
@@ -697,8 +697,8 @@ cluster GeneralDiagnostics = 51 {
   }
 
   response struct TimeSnapshotResponse = 2 {
-    systime_us systemTimeUs = 0;
-    nullable epoch_us UTCTimeUs = 1;
+    systime_ms systemTimeMs = 0;
+    nullable posix_ms posixTimeMs = 1;
   }
 
   /** Provide a means for certification tests to trigger some test-plan-specific events */
@@ -1404,6 +1404,15 @@ endpoint 1 {
     callback attribute attributeList;
     ram      attribute featureMap default = 1;
     ram      attribute clusterRevision default = 2;
+
+    handle command GetTargetsResponse;
+    handle command Disable;
+    handle command EnableCharging;
+    handle command EnableDischarging;
+    handle command StartDiagnostics;
+    handle command SetTargets;
+    handle command GetTargets;
+    handle command ClearTargets;
   }
 }
 
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 2acf948abce45c..33e273202c7c1c 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
@@ -2785,6 +2785,72 @@
           "side": "server",
           "enabled": 1,
           "apiMaturity": "provisional",
+          "commands": [
+            {
+              "name": "GetTargetsResponse",
+              "code": 0,
+              "mfgCode": null,
+              "source": "server",
+              "isIncoming": 0,
+              "isEnabled": 1
+            },
+            {
+              "name": "Disable",
+              "code": 1,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "EnableCharging",
+              "code": 2,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "EnableDischarging",
+              "code": 3,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "StartDiagnostics",
+              "code": 4,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "SetTargets",
+              "code": 5,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "GetTargets",
+              "code": 6,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "ClearTargets",
+              "code": 7,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            }
+          ],
           "attributes": [
             {
               "name": "State",

From 2822b3e6ff51930de027b8c0818f004f16df141d Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Fri, 15 Dec 2023 13:04:21 +0000
Subject: [PATCH 69/80] Updated Energy-management-app.zap / .matter after
 change to general-diagnostics.xml change to MS.

---
 .../energy-management-app.matter              | 13 +++-
 .../energy-management-app.zap                 | 66 +++++++++++++++++++
 2 files changed, 77 insertions(+), 2 deletions(-)

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 b7198f8018aa44..3c715f9bfc9253 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
@@ -697,8 +697,8 @@ cluster GeneralDiagnostics = 51 {
   }
 
   response struct TimeSnapshotResponse = 2 {
-    systime_us systemTimeUs = 0;
-    nullable epoch_us UTCTimeUs = 1;
+    systime_ms systemTimeMs = 0;
+    nullable posix_ms posixTimeMs = 1;
   }
 
   /** Provide a means for certification tests to trigger some test-plan-specific events */
@@ -1404,6 +1404,15 @@ endpoint 1 {
     callback attribute attributeList;
     ram      attribute featureMap default = 1;
     ram      attribute clusterRevision default = 2;
+
+    handle command GetTargetsResponse;
+    handle command Disable;
+    handle command EnableCharging;
+    handle command EnableDischarging;
+    handle command StartDiagnostics;
+    handle command SetTargets;
+    handle command GetTargets;
+    handle command ClearTargets;
   }
 }
 
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 2acf948abce45c..33e273202c7c1c 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
@@ -2785,6 +2785,72 @@
           "side": "server",
           "enabled": 1,
           "apiMaturity": "provisional",
+          "commands": [
+            {
+              "name": "GetTargetsResponse",
+              "code": 0,
+              "mfgCode": null,
+              "source": "server",
+              "isIncoming": 0,
+              "isEnabled": 1
+            },
+            {
+              "name": "Disable",
+              "code": 1,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "EnableCharging",
+              "code": 2,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "EnableDischarging",
+              "code": 3,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "StartDiagnostics",
+              "code": 4,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "SetTargets",
+              "code": 5,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "GetTargets",
+              "code": 6,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "ClearTargets",
+              "code": 7,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            }
+          ],
           "attributes": [
             {
               "name": "State",

From 4793eb16f596a2f17e3c518f8b7b6a8c82dbad4b Mon Sep 17 00:00:00 2001
From: "Restyled.io" <commits@restyled.io>
Date: Fri, 15 Dec 2023 13:04:43 +0000
Subject: [PATCH 70/80] Restyled by whitespace

---
 .../all-clusters-common/include/EVSECallbacks.h                 | 2 +-
 .../energy-management-common/include/EVSECallbacks.h            | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/examples/all-clusters-app/all-clusters-common/include/EVSECallbacks.h b/examples/all-clusters-app/all-clusters-common/include/EVSECallbacks.h
index d0329227727db0..d1a7e71d1f229b 100644
--- a/examples/all-clusters-app/all-clusters-common/include/EVSECallbacks.h
+++ b/examples/all-clusters-app/all-clusters-common/include/EVSECallbacks.h
@@ -79,4 +79,4 @@ struct EVSECallbackWrapper
 
 } // namespace Clusters
 } // namespace app
-} // namespace chip
\ No newline at end of file
+} // namespace chip
diff --git a/examples/energy-management-app/energy-management-common/include/EVSECallbacks.h b/examples/energy-management-app/energy-management-common/include/EVSECallbacks.h
index d0329227727db0..d1a7e71d1f229b 100644
--- a/examples/energy-management-app/energy-management-common/include/EVSECallbacks.h
+++ b/examples/energy-management-app/energy-management-common/include/EVSECallbacks.h
@@ -79,4 +79,4 @@ struct EVSECallbackWrapper
 
 } // namespace Clusters
 } // namespace app
-} // namespace chip
\ No newline at end of file
+} // namespace chip

From ee510f4faffa1eeeb227b3a295f3b96c9f479fcf Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Sat, 16 Dec 2023 19:42:03 +0000
Subject: [PATCH 71/80] Fixed types to be signed=true

---
 .../zcl/data-model/chip/chip-types.xml        |  8 ++---
 .../zap-generated/cluster/Commands.h          | 32 ++++++++++---------
 .../zap-generated/cluster/Commands.h          |  8 ++---
 3 files changed, 25 insertions(+), 23 deletions(-)

diff --git a/src/app/zap-templates/zcl/data-model/chip/chip-types.xml b/src/app/zap-templates/zcl/data-model/chip/chip-types.xml
index 02d81623cc3394..cae3f4a87df8c0 100644
--- a/src/app/zap-templates/zcl/data-model/chip/chip-types.xml
+++ b/src/app/zap-templates/zcl/data-model/chip/chip-types.xml
@@ -55,10 +55,10 @@ limitations under the License.
     <type id="0x42" description="Character String"         name="char_string"                 composite="true"/>
     <type id="0x44" description="Long Character String"    name="long_char_string"            composite="true"/>
 
-    <type id="0xD9" description="Power milliwatts"         name="power_mw"          size="8"  analog="true"   />
-    <type id="0xDA" description="Amperage milliamps"       name="amperage_ma"       size="8"  analog="true"   />
-    <type id="0xDB" description="Voltage millivolts"       name="voltage_mv"        size="8"  analog="true"   />
-    <type id="0xDC" description="Energy milliwatt-hours"   name="energy_mwh"        size="8"  analog="true"   />
+    <type id="0xD9" description="Power milliwatts"         name="power_mw"          size="8"  analog="true"     signed="true"/>
+    <type id="0xDA" description="Amperage milliamps"       name="amperage_ma"       size="8"  analog="true"     signed="true"/>
+    <type id="0xDB" description="Voltage millivolts"       name="voltage_mv"        size="8"  analog="true"     signed="true"/>
+    <type id="0xDC" description="Energy milliwatt-hours"   name="energy_mwh"        size="8"  analog="true"     signed="true"/>
 
     <type id="0xE6" description="Percentage units 1%"      name="percent"           size="1"  analog="true"   />
     <type id="0xE7" description="Percentage units 0.01%"   name="percent100ths"     size="2"  analog="true"   />
diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h
index 71dfbb1e03a9b8..0ab3cd79e655bb 100644
--- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h
+++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h
@@ -7238,8 +7238,8 @@ class EnergyEvseEnableCharging : public ClusterCommand
     EnergyEvseEnableCharging(CredentialIssuerCommands * credsIssuerConfig) : ClusterCommand("enable-charging", credsIssuerConfig)
     {
         AddArgument("ChargingEnabledUntil", 0, UINT32_MAX, &mRequest.chargingEnabledUntil);
-        AddArgument("MinimumChargeCurrent", 0, UINT64_MAX, &mRequest.minimumChargeCurrent);
-        AddArgument("MaximumChargeCurrent", 0, UINT64_MAX, &mRequest.maximumChargeCurrent);
+        AddArgument("MinimumChargeCurrent", INT64_MIN, INT64_MAX, &mRequest.minimumChargeCurrent);
+        AddArgument("MaximumChargeCurrent", INT64_MIN, INT64_MAX, &mRequest.maximumChargeCurrent);
         ClusterCommand::AddArguments();
     }
 
@@ -7278,7 +7278,7 @@ class EnergyEvseEnableDischarging : public ClusterCommand
         ClusterCommand("enable-discharging", credsIssuerConfig)
     {
         AddArgument("DischargingEnabledUntil", 0, UINT32_MAX, &mRequest.dischargingEnabledUntil);
-        AddArgument("MaximumDischargeCurrent", 0, UINT64_MAX, &mRequest.maximumDischargeCurrent);
+        AddArgument("MaximumDischargeCurrent", INT64_MIN, INT64_MAX, &mRequest.maximumDischargeCurrent);
         ClusterCommand::AddArguments();
     }
 
@@ -19708,16 +19708,18 @@ void registerClusterEnergyEvse(Commands & commands, CredentialIssuerCommands * c
         make_unique<WriteAttribute<chip::app::DataModel::Nullable<uint32_t>>>(Id, "discharging-enabled-until", 0, UINT32_MAX,
                                                                               Attributes::DischargingEnabledUntil::Id,
                                                                               WriteCommandType::kForceWrite, credsIssuerConfig), //
-        make_unique<WriteAttribute<int64_t>>(Id, "circuit-capacity", 0, UINT64_MAX, Attributes::CircuitCapacity::Id,
+        make_unique<WriteAttribute<int64_t>>(Id, "circuit-capacity", INT64_MIN, INT64_MAX, Attributes::CircuitCapacity::Id,
                                              WriteCommandType::kForceWrite, credsIssuerConfig), //
-        make_unique<WriteAttribute<int64_t>>(Id, "minimum-charge-current", 0, UINT64_MAX, Attributes::MinimumChargeCurrent::Id,
-                                             WriteCommandType::kForceWrite, credsIssuerConfig), //
-        make_unique<WriteAttribute<int64_t>>(Id, "maximum-charge-current", 0, UINT64_MAX, Attributes::MaximumChargeCurrent::Id,
-                                             WriteCommandType::kForceWrite, credsIssuerConfig), //
-        make_unique<WriteAttribute<int64_t>>(Id, "maximum-discharge-current", 0, UINT64_MAX,
+        make_unique<WriteAttribute<int64_t>>(Id, "minimum-charge-current", INT64_MIN, INT64_MAX,
+                                             Attributes::MinimumChargeCurrent::Id, WriteCommandType::kForceWrite,
+                                             credsIssuerConfig), //
+        make_unique<WriteAttribute<int64_t>>(Id, "maximum-charge-current", INT64_MIN, INT64_MAX,
+                                             Attributes::MaximumChargeCurrent::Id, WriteCommandType::kForceWrite,
+                                             credsIssuerConfig), //
+        make_unique<WriteAttribute<int64_t>>(Id, "maximum-discharge-current", INT64_MIN, INT64_MAX,
                                              Attributes::MaximumDischargeCurrent::Id, WriteCommandType::kForceWrite,
                                              credsIssuerConfig), //
-        make_unique<WriteAttribute<int64_t>>(Id, "user-maximum-charge-current", 0, UINT64_MAX,
+        make_unique<WriteAttribute<int64_t>>(Id, "user-maximum-charge-current", INT64_MIN, INT64_MAX,
                                              Attributes::UserMaximumChargeCurrent::Id, WriteCommandType::kWrite,
                                              credsIssuerConfig), //
         make_unique<WriteAttribute<uint32_t>>(Id, "randomization-delay-window", 0, UINT32_MAX,
@@ -19733,8 +19735,8 @@ void registerClusterEnergyEvse(Commands & commands, CredentialIssuerCommands * c
         make_unique<WriteAttribute<chip::app::DataModel::Nullable<uint32_t>>>(Id, "next-charge-target-time", 0, UINT32_MAX,
                                                                               Attributes::NextChargeTargetTime::Id,
                                                                               WriteCommandType::kForceWrite, credsIssuerConfig), //
-        make_unique<WriteAttribute<chip::app::DataModel::Nullable<int64_t>>>(Id, "next-charge-required-energy", 0, UINT64_MAX,
-                                                                             Attributes::NextChargeRequiredEnergy::Id,
+        make_unique<WriteAttribute<chip::app::DataModel::Nullable<int64_t>>>(Id, "next-charge-required-energy", INT64_MIN,
+                                                                             INT64_MAX, Attributes::NextChargeRequiredEnergy::Id,
                                                                              WriteCommandType::kForceWrite, credsIssuerConfig), //
         make_unique<WriteAttribute<chip::app::DataModel::Nullable<chip::Percent>>>(
             Id, "next-charge-target-so-c", 0, UINT8_MAX, Attributes::NextChargeTargetSoC::Id, WriteCommandType::kForceWrite,
@@ -19745,7 +19747,7 @@ void registerClusterEnergyEvse(Commands & commands, CredentialIssuerCommands * c
         make_unique<WriteAttribute<chip::app::DataModel::Nullable<chip::Percent>>>(
             Id, "state-of-charge", 0, UINT8_MAX, Attributes::StateOfCharge::Id, WriteCommandType::kForceWrite,
             credsIssuerConfig), //
-        make_unique<WriteAttribute<chip::app::DataModel::Nullable<int64_t>>>(Id, "battery-capacity", 0, UINT64_MAX,
+        make_unique<WriteAttribute<chip::app::DataModel::Nullable<int64_t>>>(Id, "battery-capacity", INT64_MIN, INT64_MAX,
                                                                              Attributes::BatteryCapacity::Id,
                                                                              WriteCommandType::kForceWrite, credsIssuerConfig), //
         make_unique<WriteAttribute<chip::app::DataModel::Nullable<chip::CharSpan>>>(
@@ -19755,10 +19757,10 @@ void registerClusterEnergyEvse(Commands & commands, CredentialIssuerCommands * c
         make_unique<WriteAttribute<chip::app::DataModel::Nullable<uint32_t>>>(Id, "session-duration", 0, UINT32_MAX,
                                                                               Attributes::SessionDuration::Id,
                                                                               WriteCommandType::kForceWrite, credsIssuerConfig), //
-        make_unique<WriteAttribute<chip::app::DataModel::Nullable<int64_t>>>(Id, "session-energy-charged", 0, UINT64_MAX,
+        make_unique<WriteAttribute<chip::app::DataModel::Nullable<int64_t>>>(Id, "session-energy-charged", INT64_MIN, INT64_MAX,
                                                                              Attributes::SessionEnergyCharged::Id,
                                                                              WriteCommandType::kForceWrite, credsIssuerConfig), //
-        make_unique<WriteAttribute<chip::app::DataModel::Nullable<int64_t>>>(Id, "session-energy-discharged", 0, UINT64_MAX,
+        make_unique<WriteAttribute<chip::app::DataModel::Nullable<int64_t>>>(Id, "session-energy-discharged", INT64_MIN, INT64_MAX,
                                                                              Attributes::SessionEnergyDischarged::Id,
                                                                              WriteCommandType::kForceWrite, credsIssuerConfig), //
         make_unique<WriteAttributeAsComplex<chip::app::DataModel::List<const chip::CommandId>>>(
diff --git a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h
index 14133801e0836b..ee479487347d1b 100644
--- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h
+++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h
@@ -80277,10 +80277,10 @@ class EnergyEvseEnableCharging : public ClusterCommand {
         AddArgument("ChargingEnabledUntil", 0, UINT32_MAX, &mRequest.chargingEnabledUntil);
 #endif // MTR_ENABLE_PROVISIONAL
 #if MTR_ENABLE_PROVISIONAL
-        AddArgument("MinimumChargeCurrent", 0, UINT64_MAX, &mRequest.minimumChargeCurrent);
+        AddArgument("MinimumChargeCurrent", INT64_MIN, INT64_MAX, &mRequest.minimumChargeCurrent);
 #endif // MTR_ENABLE_PROVISIONAL
 #if MTR_ENABLE_PROVISIONAL
-        AddArgument("MaximumChargeCurrent", 0, UINT64_MAX, &mRequest.maximumChargeCurrent);
+        AddArgument("MaximumChargeCurrent", INT64_MIN, INT64_MAX, &mRequest.maximumChargeCurrent);
 #endif // MTR_ENABLE_PROVISIONAL
         ClusterCommand::AddArguments();
     }
@@ -80346,7 +80346,7 @@ class EnergyEvseEnableDischarging : public ClusterCommand {
         AddArgument("DischargingEnabledUntil", 0, UINT32_MAX, &mRequest.dischargingEnabledUntil);
 #endif // MTR_ENABLE_PROVISIONAL
 #if MTR_ENABLE_PROVISIONAL
-        AddArgument("MaximumDischargeCurrent", 0, UINT64_MAX, &mRequest.maximumDischargeCurrent);
+        AddArgument("MaximumDischargeCurrent", INT64_MIN, INT64_MAX, &mRequest.maximumDischargeCurrent);
 #endif // MTR_ENABLE_PROVISIONAL
         ClusterCommand::AddArguments();
     }
@@ -81438,7 +81438,7 @@ class WriteEnergyEvseUserMaximumChargeCurrent : public WriteAttribute {
         : WriteAttribute("user-maximum-charge-current")
     {
         AddArgument("attr-name", "user-maximum-charge-current");
-        AddArgument("attr-value", 0, UINT64_MAX, &mValue);
+        AddArgument("attr-value", INT64_MIN, INT64_MAX, &mValue);
         WriteAttribute::AddArguments();
     }
 

From be39a668dc20ef7a6289d452e1c18cdcb3cca897 Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Sat, 16 Dec 2023 19:51:11 +0000
Subject: [PATCH 72/80] Fixed 31032 - revert removal of side="server". Also
 turned on Events.

---
 .../energy-management-app.matter              |  6 +++
 .../energy-management-app.zap                 | 44 +++++++++++++++++++
 .../data-model/chip/energy-evse-cluster.xml   | 12 ++---
 3 files changed, 56 insertions(+), 6 deletions(-)

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 3c715f9bfc9253..aec56024447af3 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
@@ -1373,6 +1373,12 @@ endpoint 1 {
   }
 
   server cluster EnergyEvse {
+    emits event EVConnected;
+    emits event EVNotDetected;
+    emits event EnergyTransferStarted;
+    emits event EnergyTransferStopped;
+    emits event Fault;
+    emits event RFID;
     callback attribute state;
     callback attribute supplyState;
     callback attribute faultState;
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 33e273202c7c1c..13188112fd05e6 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
@@ -3348,6 +3348,50 @@
               "maxInterval": 65534,
               "reportableChange": 0
             }
+          ],
+          "events": [
+            {
+              "name": "EVConnected",
+              "code": 0,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1
+            },
+            {
+              "name": "EVNotDetected",
+              "code": 1,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1
+            },
+            {
+              "name": "EnergyTransferStarted",
+              "code": 2,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1
+            },
+            {
+              "name": "EnergyTransferStopped",
+              "code": 3,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1
+            },
+            {
+              "name": "Fault",
+              "code": 4,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1
+            },
+            {
+              "name": "RFID",
+              "code": 5,
+              "mfgCode": null,
+              "side": "server",
+              "included": 1
+            }
           ]
         }
       ]
diff --git a/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml
index f8925c73d7ce3c..df911627b297dc 100644
--- a/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml
+++ b/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml
@@ -169,11 +169,11 @@ limitations under the License.
       <arg name="ChargingTargets" array="true" type="ChargingTargetStruct"/>
       <description>The GetTargetsResponse is sent in response to the GetTargets Command.</description>
     </command>
-    <event code="0x0000" name="EVConnected" priority="info" apiMaturity="provisional">
+    <event side="server" code="0x0000" name="EVConnected" priority="info" apiMaturity="provisional">
       <description>EVConnected</description>
       <field id="0" name="SessionID" type="int32u" apiMaturity="provisional"/>
     </event>
-    <event code="0x0001" name="EVNotDetected" priority="info" apiMaturity="provisional">
+    <event side="server" code="0x0001" name="EVNotDetected" priority="info" apiMaturity="provisional">
       <description>EVNotDetected</description>
       <field id="0" name="SessionID" type="int32u" apiMaturity="provisional"/>
       <field id="1" name="State" type="StateEnum" apiMaturity="provisional"/>
@@ -181,27 +181,27 @@ limitations under the License.
       <field id="3" name="SessionEnergyCharged" type="energy_mwh" min="0" apiMaturity="provisional"/>
       <field id="4" name="SessionEnergyDischarged" type="energy_mwh" min="0"  optional="true" apiMaturity="provisional"/>
     </event>
-    <event code="0x0002" name="EnergyTransferStarted" priority="info" apiMaturity="provisional">
+    <event side="server" code="0x0002" name="EnergyTransferStarted" priority="info" apiMaturity="provisional">
       <description>EnergyTransferStarted</description>
       <field id="0" name="SessionID" type="int32u" apiMaturity="provisional"/>
       <field id="1" name="State" type="StateEnum" apiMaturity="provisional"/>
       <field id="2" name="MaximumCurrent" type="amperage_ma" min="0" max="80000" apiMaturity="provisional"/>
     </event>
-    <event code="0x0003" name="EnergyTransferStopped" priority="info" apiMaturity="provisional">
+    <event side="server" code="0x0003" name="EnergyTransferStopped" priority="info" apiMaturity="provisional">
       <description>EnergyTransferStopped</description>
       <field id="0" name="SessionID" type="int32u" apiMaturity="provisional"/>
       <field id="1" name="State" type="StateEnum" apiMaturity="provisional"/>
       <field id="2" name="Reason" type="EnergyTransferStoppedReasonEnum" apiMaturity="provisional"/>
       <field id="4" name="EnergyTransferred" type="energy_mwh" min="0" apiMaturity="provisional"/>
     </event>
-    <event code="0x0004" name="Fault" priority="critical" apiMaturity="provisional">
+    <event side="server" code="0x0004" name="Fault" priority="critical" apiMaturity="provisional">
       <description>Fault</description>
       <field id="0" name="SessionID" type="int32u" isNullable="true" apiMaturity="provisional"/>
       <field id="1" name="State" type="StateEnum" apiMaturity="provisional"/>
       <field id="2" name="FaultStatePreviousState" type="FaultStateEnum" apiMaturity="provisional"/>
       <field id="4" name="FaultStateCurrentState" type="FaultStateEnum" apiMaturity="provisional"/>
     </event>
-    <event code="0x0005" name="RFID" priority="info" apiMaturity="provisional" optional="true">
+    <event side="server" code="0x0005" name="RFID" priority="info" apiMaturity="provisional" optional="true">
       <description>RFID</description>
       <field id="0" name="UID" type="octet_string" length="10" apiMaturity="provisional"/>
     </event>

From 49f39b5a4e3828dc33c36fb758f336848fa4b3b7 Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Sat, 16 Dec 2023 20:07:17 +0000
Subject: [PATCH 73/80] PR comment fix - remove Localization Config and Time
 Format Localization cluster

---
 .../energy-management-app.matter              |  82 ------
 .../energy-management-app.zap                 | 260 ------------------
 2 files changed, 342 deletions(-)

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 aec56024447af3..0452ec58d3eef8 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
@@ -256,67 +256,6 @@ cluster BasicInformation = 40 {
   command MfgSpecificPing(): DefaultSuccess = 0;
 }
 
-/** Nodes should be expected to be deployed to any and all regions of the world. These global regions
-      may have differing common languages, units of measurements, and numerical formatting
-      standards. As such, Nodes that visually or audibly convey information need a mechanism by which
-      they can be configured to use a user’s preferred language, units, etc */
-cluster LocalizationConfiguration = 43 {
-  revision 1; // NOTE: Default/not specifically set
-
-  attribute access(write: manage) char_string<35> activeLocale = 0;
-  readonly attribute char_string supportedLocales[] = 1;
-  readonly attribute command_id generatedCommandList[] = 65528;
-  readonly attribute command_id acceptedCommandList[] = 65529;
-  readonly attribute event_id eventList[] = 65530;
-  readonly attribute attrib_id attributeList[] = 65531;
-  readonly attribute bitmap32 featureMap = 65532;
-  readonly attribute int16u clusterRevision = 65533;
-}
-
-/** Nodes should be expected to be deployed to any and all regions of the world. These global regions
-      may have differing preferences for how dates and times are conveyed. As such, Nodes that visually
-      or audibly convey time information need a mechanism by which they can be configured to use a
-      user’s preferred format. */
-cluster TimeFormatLocalization = 44 {
-  revision 1; // NOTE: Default/not specifically set
-
-  enum CalendarTypeEnum : enum8 {
-    kBuddhist = 0;
-    kChinese = 1;
-    kCoptic = 2;
-    kEthiopian = 3;
-    kGregorian = 4;
-    kHebrew = 5;
-    kIndian = 6;
-    kIslamic = 7;
-    kJapanese = 8;
-    kKorean = 9;
-    kPersian = 10;
-    kTaiwanese = 11;
-    kUseActiveLocale = 255;
-  }
-
-  enum HourFormatEnum : enum8 {
-    k12hr = 0;
-    k24hr = 1;
-    kUseActiveLocale = 255;
-  }
-
-  bitmap Feature : bitmap32 {
-    kCalendarFormat = 0x1;
-  }
-
-  attribute access(write: manage) HourFormatEnum hourFormat = 0;
-  attribute access(write: manage) optional CalendarTypeEnum activeCalendarType = 1;
-  readonly attribute optional CalendarTypeEnum supportedCalendarTypes[] = 2;
-  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;
-}
-
 /** Nodes should be expected to be deployed to any and all regions of the world. These global regions
       may have differing preferences for the units in which values are conveyed in communication to a
       user. As such, Nodes that visually or audibly convey measurable values to the user need a
@@ -1196,27 +1135,6 @@ endpoint 0 {
     ram      attribute clusterRevision default = 3;
   }
 
-  server cluster LocalizationConfiguration {
-    ram      attribute activeLocale;
-    callback attribute supportedLocales;
-    callback attribute generatedCommandList;
-    callback attribute acceptedCommandList;
-    callback attribute eventList;
-    callback attribute attributeList;
-    ram      attribute featureMap default = 0;
-    ram      attribute clusterRevision default = 1;
-  }
-
-  server cluster TimeFormatLocalization {
-    ram      attribute hourFormat;
-    callback attribute generatedCommandList;
-    callback attribute acceptedCommandList;
-    callback attribute eventList;
-    callback attribute attributeList;
-    ram      attribute featureMap default = 0;
-    ram      attribute clusterRevision default = 1;
-  }
-
   server cluster UnitLocalization {
     callback attribute generatedCommandList;
     callback attribute acceptedCommandList;
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 13188112fd05e6..55d62101227dab 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
@@ -746,266 +746,6 @@
             }
           ]
         },
-        {
-          "name": "Localization Configuration",
-          "code": 43,
-          "mfgCode": null,
-          "define": "LOCALIZATION_CONFIGURATION_CLUSTER",
-          "side": "server",
-          "enabled": 1,
-          "attributes": [
-            {
-              "name": "ActiveLocale",
-              "code": 0,
-              "mfgCode": null,
-              "side": "server",
-              "type": "char_string",
-              "included": 1,
-              "storageOption": "RAM",
-              "singleton": 0,
-              "bounded": 0,
-              "defaultValue": "",
-              "reportable": 1,
-              "minInterval": 1,
-              "maxInterval": 65534,
-              "reportableChange": 0
-            },
-            {
-              "name": "SupportedLocales",
-              "code": 1,
-              "mfgCode": null,
-              "side": "server",
-              "type": "array",
-              "included": 1,
-              "storageOption": "External",
-              "singleton": 0,
-              "bounded": 0,
-              "defaultValue": null,
-              "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": null,
-              "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": null,
-              "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": null,
-              "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": null,
-              "reportable": 1,
-              "minInterval": 1,
-              "maxInterval": 65534,
-              "reportableChange": 0
-            },
-            {
-              "name": "FeatureMap",
-              "code": 65532,
-              "mfgCode": null,
-              "side": "server",
-              "type": "bitmap32",
-              "included": 1,
-              "storageOption": "RAM",
-              "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": "Time Format Localization",
-          "code": 44,
-          "mfgCode": null,
-          "define": "TIME_FORMAT_LOCALIZATION_CLUSTER",
-          "side": "server",
-          "enabled": 1,
-          "attributes": [
-            {
-              "name": "HourFormat",
-              "code": 0,
-              "mfgCode": null,
-              "side": "server",
-              "type": "HourFormatEnum",
-              "included": 1,
-              "storageOption": "RAM",
-              "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": null,
-              "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": null,
-              "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": null,
-              "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": null,
-              "reportable": 1,
-              "minInterval": 1,
-              "maxInterval": 65534,
-              "reportableChange": 0
-            },
-            {
-              "name": "FeatureMap",
-              "code": 65532,
-              "mfgCode": null,
-              "side": "server",
-              "type": "bitmap32",
-              "included": 1,
-              "storageOption": "RAM",
-              "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": "Unit Localization",
           "code": 45,

From 2acee398d3e6f6007776b4931a5f31e6bf574f51 Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Sun, 17 Dec 2023 18:12:04 +0000
Subject: [PATCH 74/80] Removed EVSE commands from ZAP to avoid emberAf linker
 errors since these are handled in the IM Commands handler

---
 .../energy-management-app.zap                 | 67 +------------------
 1 file changed, 1 insertion(+), 66 deletions(-)

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 55d62101227dab..e7bd561c91715c 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
@@ -2525,72 +2525,7 @@
           "side": "server",
           "enabled": 1,
           "apiMaturity": "provisional",
-          "commands": [
-            {
-              "name": "GetTargetsResponse",
-              "code": 0,
-              "mfgCode": null,
-              "source": "server",
-              "isIncoming": 0,
-              "isEnabled": 1
-            },
-            {
-              "name": "Disable",
-              "code": 1,
-              "mfgCode": null,
-              "source": "client",
-              "isIncoming": 1,
-              "isEnabled": 1
-            },
-            {
-              "name": "EnableCharging",
-              "code": 2,
-              "mfgCode": null,
-              "source": "client",
-              "isIncoming": 1,
-              "isEnabled": 1
-            },
-            {
-              "name": "EnableDischarging",
-              "code": 3,
-              "mfgCode": null,
-              "source": "client",
-              "isIncoming": 1,
-              "isEnabled": 1
-            },
-            {
-              "name": "StartDiagnostics",
-              "code": 4,
-              "mfgCode": null,
-              "source": "client",
-              "isIncoming": 1,
-              "isEnabled": 1
-            },
-            {
-              "name": "SetTargets",
-              "code": 5,
-              "mfgCode": null,
-              "source": "client",
-              "isIncoming": 1,
-              "isEnabled": 1
-            },
-            {
-              "name": "GetTargets",
-              "code": 6,
-              "mfgCode": null,
-              "source": "client",
-              "isIncoming": 1,
-              "isEnabled": 1
-            },
-            {
-              "name": "ClearTargets",
-              "code": 7,
-              "mfgCode": null,
-              "source": "client",
-              "isIncoming": 1,
-              "isEnabled": 1
-            }
-          ],
+          "commands": [],
           "attributes": [
             {
               "name": "State",

From ba7e4369bf5a7001b30c7cc8fdd4a2d26aabc94a Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Mon, 18 Dec 2023 14:37:40 +0000
Subject: [PATCH 75/80] Regen_all to update energy-management.matter file to
 remove commands that cause linker errors.

---
 .../energy-management-app.matter                         | 9 ---------
 1 file changed, 9 deletions(-)

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 0452ec58d3eef8..002a0f671539d9 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
@@ -1328,15 +1328,6 @@ endpoint 1 {
     callback attribute attributeList;
     ram      attribute featureMap default = 1;
     ram      attribute clusterRevision default = 2;
-
-    handle command GetTargetsResponse;
-    handle command Disable;
-    handle command EnableCharging;
-    handle command EnableDischarging;
-    handle command StartDiagnostics;
-    handle command SetTargets;
-    handle command GetTargets;
-    handle command ClearTargets;
   }
 }
 

From 73ecb1b18c6953f9291d6bd85dd4c829890536a6 Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Mon, 18 Dec 2023 14:46:34 +0000
Subject: [PATCH 76/80] Minor changes to align all-clusters and
 energy-management common.

---
 .../all-clusters-common/include/EnergyEvseDelegateImpl.h        | 2 +-
 .../all-clusters-common/src/EnergyEvseDelegateImpl.cpp          | 2 +-
 .../energy-management-common/include/EnergyEvseDelegateImpl.h   | 2 +-
 .../energy-management-common/src/EnergyEvseDelegateImpl.cpp     | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h b/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h
index 4d6a508b6bc8d1..468f7f205f479d 100644
--- a/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h
+++ b/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h
@@ -152,7 +152,7 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate
     StateEnum mHwState                              = StateEnum::kNotPluggedIn; /* Hardware state */
 
     /* Callback related */
-    EVSECallbackWrapper mCallbacks = { .handler = nullptr }; /* Wrapper to allow callbacks to be registered */
+    EVSECallbackWrapper mCallbacks = { .handler = nullptr, .arg = 0 }; /* Wrapper to allow callbacks to be registered */
     Status NotifyApplicationCurrentLimitChange(int64_t maximumChargeCurrent);
     Status NotifyApplicationStateChange();
 
diff --git a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
index 4b1be52538273a..c17e79530a33c2 100644
--- a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
+++ b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
@@ -48,7 +48,7 @@ Status EnergyEvseDelegate::Disable()
 {
     ChipLogProgress(AppServer, "EnergyEvseDelegate::Disable()");
 
-    /* update State */
+    /* Update State */
     switch (mHwState)
     {
     case StateEnum::kNotPluggedIn:
diff --git a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h
index 4d6a508b6bc8d1..468f7f205f479d 100644
--- a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h
+++ b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h
@@ -152,7 +152,7 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate
     StateEnum mHwState                              = StateEnum::kNotPluggedIn; /* Hardware state */
 
     /* Callback related */
-    EVSECallbackWrapper mCallbacks = { .handler = nullptr }; /* Wrapper to allow callbacks to be registered */
+    EVSECallbackWrapper mCallbacks = { .handler = nullptr, .arg = 0 }; /* Wrapper to allow callbacks to be registered */
     Status NotifyApplicationCurrentLimitChange(int64_t maximumChargeCurrent);
     Status NotifyApplicationStateChange();
 
diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
index 4b1be52538273a..c17e79530a33c2 100644
--- a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
+++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
@@ -48,7 +48,7 @@ Status EnergyEvseDelegate::Disable()
 {
     ChipLogProgress(AppServer, "EnergyEvseDelegate::Disable()");
 
-    /* update State */
+    /* Update State */
     switch (mHwState)
     {
     case StateEnum::kNotPluggedIn:

From 3f62fea58478d2e1668c138a335d44889195ed8f Mon Sep 17 00:00:00 2001
From: jamesharrow <93921463+jamesharrow@users.noreply.github.com>
Date: Tue, 19 Dec 2023 08:52:07 +0000
Subject: [PATCH 77/80] Apply suggestions from code review

Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
---
 .../all-clusters-common/include/EVSECallbacks.h               | 4 ++--
 .../all-clusters-common/src/EnergyEvseDelegateImpl.cpp        | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/examples/all-clusters-app/all-clusters-common/include/EVSECallbacks.h b/examples/all-clusters-app/all-clusters-common/include/EVSECallbacks.h
index d1a7e71d1f229b..a1c85ebf5d826e 100644
--- a/examples/all-clusters-app/all-clusters-common/include/EVSECallbacks.h
+++ b/examples/all-clusters-app/all-clusters-common/include/EVSECallbacks.h
@@ -24,8 +24,8 @@ namespace Clusters {
 
 using namespace chip::app::Clusters::EnergyEvse;
 
-/* This callbacks mechanism is intended to allow different delegates to callback
- * and inform the manufacturer that something has changed.
+/* This callbacks mechanism is intended to allow different delegates to
+ * dispatch notifications that something has changed.
  *
  * This is not specific to the EnergyEVSE cluster, but includes DeviceEnergyManagement
  * and potential future clusters.
diff --git a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
index c17e79530a33c2..4cc83eaaf8a835 100644
--- a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
+++ b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp
@@ -204,7 +204,7 @@ Status EnergyEvseDelegate::StartDiagnostics()
     /* For EVSE manufacturers to customize */
     ChipLogProgress(AppServer, "EnergyEvseDelegate::StartDiagnostics()");
 
-    /* update SupplyState to indicate in Diagnostics mode */
+    /* update SupplyState to indicate we are now in Diagnostics mode */
     SetSupplyState(SupplyStateEnum::kDisabledDiagnostics);
 
     // TODO: Generate events

From feaa0067af076514a48b4a0567e3da91d8c2ae7a Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Tue, 19 Dec 2023 15:48:39 +0000
Subject: [PATCH 78/80] Addressed comment and replicated into example energy
 management copies.

---
 .../all-clusters-common/include/EnergyEvseDelegateImpl.h    | 6 +++++-
 .../energy-management-common/include/EVSECallbacks.h        | 4 ++--
 .../include/EnergyEvseDelegateImpl.h                        | 6 +++++-
 .../energy-management-common/src/EnergyEvseDelegateImpl.cpp | 2 +-
 4 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h b/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h
index 468f7f205f479d..f3c003d081fc6e 100644
--- a/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h
+++ b/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h
@@ -69,9 +69,13 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate
      */
     Status StartDiagnostics() override;
 
+    /**
+     * @brief    Called by EVSE Hardware to register a single callback handler
+     */
+    Status HwRegisterEvseCallbackHandler(EVSECallbackFunc handler, intptr_t arg);
+
     // -----------------------------------------------------------------
     // Internal API to allow an EVSE to change its internal state etc
-    Status HwRegisterEvseCallbackHandler(EVSECallbackFunc handler, intptr_t arg);
     Status HwSetMaxHardwareCurrentLimit(int64_t currentmA);
     Status HwSetCircuitCapacity(int64_t currentmA);
     Status HwSetCableAssemblyLimit(int64_t currentmA);
diff --git a/examples/energy-management-app/energy-management-common/include/EVSECallbacks.h b/examples/energy-management-app/energy-management-common/include/EVSECallbacks.h
index d1a7e71d1f229b..a1c85ebf5d826e 100644
--- a/examples/energy-management-app/energy-management-common/include/EVSECallbacks.h
+++ b/examples/energy-management-app/energy-management-common/include/EVSECallbacks.h
@@ -24,8 +24,8 @@ namespace Clusters {
 
 using namespace chip::app::Clusters::EnergyEvse;
 
-/* This callbacks mechanism is intended to allow different delegates to callback
- * and inform the manufacturer that something has changed.
+/* This callbacks mechanism is intended to allow different delegates to
+ * dispatch notifications that something has changed.
  *
  * This is not specific to the EnergyEVSE cluster, but includes DeviceEnergyManagement
  * and potential future clusters.
diff --git a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h
index 468f7f205f479d..f3c003d081fc6e 100644
--- a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h
+++ b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h
@@ -69,9 +69,13 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate
      */
     Status StartDiagnostics() override;
 
+    /**
+     * @brief    Called by EVSE Hardware to register a single callback handler
+     */
+    Status HwRegisterEvseCallbackHandler(EVSECallbackFunc handler, intptr_t arg);
+
     // -----------------------------------------------------------------
     // Internal API to allow an EVSE to change its internal state etc
-    Status HwRegisterEvseCallbackHandler(EVSECallbackFunc handler, intptr_t arg);
     Status HwSetMaxHardwareCurrentLimit(int64_t currentmA);
     Status HwSetCircuitCapacity(int64_t currentmA);
     Status HwSetCableAssemblyLimit(int64_t currentmA);
diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
index c17e79530a33c2..4cc83eaaf8a835 100644
--- a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
+++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
@@ -204,7 +204,7 @@ Status EnergyEvseDelegate::StartDiagnostics()
     /* For EVSE manufacturers to customize */
     ChipLogProgress(AppServer, "EnergyEvseDelegate::StartDiagnostics()");
 
-    /* update SupplyState to indicate in Diagnostics mode */
+    /* update SupplyState to indicate we are now in Diagnostics mode */
     SetSupplyState(SupplyStateEnum::kDisabledDiagnostics);
 
     // TODO: Generate events

From e8833d9eff5671af7033c38d490cfa19a5585dc8 Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Tue, 19 Dec 2023 15:52:44 +0000
Subject: [PATCH 79/80] Added documentation to EVSE Callbacks as to which
 struct in the union is used.

---
 .../all-clusters-common/include/EVSECallbacks.h                 | 2 ++
 .../energy-management-common/include/EVSECallbacks.h            | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/examples/all-clusters-app/all-clusters-common/include/EVSECallbacks.h b/examples/all-clusters-app/all-clusters-common/include/EVSECallbacks.h
index a1c85ebf5d826e..5bdac2f8e853d6 100644
--- a/examples/all-clusters-app/all-clusters-common/include/EVSECallbacks.h
+++ b/examples/all-clusters-app/all-clusters-common/include/EVSECallbacks.h
@@ -56,12 +56,14 @@ struct EVSECbInfo
 
     union
     {
+        /* for type = StateChanged */
         struct
         {
             StateEnum state;
             SupplyStateEnum supplyState;
         } StateChange;
 
+        /* for type = ChargeCurrentChanged */
         struct
         {
             int64_t maximumChargeCurrent;
diff --git a/examples/energy-management-app/energy-management-common/include/EVSECallbacks.h b/examples/energy-management-app/energy-management-common/include/EVSECallbacks.h
index a1c85ebf5d826e..5bdac2f8e853d6 100644
--- a/examples/energy-management-app/energy-management-common/include/EVSECallbacks.h
+++ b/examples/energy-management-app/energy-management-common/include/EVSECallbacks.h
@@ -56,12 +56,14 @@ struct EVSECbInfo
 
     union
     {
+        /* for type = StateChanged */
         struct
         {
             StateEnum state;
             SupplyStateEnum supplyState;
         } StateChange;
 
+        /* for type = ChargeCurrentChanged */
         struct
         {
             int64_t maximumChargeCurrent;

From 470110207c4851053db654edc81cc38026c5ff0f Mon Sep 17 00:00:00 2001
From: James Harrow <james.harrow@gmail.com>
Date: Tue, 19 Dec 2023 18:05:22 +0000
Subject: [PATCH 80/80] Added Energy EVSE and Device Energy Management to
 config-data.yml under CommandHandlerInterfaceOnlyClusters. Then turned on
 EVSE commands in ZAP.

---
 .../all-clusters-app.matter                   |  9 ++
 .../all-clusters-common/all-clusters-app.zap  | 66 +++++++++++++++
 .../energy-management-app.matter              |  9 ++
 .../energy-management-app.zap                 | 67 ++++++++++++++-
 src/app/common/templates/config-data.yaml     |  2 +
 .../app-common/zap-generated/callback.h       | 84 -------------------
 6 files changed, 152 insertions(+), 85 deletions(-)

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 45be7ed614d227..59090b662d6486 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
@@ -7354,6 +7354,15 @@ endpoint 1 {
     callback attribute attributeList;
     ram      attribute featureMap default = 0;
     ram      attribute clusterRevision default = 2;
+
+    handle command GetTargetsResponse;
+    handle command Disable;
+    handle command EnableCharging;
+    handle command EnableDischarging;
+    handle command StartDiagnostics;
+    handle command SetTargets;
+    handle command GetTargets;
+    handle command ClearTargets;
   }
 
   server cluster WindowCovering {
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 0bba4b8871e6c2..6f35331ee14640 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
@@ -11737,6 +11737,72 @@
           "side": "server",
           "enabled": 1,
           "apiMaturity": "provisional",
+          "commands": [
+            {
+              "name": "GetTargetsResponse",
+              "code": 0,
+              "mfgCode": null,
+              "source": "server",
+              "isIncoming": 0,
+              "isEnabled": 1
+            },
+            {
+              "name": "Disable",
+              "code": 1,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "EnableCharging",
+              "code": 2,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "EnableDischarging",
+              "code": 3,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "StartDiagnostics",
+              "code": 4,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "SetTargets",
+              "code": 5,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "GetTargets",
+              "code": 6,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "ClearTargets",
+              "code": 7,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            }
+          ],
           "attributes": [
             {
               "name": "State",
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 002a0f671539d9..0452ec58d3eef8 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
@@ -1328,6 +1328,15 @@ endpoint 1 {
     callback attribute attributeList;
     ram      attribute featureMap default = 1;
     ram      attribute clusterRevision default = 2;
+
+    handle command GetTargetsResponse;
+    handle command Disable;
+    handle command EnableCharging;
+    handle command EnableDischarging;
+    handle command StartDiagnostics;
+    handle command SetTargets;
+    handle command GetTargets;
+    handle command ClearTargets;
   }
 }
 
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 e7bd561c91715c..55d62101227dab 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
@@ -2525,7 +2525,72 @@
           "side": "server",
           "enabled": 1,
           "apiMaturity": "provisional",
-          "commands": [],
+          "commands": [
+            {
+              "name": "GetTargetsResponse",
+              "code": 0,
+              "mfgCode": null,
+              "source": "server",
+              "isIncoming": 0,
+              "isEnabled": 1
+            },
+            {
+              "name": "Disable",
+              "code": 1,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "EnableCharging",
+              "code": 2,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "EnableDischarging",
+              "code": 3,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "StartDiagnostics",
+              "code": 4,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "SetTargets",
+              "code": 5,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "GetTargets",
+              "code": 6,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            },
+            {
+              "name": "ClearTargets",
+              "code": 7,
+              "mfgCode": null,
+              "source": "client",
+              "isIncoming": 1,
+              "isEnabled": 1
+            }
+          ],
           "attributes": [
             {
               "name": "State",
diff --git a/src/app/common/templates/config-data.yaml b/src/app/common/templates/config-data.yaml
index 9d3e094ffb046c..577e04ab04a856 100644
--- a/src/app/common/templates/config-data.yaml
+++ b/src/app/common/templates/config-data.yaml
@@ -37,6 +37,8 @@ CommandHandlerInterfaceOnlyClusters:
     - RVC Operational State
     - Sample MEI
     - Microwave Oven Control
+    - Energy EVSE
+    - Device Energy Management
 
 # 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/zzz_generated/app-common/app-common/zap-generated/callback.h b/zzz_generated/app-common/app-common/zap-generated/callback.h
index 82c757f56a1b31..eb8a85cd2b0792 100644
--- a/zzz_generated/app-common/app-common/zap-generated/callback.h
+++ b/zzz_generated/app-common/app-common/zap-generated/callback.h
@@ -10151,90 +10151,6 @@ bool emberAfDemandResponseLoadControlClusterRemoveLoadControlEventRequestCallbac
 bool emberAfDemandResponseLoadControlClusterClearLoadControlEventsRequestCallback(
     chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath,
     const chip::app::Clusters::DemandResponseLoadControl::Commands::ClearLoadControlEventsRequest::DecodableType & commandData);
-/**
- * @brief Device Energy Management Cluster PowerAdjustRequest Command callback (from client)
- */
-bool emberAfDeviceEnergyManagementClusterPowerAdjustRequestCallback(
-    chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath,
-    const chip::app::Clusters::DeviceEnergyManagement::Commands::PowerAdjustRequest::DecodableType & commandData);
-/**
- * @brief Device Energy Management Cluster CancelPowerAdjustRequest Command callback (from client)
- */
-bool emberAfDeviceEnergyManagementClusterCancelPowerAdjustRequestCallback(
-    chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath,
-    const chip::app::Clusters::DeviceEnergyManagement::Commands::CancelPowerAdjustRequest::DecodableType & commandData);
-/**
- * @brief Device Energy Management Cluster StartTimeAdjustRequest Command callback (from client)
- */
-bool emberAfDeviceEnergyManagementClusterStartTimeAdjustRequestCallback(
-    chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath,
-    const chip::app::Clusters::DeviceEnergyManagement::Commands::StartTimeAdjustRequest::DecodableType & commandData);
-/**
- * @brief Device Energy Management Cluster PauseRequest Command callback (from client)
- */
-bool emberAfDeviceEnergyManagementClusterPauseRequestCallback(
-    chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath,
-    const chip::app::Clusters::DeviceEnergyManagement::Commands::PauseRequest::DecodableType & commandData);
-/**
- * @brief Device Energy Management Cluster ResumeRequest Command callback (from client)
- */
-bool emberAfDeviceEnergyManagementClusterResumeRequestCallback(
-    chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath,
-    const chip::app::Clusters::DeviceEnergyManagement::Commands::ResumeRequest::DecodableType & commandData);
-/**
- * @brief Device Energy Management Cluster ModifyForecastRequest Command callback (from client)
- */
-bool emberAfDeviceEnergyManagementClusterModifyForecastRequestCallback(
-    chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath,
-    const chip::app::Clusters::DeviceEnergyManagement::Commands::ModifyForecastRequest::DecodableType & commandData);
-/**
- * @brief Device Energy Management Cluster RequestConstraintBasedForecast Command callback (from client)
- */
-bool emberAfDeviceEnergyManagementClusterRequestConstraintBasedForecastCallback(
-    chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath,
-    const chip::app::Clusters::DeviceEnergyManagement::Commands::RequestConstraintBasedForecast::DecodableType & commandData);
-/**
- * @brief Energy EVSE Cluster Disable Command callback (from client)
- */
-bool emberAfEnergyEvseClusterDisableCallback(chip::app::CommandHandler * commandObj,
-                                             const chip::app::ConcreteCommandPath & commandPath,
-                                             const chip::app::Clusters::EnergyEvse::Commands::Disable::DecodableType & commandData);
-/**
- * @brief Energy EVSE Cluster EnableCharging Command callback (from client)
- */
-bool emberAfEnergyEvseClusterEnableChargingCallback(
-    chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath,
-    const chip::app::Clusters::EnergyEvse::Commands::EnableCharging::DecodableType & commandData);
-/**
- * @brief Energy EVSE Cluster EnableDischarging Command callback (from client)
- */
-bool emberAfEnergyEvseClusterEnableDischargingCallback(
-    chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath,
-    const chip::app::Clusters::EnergyEvse::Commands::EnableDischarging::DecodableType & commandData);
-/**
- * @brief Energy EVSE Cluster StartDiagnostics Command callback (from client)
- */
-bool emberAfEnergyEvseClusterStartDiagnosticsCallback(
-    chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath,
-    const chip::app::Clusters::EnergyEvse::Commands::StartDiagnostics::DecodableType & commandData);
-/**
- * @brief Energy EVSE Cluster SetTargets Command callback (from client)
- */
-bool emberAfEnergyEvseClusterSetTargetsCallback(
-    chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath,
-    const chip::app::Clusters::EnergyEvse::Commands::SetTargets::DecodableType & commandData);
-/**
- * @brief Energy EVSE Cluster GetTargets Command callback (from client)
- */
-bool emberAfEnergyEvseClusterGetTargetsCallback(
-    chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath,
-    const chip::app::Clusters::EnergyEvse::Commands::GetTargets::DecodableType & commandData);
-/**
- * @brief Energy EVSE Cluster ClearTargets Command callback (from client)
- */
-bool emberAfEnergyEvseClusterClearTargetsCallback(
-    chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath,
-    const chip::app::Clusters::EnergyEvse::Commands::ClearTargets::DecodableType & commandData);
 /**
  * @brief Door Lock Cluster LockDoor Command callback (from client)
  */