Skip to content

Commit

Permalink
Add water heater mode cluster xml (project-chip#34333)
Browse files Browse the repository at this point in the history
* Add water-heater-mode-cluster.xml

* Add water-heater-mode-cluster support into control files and regenerate files

* Fix zap template generation issues

* Remove Water Heater Management entries

* Regenerate files

* Comment Water Heater Mode with right name

---------

Co-authored-by: jamesharrow <93921463+jamesharrow@users.noreply.github.com>
  • Loading branch information
2 people authored and j-ororke committed Jul 31, 2024
1 parent 79e87d1 commit 633cd53
Show file tree
Hide file tree
Showing 55 changed files with 6,582 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/zap_clusters.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ Generally regenerate using one of:
| 155 | 0x9B | EnergyPreference |
| 156 | 0x9C | PowerTopology |
| 157 | 0x9D | EnergyEvseMode |
| 158 | 0x9E | WaterHeaterMode |
| 159 | 0x9F | DeviceEnergyManagementMode |
| 257 | 0x101 | DoorLock |
| 258 | 0x102 | WindowCovering |
Expand Down
1 change: 1 addition & 0 deletions scripts/rules.matterlint
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ load "../src/app/zap-templates/zcl/data-model/chip/user-label-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/wake-on-lan-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/washer-controls-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/water-heater-management-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/water-heater-mode-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/wifi-network-diagnostics-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/wifi-network-management-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/window-covering.xml";
Expand Down
3 changes: 2 additions & 1 deletion src/app/zap-templates/zcl/data-model/all.xml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@
<xi:include href="chip/valve-configuration-and-control-cluster.xml" />
<xi:include href="chip/wake-on-lan-cluster.xml" />
<xi:include href="chip/washer-controls-cluster.xml" />
<xi:include href="chip/water-heater-management-cluster.xml" />
<xi:include href="chip/water-heater-management-cluster.xml" />
<xi:include href="chip/water-heater-mode-cluster.xml" />
<xi:include href="chip/wifi-network-diagnostics-cluster.xml" />
<xi:include href="chip/wifi-network-management-cluster.xml" />
<xi:include href="chip/window-covering.xml" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ This is because zap does not currently support generating code for clusters that
<cluster code="0x005E"/> <!-- Microwave Oven Mode -->
<cluster code="0x0049"/> <!-- Oven Mode -->
<cluster code="0x009D"/> <!-- Energy EVSE Mode -->
<cluster code="0x009E"/> <!-- Water Heater Mode -->
<cluster code="0x009F"/> <!-- Device Energy Management Mode -->
<!-- MfgCode has been deprecated -->
<item name="MfgCode" type="vendor_id" optional="true"/>
Expand All @@ -47,6 +48,7 @@ This is because zap does not currently support generating code for clusters that
<cluster code="0x005E"/> <!-- Microwave Oven Mode -->
<cluster code="0x0049"/> <!-- Oven Mode -->
<cluster code="0x009D"/> <!-- Energy EVSE Mode -->
<cluster code="0x009E"/> <!-- Water Heater Mode -->
<cluster code="0x009F"/> <!-- Device Energy Management Mode -->
<item name="Label" type="char_string" length="64" optional="false"/>
<item name="Mode" type="int8u" optional="false"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?xml version="1.0"?>
<!--
Copyright (c) 2024 Project CHIP Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<configurator>
<domain name="CHIP"/>

<enum name="ModeTag" type="enum16">
<cluster code="0x009E"/>
<item value="0x4000" name="Off"/>
<item value="0x4001" name="Manual"/>
<item value="0x4002" name="Timed"/>
</enum>

<cluster>
<domain>General</domain>
<name>Water Heater Mode</name>
<code>0x009E</code>
<define>WATER_HEATER_MODE_CLUSTER</define>
<client init="false" tick="false">true</client>
<server init="false" tick="false">true</server>
<description>Attributes and commands for selecting a mode from a list of supported options.</description>
<globalAttribute side="either" code="0xFFFD" value="1"/>

<features>
<feature bit="0" code="DEPONOFF" name="OnOff" summary="Dependency with the OnOff cluster">
<optionalConform/>
</feature>
</features>

<!-- Base data types -->
<attribute side="server" code="0x0000" define="SUPPORTED_MODES" type="array" entryType="ModeOptionStruct" writable="false" optional="false" isNullable="false" length="255">SupportedModes</attribute>
<attribute side="server" code="0x0001" define="CURRENT_MODE" type="int8u" writable="false" optional="false" isNullable="false" reportable="true">CurrentMode</attribute>
<attribute side="server" code="0x0002" define="START_UP_MODE" type="int8u" writable="true" optional="true" isNullable="true">StartUpMode</attribute>
<attribute side="server" code="0x0003" define="ON_MODE" type="int8u" writable="true" optional="true" isNullable="true">OnMode</attribute>

<!-- Commands -->
<command source="client" code="0x00" name="ChangeToMode" response="ChangeToModeResponse" optional="false">
<description>
This command is used to change device modes.
On receipt of this command the device SHALL respond with a ChangeToModeResponse command.
</description>
<arg name="NewMode" type="int8u" optional="false"/>
</command>

<command source="server" code="0x01" name="ChangeToModeResponse" disableDefaultResponse="true" optional="false">
<description>
This command is sent by the device on receipt of the ChangeToModeWithStatus command.
</description>
<arg name="Status" type="enum8" optional="false"/>
<arg name="StatusText" type="char_string" lenght="64" optional="true"/>
</command>
</cluster>
</configurator>
2 changes: 2 additions & 0 deletions src/app/zap-templates/zcl/zcl-with-test-extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@
"wake-on-lan-cluster.xml",
"washer-controls-cluster.xml",
"water-heater-management-cluster.xml",
"water-heater-mode-cluster.xml",
"wifi-network-diagnostics-cluster.xml",
"wifi-network-management-cluster.xml",
"window-covering.xml",
Expand Down Expand Up @@ -643,6 +644,7 @@
"Power Topology": ["FeatureMap"],
"Valve Configuration and Control": ["RemainingDuration"],
"Boolean State Configuration": ["CurrentSensitivityLevel"],
"Water Heater Mode": ["SupportedModes", "CurrentMode", "FeatureMap"],
"Wi-Fi Network Management": ["SSID"]
},
"defaultReportingPolicy": "mandatory",
Expand Down
2 changes: 2 additions & 0 deletions src/app/zap-templates/zcl/zcl.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
"wake-on-lan-cluster.xml",
"washer-controls-cluster.xml",
"water-heater-management-cluster.xml",
"water-heater-mode-cluster.xml",
"wifi-network-diagnostics-cluster.xml",
"wifi-network-management-cluster.xml",
"window-covering.xml",
Expand Down Expand Up @@ -641,6 +642,7 @@
"Power Topology": ["FeatureMap"],
"Valve Configuration and Control": ["RemainingDuration"],
"Boolean State Configuration": ["CurrentSensitivityLevel"],
"Water Heater Mode": ["SupportedModes", "CurrentMode", "FeatureMap"],
"Wi-Fi Network Management": ["SSID"]
},
"defaultReportingPolicy": "mandatory",
Expand Down
50 changes: 50 additions & 0 deletions src/controller/data_model/controller-clusters.matter
Original file line number Diff line number Diff line change
Expand Up @@ -5172,6 +5172,56 @@ cluster EnergyEvseMode = 157 {
command ChangeToMode(ChangeToModeRequest): ChangeToModeResponse = 0;
}

/** Attributes and commands for selecting a mode from a list of supported options. */
cluster WaterHeaterMode = 158 {
revision 1;

enum ModeTag : enum16 {
kOff = 16384;
kManual = 16385;
kTimed = 16386;
}

bitmap Feature : bitmap32 {
kOnOff = 0x1;
}

struct ModeTagStruct {
optional vendor_id mfgCode = 0;
enum16 value = 1;
}

struct ModeOptionStruct {
char_string<64> label = 0;
int8u mode = 1;
ModeTagStruct modeTags[] = 2;
}

readonly attribute ModeOptionStruct supportedModes[] = 0;
readonly attribute int8u currentMode = 1;
attribute optional nullable int8u startUpMode = 2;
attribute optional nullable int8u onMode = 3;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute event_id eventList[] = 65530;
readonly attribute attrib_id attributeList[] = 65531;
readonly attribute bitmap32 featureMap = 65532;
readonly attribute int16u clusterRevision = 65533;

request struct ChangeToModeRequest {
int8u newMode = 0;
}

response struct ChangeToModeResponse = 1 {
enum8 status = 0;
optional char_string statusText = 1;
}

/** This command is used to change device modes.
On receipt of this command the device SHALL respond with a ChangeToModeResponse command. */
command ChangeToMode(ChangeToModeRequest): ChangeToModeResponse = 0;
}

/** Attributes and commands for selecting a mode from a list of supported options. */
provisional cluster DeviceEnergyManagementMode = 159 {
revision 1;
Expand Down
Loading

0 comments on commit 633cd53

Please sign in to comment.