Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue: #30580 Create initial EVSE cluster for SDK #30581

Merged
merged 7 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ jobs:
src/app/zap-templates/zcl/data-model/chip/microwave-oven-mode-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/microwave-oven-control-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/door-lock-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/ethernet-network-diagnostics-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/fan-control-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/fault-injection-cluster.xml \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ CHIP_ERROR DataModelLogger::LogEvent(const chip::app::EventHeader & header, chip
{{/first}}
case {{asUpperCamelCase parent.name}}::Events::{{asUpperCamelCase name}}::Id:
{
{{zapTypeToDecodableClusterObjectType name ns=parent.name forceNotOptional=true}} value;
{{asUpperCamelCase parent.name}}::Events::{{asUpperCamelCase name}}::DecodableType value;
andy31415 marked this conversation as resolved.
Show resolved Hide resolved
jamesharrow marked this conversation as resolved.
Show resolved Hide resolved
ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value));
return DataModelLogger::LogValue("{{name}}", 1, value);
}
Expand Down
1 change: 1 addition & 0 deletions scripts/rules.matterlint
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ load "../src/app/zap-templates/zcl/data-model/chip/dishwasher-mode-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/microwave-oven-mode-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/microwave-oven-control-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/door-lock-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/ethernet-network-diagnostics-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/fan-control-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/fixed-label-cluster.xml";
Expand Down
1 change: 1 addition & 0 deletions src/app/zap-templates/zcl/data-model/all.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<xi:include href="chip/microwave-oven-mode-cluster.xml" />
<xi:include href="chip/microwave-oven-control-cluster.xml" />
<xi:include href="chip/door-lock-cluster.xml" />
<xi:include href="chip/energy-evse-cluster.xml" />
<xi:include href="chip/ethernet-network-diagnostics-cluster.xml" />
<xi:include href="chip/fan-control-cluster.xml" />
<xi:include href="chip/fault-injection-cluster.xml" />
Expand Down
224 changes: 224 additions & 0 deletions src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,224 @@
<?xml version="1.0"?>
<!--
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.
-->
<configurator>
<domain name="Energy Management"/>
<enum name="StateEnum" type="enum8" apiMaturity="provisional">
<cluster code="0x0099"/>
<item name="NotPluggedIn" value="0x00"/>
<item name="PluggedInNoDemand" value="0x01"/>
<item name="PluggedInDemand" value="0x02"/>
<item name="PluggedInCharging" value="0x03"/>
<item name="PluggedInDischarging" value="0x04"/>
<item name="SessionEnding" value="0x05"/>
<item name="Fault" value="0x06"/>
</enum>
<enum name="SupplyStateEnum" type="enum8" apiMaturity="provisional">
<cluster code="0x0099"/>
<item name="Disabled" value="0x00"/>
<item name="ChargingEnabled" value="0x01"/>
<item name="DischargingEnabled" value="0x02"/>
<item name="DisabledError" value="0x03"/>
<item name="DisabledDiagnostics" value="0x04"/>
</enum>
<enum name="FaultStateEnum" type="enum8" apiMaturity="provisional">
<cluster code="0x0099"/>
<item name="NoError" value="0x00"/>
<item name="MeterFailure" value="0x01"/>
<item name="OverVoltage" value="0x02"/>
<item name="UnderVoltage" value="0x03"/>
<item name="OverCurrent" value="0x04"/>
<item name="ContactWetFailure" value="0x05"/>
<item name="ContactDryFailure" value="0x06"/>
<item name="GroundFault" value="0x07"/>
<item name="PowerLoss" value="0x08"/>
<item name="PowerQuality" value="0x09"/>
<item name="PilotShortCircuit" value="0x0A"/>
<item name="EmergencyStop" value="0x0B"/>
<item name="EVDisconnected" value="0x0C"/>
<item name="WrongPowerSupply" value="0x0D"/>
<item name="LiveNeutralSwap" value="0x0E"/>
<item name="OverTemperature" value="0x0F"/>
<item name="Other" value="0xFF"/>
</enum>
<enum name="EnergyTransferStoppedReasonEnum" type="enum8" apiMaturity="provisional">
<cluster code="0x0099"/>
<item name="EVStopped" value="0x00"/>
<item name="EVSEStopped" value="0x01"/>
<item name="Other" value="0x02"/>
andy31415 marked this conversation as resolved.
Show resolved Hide resolved
</enum>
<bitmap name="TargetDayOfWeekBitmap" type="bitmap8" apiMaturity="provisional">
<cluster code="0x0099"/>
<field name="Sunday" mask="0x01"/>
<field name="Monday" mask="0x02"/>
<field name="Tuesday" mask="0x04"/>
<field name="Wednesday" mask="0x08"/>
<field name="Thursday" mask="0x10"/>
<field name="Friday" mask="0x20"/>
<field name="Saturday" mask="0x40"/>
</bitmap>
<struct name="ChargingTargetStruct" apiMaturity="provisional">
<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"/>
</struct>
<cluster apiMaturity="provisional">
<name>Energy EVSE</name>
<domain>Energy Management</domain>
<code>0x0099</code>
<define>ENERGY_EVSE_CLUSTER</define>
<client init="false" tick="false">true</client>
<server init="false" tick="false">true</server>
<description>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.</description>

<globalAttribute side="server" code="0xFFFD" value="2" />

<!--Attributes-->
<attribute code="0x0000" side="server" type="StateEnum" define="STATE" isNullable="true" writable="false" optional="false">State</attribute>
jamesharrow marked this conversation as resolved.
Show resolved Hide resolved
<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>
jamesharrow marked this conversation as resolved.
Show resolved Hide resolved
<!--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>
jamesharrow marked this conversation as resolved.
Show resolved Hide resolved
<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>
<!--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">
<access op="read" privilege="view"/>
<access op="write" privilege="manage"/>
<description>UserMaximumChargeCurrent</description>
</attribute>
<attribute code="0x000A" side="server" type="elapsed_s" define="RANDOMIZATION_DELAY_WINDOW" default="600" writable="true" optional="true">
<access op="read" privilege="view"/>
<access op="write" privilege="manage"/>
<description>RandomizationDelayWindow</description>
</attribute>
<!--Conformance feature PREF - for now optional-->
<attribute code="0x0021" side="server" type="int8u" define="NUMBER_OF_WEEKLY_TARGETS" default="0" writable="false" optional="true">NumberOfWeeklyTargets</attribute>
<!--Conformance feature PREF - for now optional-->
<attribute code="0x0022" side="server" type="int8u" define="NUMBER_OF_DAILY_TARGETS" default="1" writable="false" optional="true">NumberOfDailyTargets</attribute>
<!--Conformance feature PREF - for now optional-->
<attribute code="0x0023" side="server" type="epoch_s" define="NEXT_CHARGE_START_TIME" isNullable="true" max="0xFFFFFFFE" writable="false" optional="true">NextChargeStartTime</attribute>
<!--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>
jamesharrow marked this conversation as resolved.
Show resolved Hide resolved
<!--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-->
<attribute code="0x0027" side="server" type="int16u" define="APPROXIMATE_EV_EFFICIENCY" isNullable="true" default="0xFFFF" max="0xFFFE" writable="true" optional="true">
<access op="read" privilege="view"/>
<access op="write" privilege="manage"/>
<description>ApproximateEVEfficiency</description>
</attribute>
<!--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>
<!--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>
<!--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>
jamesharrow marked this conversation as resolved.
Show resolved Hide resolved
<command source="client" code="0x0001" name="Disable" optional="false" mustUseTimedInvoke="true" apiMaturity="provisional">
<access op="invoke" privilege="operate"/>
jamesharrow marked this conversation as resolved.
Show resolved Hide resolved
<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"/>
<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"/>
<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">
<arg name="DayOfWeekforSequence" type="TargetDayOfWeekBitmap"/>
<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">
jamesharrow marked this conversation as resolved.
Show resolved Hide resolved
<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">
<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"/>
</event>
<event code="0x0002" name="EnergyTransferStarted" priority="info" side="server" 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"/>
</event>
<event code="0x0003" name="EnergyTransferStopped" priority="info" side="server" 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"/>
</event>
<event code="0x0004" name="Fault" priority="critical" side="server" 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">
<description>RFID</description>
<field id="0" name="UID" type="octet_string" length="10" apiMaturity="provisional"/>
</event>
</cluster>
<bitmap name="Feature" type="bitmap32">
<cluster code="0x0099"/>
<field name="ChargingPreferences" mask="0x1"/>
<field name="SoCReporting" mask="0x2"/>
<field name="PlugAndCharge" mask="0x4"/>
<field name="RFID" mask="0x8"/>
<field name="V2X" mask="0x10"/>
</bitmap>
</configurator>
1 change: 1 addition & 0 deletions src/app/zap-templates/zcl/zcl-with-test-extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"microwave-oven-control-cluster.xml",
"door-lock-cluster.xml",
"electrical-measurement-cluster.xml",
"energy-evse-cluster.xml",
"ethernet-network-diagnostics-cluster.xml",
"fan-control-cluster.xml",
"fault-injection-cluster.xml",
Expand Down
1 change: 1 addition & 0 deletions src/app/zap-templates/zcl/zcl.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"door-lock-cluster.xml",
"drlc-cluster.xml",
"electrical-measurement-cluster.xml",
"energy-evse-cluster.xml",
"ethernet-network-diagnostics-cluster.xml",
"fan-control-cluster.xml",
"fault-injection-cluster.xml",
Expand Down
2 changes: 2 additions & 0 deletions src/app/zap_cluster_list.json
jamesharrow marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"MICROWAVE_OVEN_MODE_CLUSTER": [],
"DOOR_LOCK_CLUSTER": [],
"ELECTRICAL_MEASUREMENT_CLUSTER": [],
"ENERGY_EVSE_CLUSTER": [],
"ETHERNET_NETWORK_DIAGNOSTICS_CLUSTER": [],
"FAN_CONTROL_CLUSTER": [],
"FAULT_INJECTION_CLUSTER": [],
Expand Down Expand Up @@ -163,6 +164,7 @@
"MICROWAVE_OVEN_MODE_CLUSTER": ["mode-base-server"],
"DOOR_LOCK_CLUSTER": ["door-lock-server"],
"ELECTRICAL_MEASUREMENT_CLUSTER": [],
"ENERGY_EVSE_CLUSTER": ["energy-evse-server"],
"ETHERNET_NETWORK_DIAGNOSTICS_CLUSTER": [
"ethernet-network-diagnostics-server"
],
Expand Down
2 changes: 2 additions & 0 deletions src/controller/data_model/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ if (current_os == "android" || matter_enable_java_compilation) {
"jni/ElectricalMeasurementClient-ReadImpl.cpp",
"jni/EthernetNetworkDiagnosticsClient-InvokeSubscribeImpl.cpp",
"jni/EthernetNetworkDiagnosticsClient-ReadImpl.cpp",
"jni/EnergyEvseClient-InvokeSubscribeImpl.cpp",
"jni/EnergyEvseClient-ReadImpl.cpp",
"jni/FanControlClient-InvokeSubscribeImpl.cpp",
"jni/FanControlClient-ReadImpl.cpp",
"jni/FaultInjectionClient-InvokeSubscribeImpl.cpp",
Expand Down
Loading
Loading