Skip to content

Commit

Permalink
Add XML for DRLC cluster and enable client API bits for it. (#30480)
Browse files Browse the repository at this point in the history
* DRLC xml added

* Ran codegen

* Remove implementation parts for now.

Align with CHIP-Specifications/connectedhomeip-spec#7762

* Regenerate generated code again.

---------

Co-authored-by: David Rempel <[email protected]>
  • Loading branch information
bzbarsky-apple and drempelg authored Nov 15, 2023
1 parent 27328ae commit 75cf38c
Show file tree
Hide file tree
Showing 75 changed files with 17,681 additions and 0 deletions.
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 @@ -23,6 +23,7 @@
<xi:include href="chip/diagnostic-logs-cluster.xml" />
<xi:include href="chip/dishwasher-alarm-cluster.xml" />
<xi:include href="chip/dishwasher-mode-cluster.xml" />
<xi:include href="chip/drlc.xml" />
<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" />
Expand Down
264 changes: 264 additions & 0 deletions src/app/zap-templates/zcl/data-model/chip/drlc-cluster.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,264 @@
<?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"/>

<bitmap name="Feature" type="bitmap32">
<cluster code="0x0096"/>
<field name="EnrollmentGroups" mask="0x1"/>
<field name="TemperatureOffset" mask="0x2"/>
<field name="TemperatureSetpoint" mask="0x4"/>
<field name="LoadAdjustment" mask="0x8"/>
<field name="DutyCycle" mask="0x10"/>
<field name="PowerSavings" mask="0x20"/>
<field name="HeatingSource" mask="0x40"/>
</bitmap>

<bitmap name="DeviceClassBitmap" type="bitmap32">
<cluster code="0x0096"/>
<field name="HVAC" mask="0x01"/>
<field name="StripHeater" mask="0x02"/>
<field name="WaterHeater" mask="0x04"/>
<field name="PoolPump" mask="0x08"/>
<field name="SmartAppliance" mask="0x10"/>
<field name="IrrigationPump" mask="0x20"/>
<field name="CommercialLoad" mask="0x40"/>
<field name="ResidentialLoad" mask="0x80"/>
<field name="ExteriorLighting" mask="0x0100"/>
<field name="InteriorLighting" mask="0x0200"/>
<field name="EV" mask="0x0400"/>
<field name="GenerationSystem" mask="0x0800"/>
<field name="SmartInverter" mask="0x1000"/>
<field name="EVSE" mask="0x2000"/>
<field name="RESU" mask="0x4000"/>
<field name="EMS" mask="0x8000"/>
<field name="SEM" mask="0x10000"/>
</bitmap>

<bitmap name="EventControlBitmap" type="bitmap16">
<cluster code="0x0096"/>
<field name="RandomStart" mask="0x01"/>
</bitmap>

<bitmap name="EventTransitionControlBitmap" type="bitmap16">
<cluster code="0x0096"/>
<field name="RandomDuration" mask="0x01"/>
<field name="IgnoreOptOut" mask="0x02"/>
</bitmap>

<bitmap name="CancelControlBitmap" type="bitmap16">
<cluster code="0x0096"/>
<field name="RandomEnd" mask="0x01"/>
</bitmap>

<enum name="LoadControlEventChangeSourceEnum" type="enum8">
<cluster code="0x0096"/>
<item name="Automatic" value="0x00"/>
<item name="UserAction" value="0x01"/>
</enum>

<enum name="LoadControlEventStatusEnum" type="enum8">
<cluster code="0x0096"/>
<item name="Unknown" value="0x00"/>
<item name="Received" value="0x01"/>
<item name="InProgress" value="0x02"/>
<item name="Completed" value="0x03"/>
<item name="OptedOut" value="0x04"/>
<item name="OptedIn" value="0x05"/>
<item name="Canceled" value="0x06"/>
<item name="Superseded" value="0x07"/>
<item name="PartialOptedOut" value="0x08"/>
<item name="PartialOptedIn" value="0x09"/>
<item name="NoParticipation" value="0x0A"/>
<item name="Unavailable" value="0x0B"/>
<item name="Failed" value="0x0C"/>
</enum>

<enum name="CriticalityLevelEnum" type="enum8">
<cluster code="0x0096"/>
<item name="Unknown" value="0x00"/>
<item name="Green" value="0x01"/>
<item name="Level1" value="0x02"/>
<item name="Level2" value="0x03"/>
<item name="Level3" value="0x04"/>
<item name="Level4" value="0x05"/>
<item name="Level5" value="0x06"/>
<item name="Emergency" value="0x07"/>
<item name="PlannedOutage" value="0x08"/>
<item name="ServiceDisconnect" value="0x09"/>
</enum>

<enum name="HeatingSourceEnum" type="enum8">
<cluster code="0x0096"/>
<item name="Any" value="0x0"/>
<item name="Electric" value="0x1"/>
<item name="NonElectric" value="0x2"/>
</enum>

<enum name="PowerSavingsEnum" type="enum8">
<cluster code="0x0096"/>
<item name="Low" value="0x0"/>
<item name="Medium" value="0x1"/>
<item name="High" value="0x2"/>
</enum>

<struct name="TemperatureControlStruct">
<cluster code="0x0096"/>
<!-- Note: No TemperatureDifference type available yet in ZAP XML -->
<item fieldId="0" name="CoolingTempOffset" type="int16u" isNullable="true" optional="true" />
<item fieldId="1" name="HeatingtTempOffset" type="int16u" isNullable="true" optional="true" />

This comment has been minimized.

Copy link
@Emill

Emill Aug 22, 2024

Typo: HeatingtTempOffset should be HeatingTempOffset, per the spec.

<item fieldId="2" name="CoolingTempSetpoint" type="temperature" isNullable="true" optional="true" />
<item fieldId="3" name="HeatingTempSetpoint" type="temperature" isNullable="true" optional="true" />
</struct>

<struct name="AverageLoadControlStruct">
<cluster code="0x0096"/>
<item fieldId="0" name="LoadAdjustment" type="int8s" min="-100" max="100" />
</struct>

<struct name="DutyCycleControlStruct">
<cluster code="0x0096"/>
<item fieldId="0" name="DutyCycle" type="percent" />
</struct>

<struct name="PowerSavingsControlStruct">
<cluster code="0x0096"/>
<item fieldId="0" name="PowerSavings" type="PowerSavingsEnum"/>
</struct>

<struct name="HeatingSourceControlStruct">
<cluster code="0x0096"/>
<item fieldId="0" name="HeatingSource" type="HeatingSourceEnum"/>
</struct>

<struct name="LoadControlEventTransitionStruct">
<cluster code="0x0096"/>
<item fieldId="0" name="Duration" type="int16u" max="1440"/>
<item fieldId="1" name="Control" type="EventTransitionControlBitmap"/>
<item fieldId="2" name="TemperatureControl" type="TemperatureControlStruct" optional="true"/>
<item fieldId="3" name="AverageLoadControl" type="AverageLoadControlStruct" optional="true"/>
<item fieldId="4" name="DutyCycleControl" type="DutyCycleControlStruct" optional="true"/>
<item fieldId="5" name="PowerSavingsControl" type="PowerSavingsControlStruct" optional="true"/>
<item fieldId="6" name="HeatingSourceControl" type="HeatingSourceControlStruct" optional="true"/>
</struct>

<!-- This does not quite match the spec, which has LoadControlEventStruct as a
fabric-scoped struct with some fabric-sensitive fields, but that doesn't
really make sense in all the places where the struct is used, and the spec
does not really define other things in a way that would work with that at
the moment. -->
<struct name="LoadControlEventStruct">
<cluster code="0x0096"/>
<item fieldId="0" name="EventID" type="octet_string" length="16"/>
<item fieldId="1" name="ProgramID" type="octet_string" length="16" isNullable="true"/>
<item fieldId="2" name="Control" type="EventControlBitmap" />
<item fieldId="3" name="DeviceClass" type="DeviceClassBitmap" />
<item fieldId="4" name="EnrollmentGroup" type="int8u" optional="true" />
<item fieldId="5" name="Criticality" type="CriticalityLevelEnum" defaut="0" />
<item fieldId="6" name="StartTime" type="epoch_s" isNullable="true" />
<item fieldId="7" name="Transitions" array="true" type="LoadControlEventTransitionStruct" />
</struct>

<struct name="LoadControlProgramStruct">
<cluster code="0x0096"/>
<item fieldId="0" name="ProgramID" type="octet_string" length="16"/>
<item fieldId="1" name="Name" type="long_char_string" length="32"/>
<item fieldId="2" name="EnrollmentGroup" type="int8u" isNullable="true" min="1" max="0xFF"/>
<item fieldId="3" name="RandomStartMinutes" type="int8u" isNullable="true" min="0x00" max="0x3C"/>
<item fieldId="4" name="RandomDurationMinutes" type="int8u" isNullable="true" min="0x00" max="0x3C"/>
</struct>

<cluster>
<name>Demand Response Load Control</name>
<domain>Energy</domain>
<description>This cluster provides an interface to the functionality of Smart Energy Demand Response and Load Control.</description>
<code>0x0096</code>
<define>DEMAND_RESPONSE_LOAD_CONTROL_CLUSTER</define>
<client tick="false" init="false">true</client>
<server tick="false" init="false">true</server>
<globalAttribute side="either" code="0xFFFD" value="4"/>

<attribute side="server" code="0x0000" define="DEVICE_CLASS" type="DeviceClassBitmap" default="0" writable="false">DeviceClass</attribute>
<attribute side="server" code="0x0001" define="LOAD_CONTROL_PROGRAMS" type="ARRAY" entryType="LoadControlProgramStruct" writable="false">LoadControlPrograms</attribute>
<attribute side="server" code="0x0002" define="NUMBER_OF_LOAD_CONTROL_PROGRAMS" type="int8u" min="5" writable="false" default="5">NumberOfLoadControlPrograms</attribute>
<attribute side="server" code="0x0003" define="LOAD_CONTROL_EVENTS" type="ARRAY" entryType="LoadControlEventStruct" writable="false">Events</attribute>
<attribute side="server" code="0x0004" define="LOAD_CONTROL_ACTIVE_EVENTS" type="ARRAY" entryType="LoadControlEventStruct" writable="false">ActiveEvents</attribute>
<attribute side="server" code="0x0005" define="NUMBER_OF_EVENTS_PER_PROGRAM" type="int8u" min="10" writable="false" default="10">NumberOfEventsPerProgram</attribute>
<attribute side="server" code="0x0006" define="NUMBER_OF_TRANSITIONS" type="int8u" min="3" writable="false" default="3">NumberOfTransistions</attribute>
<attribute side="server" code="0x0007" define="DEFAULT_RANDOM_START" type="int8u" min="0" max="0x3C" default="0x1E" writable="true">
<description>DefaultRandomStart</description>
<access op="read" privilege="view"/>
<access op="write" privilege="manage"/>
</attribute>
<attribute side="server" code="0x0008" define="DEFAULT_RANDOM_DURATION" type="int8u" min="0" max="0x3C" default="0" writable="true">
<description>DefaultRandomDuration</description>
<access op="read" privilege="view"/>
<access op="write" privilege="manage"/>
</attribute>

<command source="client" code="0x00" name="RegisterLoadControlProgramRequest" optional="false">
<description>
Upon receipt, this SHALL insert a new LoadControlProgramStruct into LoadControlPrograms, or if the ProgramID matches an existing LoadControlProgramStruct, then the provider SHALL be updated with the provided values.
</description>
<arg name="LoadControlProgram" type="LoadControlProgramStruct"/>
</command>
<command source="client" code="0x01" name="UnregisterLoadControlProgramRequest" optional="false">
<description>
Upon receipt, this SHALL remove a the LoadControlProgramStruct from LoadControlPrograms with the matching ProgramID.
</description>
<arg name="LoadControlProgramID" type="octet_string" length="16"/>
</command>
<command source="client" code="0x02" name="AddLoadControlEventRequest" optional="false">
<description>
On receipt of the AddLoadControlEventsRequest command, the server SHALL add a load control event.
</description>
<arg name="Event" type="LoadControlEventStruct"/>
</command>
<command source="client" code="0x03" name="RemoveLoadControlEventRequest" optional="false">
<description>
Upon receipt, this SHALL remove the LoadControlEventStruct with the matching EventID from LoadEventPrograms.
</description>
<arg name="EventID" type="octet_string" length="16"/>
<arg name="CancelControl" type="CancelControlBitmap"/>
</command>
<command source="client" code="0x04" name="ClearLoadControlEventsRequest" optional="true">
<!-- Note: Maybe this command needs to have fields? Who knows!
Spec does not define anything about it other than its existence.
See https://github.com/CHIP-Specifications/connectedhomeip-spec/issues/8514 -->
<description>
Upon receipt, this SHALL clear all the load control events.
</description>
</command>

<event side="server" code="0x00" name="LoadControlEventStatusChange" priority="info" optional="false">
<description>This event SHALL be generated when the status of a LoadControlEventStruct changes.</description>
<field id="0" name="EventID" type="octet_string" length="16"/>
<field id="1" name="TransitionIndex" type="int8u" isNullable="true"/>
<field id="2" name="Status" type="LoadControlEventStatusEnum"/>
<field id="3" name="Criticality" type="CriticalityLevelEnum"/>
<field id="4" name="Control" type="EventControlBitmap"/>
<field id="5" name="TemperatureControl" type="TemperatureControlStruct" isNullable="true" optional="true" />
<field id="6" name="AverageLoadControl" type="AverageLoadControlStruct" isNullable="true" optional="true" />
<field id="7" name="DutyCycleControl" type="DutyCycleControlStruct" isNullable="true" optional="true" />
<field id="8" name="PowerSavingsControl" type="PowerSavingsControlStruct" isNullable="true" optional="true" />
<field id="9" name="HeatingSourceControl" type="HeatingSourceControlStruct" isNullable="true" optional="true" />
<!-- Spec has an invalid field ID that cannot be used, so not enabling the Signature field for now. See
https://github.com/CHIP-Specifications/connectedhomeip-spec/issues/8515 -->
<!-- <field id="0xFF" name="Signature" type="octet_string" length="48" isNullable="true"/> -->
</event>
</cluster>
</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 @@ -37,6 +37,7 @@
"diagnostic-logs-cluster.xml",
"dishwasher-alarm-cluster.xml",
"dishwasher-mode-cluster.xml",
"drlc-cluster.xml",
"microwave-oven-mode-cluster.xml",
"microwave-oven-control-cluster.xml",
"door-lock-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 @@ -38,6 +38,7 @@
"dishwasher-mode-cluster.xml",
"microwave-oven-mode-cluster.xml",
"door-lock-cluster.xml",
"drlc-cluster.xml",
"electrical-measurement-cluster.xml",
"ethernet-network-diagnostics-cluster.xml",
"fan-control-cluster.xml",
Expand Down
Loading

0 comments on commit 75cf38c

Please sign in to comment.