Skip to content

Commit f8cfb75

Browse files
committed
Add support for the WaterHeaterMode cluster
1 parent 97f2dbe commit f8cfb75

File tree

57 files changed

+6578
-4
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+6578
-4
lines changed

examples/water-heater-management-app/water-heater-management-common/src/WhmManufacturer.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,13 @@ void SetTestEventTrigger_WaterTemperature66CTestEvent()
104104

105105
void SetTestEventTrigger_ManualModeTestEvent()
106106
{
107+
#if 0
107108
WaterHeaterManagementDelegate * dg = GetWhmDelegate();
108109

109110
dg->
110111
ChipLogProgress(Support, "[Whm::kManualModeTestEvent] => Simulate the Water Heater Mode being set to MANUAL");
111112
SetTestEventTrigger_ManualModeTestEvent();
113+
#endif
112114
}
113115

114116
void SetTestEventTrigger_OffModeTestEvent()

examples/water-heater-management-app/water-heater-management-common/water-heater-management-app.matter

+76
Original file line numberDiff line numberDiff line change
@@ -1428,6 +1428,64 @@ cluster ElectricalEnergyMeasurement = 145 {
14281428
readonly attribute int16u clusterRevision = 65533;
14291429
}
14301430

1431+
/** This cluster is used to allow clients to control the operation of a hot water heating appliance so that it can be used with energy management. */
1432+
provisional cluster WaterHeaterManagement = 148 {
1433+
revision 1;
1434+
1435+
enum BoostStateEnum : enum8 {
1436+
kInactive = 0;
1437+
kActive = 1;
1438+
}
1439+
1440+
bitmap Feature : bitmap32 {
1441+
kEnergyManagement = 0x1;
1442+
kTankPercent = 0x2;
1443+
}
1444+
1445+
bitmap WaterHeaterDemandBitmap : bitmap8 {
1446+
kImmersionElement1 = 0x1;
1447+
kImmersionElement2 = 0x2;
1448+
kHeatPump = 0x4;
1449+
kBoiler = 0x8;
1450+
kOther = 0x10;
1451+
}
1452+
1453+
bitmap WaterHeaterTypeBitmap : bitmap8 {
1454+
kImmersionElement1 = 0x1;
1455+
kImmersionElement2 = 0x2;
1456+
kHeatPump = 0x4;
1457+
kBoiler = 0x8;
1458+
kOther = 0x10;
1459+
}
1460+
1461+
readonly attribute WaterHeaterTypeBitmap heaterTypes = 0;
1462+
readonly attribute WaterHeaterDemandBitmap heatDemand = 1;
1463+
readonly attribute optional int16u tankVolume = 2;
1464+
readonly attribute optional energy_mwh estimatedHeatRequired = 3;
1465+
readonly attribute optional percent tankPercentage = 4;
1466+
readonly attribute BoostStateEnum boostState = 5;
1467+
readonly attribute command_id generatedCommandList[] = 65528;
1468+
readonly attribute command_id acceptedCommandList[] = 65529;
1469+
readonly attribute event_id eventList[] = 65530;
1470+
readonly attribute attrib_id attributeList[] = 65531;
1471+
readonly attribute bitmap32 featureMap = 65532;
1472+
readonly attribute int16u clusterRevision = 65533;
1473+
1474+
request struct BoostRequest {
1475+
elapsed_s duration = 0;
1476+
optional boolean oneShot = 1;
1477+
optional boolean emergencyBoost = 2;
1478+
optional temperature temporarySetpoint = 3;
1479+
optional percent targetPercentage = 4;
1480+
optional percent targetReheat = 5;
1481+
}
1482+
1483+
/** Allows a client to request that the water heater is put into a Boost state. */
1484+
command access(invoke: manage) Boost(BoostRequest): DefaultSuccess = 0;
1485+
/** Allows a client to cancel an ongoing Boost operation. */
1486+
command access(invoke: manage) CancelBoost(): DefaultSuccess = 1;
1487+
}
1488+
14311489
/** This cluster allows a client to manage the power draw of a device. An example of such a client could be an Energy Management System (EMS) which controls an Energy Smart Appliance (ESA). */
14321490
provisional cluster DeviceEnergyManagement = 152 {
14331491
revision 4;
@@ -2247,6 +2305,24 @@ endpoint 1 {
22472305
ram attribute clusterRevision default = 1;
22482306
}
22492307

2308+
server cluster WaterHeaterManagement {
2309+
callback attribute heaterTypes;
2310+
callback attribute heatDemand;
2311+
callback attribute tankVolume;
2312+
callback attribute estimatedHeatRequired;
2313+
callback attribute tankPercentage;
2314+
callback attribute boostState;
2315+
callback attribute generatedCommandList;
2316+
callback attribute acceptedCommandList;
2317+
callback attribute eventList;
2318+
callback attribute attributeList;
2319+
callback attribute featureMap;
2320+
ram attribute clusterRevision default = 1;
2321+
2322+
handle command Boost;
2323+
handle command CancelBoost;
2324+
}
2325+
22502326
server cluster DeviceEnergyManagement {
22512327
emits event PowerAdjustStart;
22522328
emits event PowerAdjustEnd;

src/app/common/templates/config-data.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ EnumsNotUsedAsTypeInXML:
1313
- "RvcOperationalState::OperationalStateEnum"
1414
- "RvcOperationalState::ErrorStateEnum"
1515
- "EnergyEvseMode::ModeTag"
16+
- "WaterHeaterMode::ModeTag"
1617
- "DeviceEnergyManagementMode::ModeTag"
1718

1819
CommandHandlerInterfaceOnlyClusters:
@@ -42,6 +43,7 @@ CommandHandlerInterfaceOnlyClusters:
4243
- Electrical Energy Measurement
4344
- Wi-Fi Network Management
4445
- Water Heater Management
46+
- Water Heater Mode
4547

4648
# We need a more configurable way of deciding which clusters have which init functions....
4749
# See https://github.com/project-chip/connectedhomeip/issues/4369

src/app/util/util.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ void MatterEnergyEvseModePluginServerInitCallback() {}
139139
void MatterPowerTopologyPluginServerInitCallback() {}
140140
void MatterElectricalEnergyMeasurementPluginServerInitCallback() {}
141141
void MatterElectricalPowerMeasurementPluginServerInitCallback() {}
142+
void MatterWaterHeaterModePluginServerInitCallback() {}
142143

143144
bool emberAfContainsAttribute(chip::EndpointId endpoint, chip::ClusterId clusterId, chip::AttributeId attributeId)
144145
{

src/app/zap-templates/zcl/data-model/all.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@
105105
<xi:include href="chip/valve-configuration-and-control-cluster.xml" />
106106
<xi:include href="chip/wake-on-lan-cluster.xml" />
107107
<xi:include href="chip/washer-controls-cluster.xml" />
108-
<xi:include href="chip/water-heater-management-cluster.xml" />
108+
<xi:include href="chip/water-heater-management-cluster.xml" />
109+
<xi:include href="chip/water-heater-mode-cluster.xml" />
109110
<xi:include href="chip/wifi-network-diagnostics-cluster.xml" />
110111
<xi:include href="chip/wifi-network-management-cluster.xml" />
111112
<xi:include href="chip/window-covering.xml" />

src/app/zap-templates/zcl/data-model/chip/mode-base-cluster.xml

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ This is because zap does not currently support generating code for clusters that
3232
<cluster code="0x005E"/> <!-- Microwave Oven Mode -->
3333
<cluster code="0x0049"/> <!-- Oven Mode -->
3434
<cluster code="0x009D"/> <!-- Energy EVSE Mode -->
35+
<cluster code="0x009E"/> <!-- Water Heater Mode -->
3536
<cluster code="0x009F"/> <!-- Device Energy Management Mode -->
3637
<!-- MfgCode has been deprecated -->
3738
<item name="MfgCode" type="vendor_id" optional="true"/>
@@ -47,6 +48,7 @@ This is because zap does not currently support generating code for clusters that
4748
<cluster code="0x005E"/> <!-- Microwave Oven Mode -->
4849
<cluster code="0x0049"/> <!-- Oven Mode -->
4950
<cluster code="0x009D"/> <!-- Energy EVSE Mode -->
51+
<cluster code="0x009E"/> <!-- Water Heater Mode -->
5052
<cluster code="0x009F"/> <!-- Device Energy Management Mode -->
5153
<item name="Label" type="char_string" length="64" optional="false"/>
5254
<item name="Mode" type="int8u" optional="false"/>

src/app/zap-templates/zcl/zcl-with-test-extensions.json

+2
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@
127127
"wake-on-lan-cluster.xml",
128128
"washer-controls-cluster.xml",
129129
"water-heater-management-cluster.xml",
130+
"water-heater-mode-cluster.xml",
130131
"wifi-network-diagnostics-cluster.xml",
131132
"wifi-network-management-cluster.xml",
132133
"window-covering.xml",
@@ -639,6 +640,7 @@
639640
"Valve Configuration and Control": ["RemainingDuration"],
640641
"Boolean State Configuration": ["CurrentSensitivityLevel"],
641642
"Water Heater Management": ["FeatureMap"],
643+
"Water Heater Mode": ["SupportedModes", "CurrentMode", "FeatureMap"],
642644
"Wi-Fi Network Management": ["SSID"]
643645
},
644646
"defaultReportingPolicy": "mandatory",

src/app/zap-templates/zcl/zcl.json

+2
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@
125125
"wake-on-lan-cluster.xml",
126126
"washer-controls-cluster.xml",
127127
"water-heater-management-cluster.xml",
128+
"water-heater-mode-cluster.xml",
128129
"wifi-network-diagnostics-cluster.xml",
129130
"wifi-network-management-cluster.xml",
130131
"window-covering.xml",
@@ -645,6 +646,7 @@
645646
"TankPercentage",
646647
"BoostState"
647648
],
649+
"Water Heater Mode": ["SupportedModes", "CurrentMode", "FeatureMap"],
648650
"Wi-Fi Network Management": ["SSID"]
649651
},
650652
"defaultReportingPolicy": "mandatory",

src/app/zap_cluster_list.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@
130130
"LAUNDRY_WASHER_CONTROLS_CLUSTER": [],
131131
"LAUNDRY_DRYER_CONTROLS_CLUSTER": [],
132132
"WATER_HEATER_MANAGEMENT_CLUSTER": [],
133+
"WATER_HEATER_MODE_CLUSTER": [],
133134
"WIFI_NETWORK_DIAGNOSTICS_CLUSTER": [],
134135
"WINDOW_COVERING_CLUSTER": [],
135136
"ZLL_COMMISSIONING_CLUSTER": []
@@ -312,8 +313,8 @@
312313
"WIFI_NETWORK_DIAGNOSTICS_CLUSTER": ["wifi-network-diagnostics-server"],
313314
"WIFI_NETWORK_MANAGEMENT_CLUSTER": ["wifi-network-management-server"],
314315
"WINDOW_COVERING_CLUSTER": ["window-covering-server"],
315-
"WATER_HEATER_MANAGEMENT_CLUSTER": [],
316316
"WATER_HEATER_MANAGEMENT_CLUSTER": ["water-heater-management-server"],
317+
"WATER_HEATER_MODE_CLUSTER": ["mode-base-server"],
317318
"ZLL_COMMISSIONING_CLUSTER": []
318319
}
319320
}

src/controller/data_model/controller-clusters.matter

+50
Original file line numberDiff line numberDiff line change
@@ -5158,6 +5158,56 @@ cluster EnergyEvseMode = 157 {
51585158
command ChangeToMode(ChangeToModeRequest): ChangeToModeResponse = 0;
51595159
}
51605160

5161+
/** Attributes and commands for selecting a mode from a list of supported options. */
5162+
cluster WaterHeaterMode = 158 {
5163+
revision 1;
5164+
5165+
enum ModeTag : enum16 {
5166+
kOff = 16384;
5167+
kManual = 16385;
5168+
kTimed = 16386;
5169+
}
5170+
5171+
bitmap Feature : bitmap32 {
5172+
kOnOff = 0x1;
5173+
}
5174+
5175+
struct ModeTagStruct {
5176+
optional vendor_id mfgCode = 0;
5177+
enum16 value = 1;
5178+
}
5179+
5180+
struct ModeOptionStruct {
5181+
char_string<64> label = 0;
5182+
int8u mode = 1;
5183+
ModeTagStruct modeTags[] = 2;
5184+
}
5185+
5186+
readonly attribute ModeOptionStruct supportedModes[] = 0;
5187+
readonly attribute int8u currentMode = 1;
5188+
attribute optional nullable int8u startUpMode = 2;
5189+
attribute optional nullable int8u onMode = 3;
5190+
readonly attribute command_id generatedCommandList[] = 65528;
5191+
readonly attribute command_id acceptedCommandList[] = 65529;
5192+
readonly attribute event_id eventList[] = 65530;
5193+
readonly attribute attrib_id attributeList[] = 65531;
5194+
readonly attribute bitmap32 featureMap = 65532;
5195+
readonly attribute int16u clusterRevision = 65533;
5196+
5197+
request struct ChangeToModeRequest {
5198+
int8u newMode = 0;
5199+
}
5200+
5201+
response struct ChangeToModeResponse = 1 {
5202+
enum8 status = 0;
5203+
optional char_string statusText = 1;
5204+
}
5205+
5206+
/** This command is used to change device modes.
5207+
On receipt of this command the device SHALL respond with a ChangeToModeResponse command. */
5208+
command ChangeToMode(ChangeToModeRequest): ChangeToModeResponse = 0;
5209+
}
5210+
51615211
/** Attributes and commands for selecting a mode from a list of supported options. */
51625212
provisional cluster DeviceEnergyManagementMode = 159 {
51635213
revision 1;

0 commit comments

Comments
 (0)