forked from project-chip/connectedhomeip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTC_EWATERHTR_2_2.py
469 lines (376 loc) · 27.4 KB
/
TC_EWATERHTR_2_2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
#
# Copyright (c) 2024 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.
# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments
# for details about the block below.
#
# === BEGIN CI TEST ARGUMENTS ===
# test-runner-runs: run1
# test-runner-run/run1/app: ${ALL_CLUSTERS_APP}
# test-runner-run/run1/factoryreset: True
# test-runner-run/run1/quiet: True
# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json --enable-key 000102030405060708090a0b0c0d0e0f
# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto
# === END CI TEST ARGUMENTS ===
import logging
import time
import chip.clusters as Clusters
from matter_testing_support import EventChangeCallback, MatterBaseTest, TestStep, async_test_body, default_matter_test_main
from mobly import asserts
from TC_EWATERHTRBase import EWATERHTRBase
logger = logging.getLogger(__name__)
class TC_EWATERHTR_2_2(MatterBaseTest, EWATERHTRBase):
def desc_TC_EWATERHTR_2_2(self) -> str:
"""Returns a description of this test"""
return "[TC-EWATERHTR-2.2] Basic functionality with attributes with DUT as Server." \
"This test case verifies the primary functionality of the Water Heater Management cluster server."
def pics_TC_EWATERHTR_2_2(self):
""" This function returns a list of PICS for this test case that must be True for the test to be run"""
return ["EWATERHTR.S"]
def steps_TC_EWATERHTR_2_2(self) -> list[TestStep]:
steps = [
TestStep("1", "Commission DUT to TH (can be skipped if done in a preceding test)"),
TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster",
"Value has to be 1 (True)"),
TestStep("3", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TESTEVENT_TRIGGERKEY and EventTrigger field set to PIXIT.EWATERHTR.TESTEVENTTRIGGER for Basic installation Test Event",
"Verify DUT responds w/ status SUCCESS(0x00)"),
TestStep("3a", "TH reads from the DUT the HeatDemand",
"Value has to be 0x00 (no demand on any source)"),
TestStep("3b", "TH reads from the DUT the BoostState",
"Value has to be 0 (Inactive)"),
TestStep("3c", "TH reads from the DUT the HeaterTypes",
"Value has to be greater than 0x00 (at least one type supported) and Store the value as HeaterTypes"),
TestStep("4", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TESTEVENT_TRIGGERKEY and EventTrigger field set to PIXIT.EWATERHTR.TESTEVENTTRIGGER for Manual mode Test Event",
"Verify DUT responds w/ status SUCCESS(0x00)"),
TestStep("4a", "TH reads from the DUT the HeatDemand",
"Value has to be greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"),
TestStep("5", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TESTEVENT_TRIGGERKEY and EventTrigger field set to PIXIT.EWATERHTR.TESTEVENTTRIGGER for Water Temperature 61C Test Event",
"Verify DUT responds w/ status SUCCESS(0x00)"),
TestStep("5a", "TH reads from the DUT the HeatDemand",
"Value has to be 0x00 (no demand on any source)"),
TestStep("6", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TESTEVENT_TRIGGERKEY and EventTrigger field set to PIXIT.EWATERHTR.TESTEVENTTRIGGER for Water Temperature 20C Test Event",
"Verify DUT responds w/ status SUCCESS(0x00)"),
TestStep("6a", "TH reads from the DUT the HeatDemand",
"Value has to be greater than 0x00 (demand on at least one source)"),
TestStep("7", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TESTEVENT_TRIGGERKEY and EventTrigger field set to PIXIT.EWATERHTR.TESTEVENTTRIGGER for Off mode Test Event",
"Verify DUT responds w/ status SUCCESS(0x00)"),
TestStep("7a", "TH reads from the DUT the HeatDemand",
"Value has to be 0x00 (no demand on any source)"),
TestStep("8", "TH sends command Boost with Duration=5s,OneShot=True",
"Verify DUT responds w/ status SUCCESS(0x00) and Event EWATERHTR.S.E00(BoostStarted) sent with Duration=6 and OneShot=True"),
TestStep("8a", "TH reads from the DUT the HeatDemand",
"Value has to be greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"),
TestStep("8b", "TH reads from the DUT the BoostState",
"Value has to be 1 (Active)"),
TestStep("9", "Wait 6 seconds",
"Event EWATERHTR.S.E00(BoostEnded) sent"),
TestStep("9a", "TH reads from the DUT the HeatDemand",
"Value has to be 0x00 (no demand on any source)"),
TestStep("9b", "TH reads from the DUT the HeatDemand",
"Value has to be 0x00 (no demand on any source)"),
TestStep("9c", "TH reads from the DUT the BoostState",
"Value has to be 0 (Inactive)"),
TestStep("10", "TH sends command Boost with Duration=600s,OneShot=True",
"Verify DUT responds w/ status SUCCESS(0x00) and Event EWATERHTR.S.E00(BoostStarted) sent with Duration=600 and OneShot=True"),
TestStep("10a", "TH reads from the DUT the HeatDemand",
"Value has to be greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"),
TestStep("10b", "TH reads from the DUT the BoostState",
"Value has to be 1 (Active)"),
TestStep("11", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TESTEVENT_TRIGGERKEY and EventTrigger field set to PIXIT.EWATERHTR.TESTEVENTTRIGGER for Water Temperature 61C Test Event",
"Verify DUT responds w/ status SUCCESS(0x00) and Event EWATERHTR.S.E00(BoostEnded) sent"),
TestStep("11a", "TH reads from the DUT the HeatDemand",
"Value has to be 0x00 (no demand on any source)"),
TestStep("11b", "TH reads from the DUT the BoostState",
"Value has to be 0 (Inactive)"),
TestStep("12", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TESTEVENT_TRIGGERKEY and EventTrigger field set to PIXIT.EWATERHTR.TESTEVENTTRIGGER for Water Temperature 20C Test Event",
"Verify DUT responds w/ status SUCCESS(0x00)"),
TestStep("12a", "TH reads from the DUT the HeatDemand",
"Value has to be 0x00 (no demand on any source)"),
TestStep("13", "TH sends command Boost with Duration=600s",
"Verify DUT responds w/ status SUCCESS(0x00) and Event EWATERHTR.S.E00(BoostStarted) sent with Duration=600 and OneShot=None"),
TestStep("13a", "TH reads from the DUT the HeatDemand",
"Value has to be greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"),
TestStep("13b", "TH reads from the DUT the BoostState",
"Value has to be 1 (Active)"),
TestStep("14", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TESTEVENT_TRIGGERKEY and EventTrigger field set to PIXIT.EWATERHTR.TESTEVENTTRIGGER for Water Temperature 61C Test Event",
"Verify DUT responds w/ status SUCCESS(0x00)"),
TestStep("14a", "TH reads from the DUT the HeatDemand",
"Value has to be 0x00 (no demand on any source)"),
TestStep("14b", "TH reads from the DUT the BoostState",
"Value has to be 1 (Active)"),
TestStep("15", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TESTEVENT_TRIGGERKEY and EventTrigger field set to PIXIT.EWATERHTR.TESTEVENTTRIGGER for Water Temperature 20C Test Event",
"Verify DUT responds w/ status SUCCESS(0x00)"),
TestStep("15a", "TH reads from the DUT the HeatDemand",
"Value has to be greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"),
TestStep("15b", "TH reads from the DUT the BoostState",
"Value has to be 1 (Active)"),
TestStep("16", "TH sends command CancelBoost",
"Verify DUT responds w/ status SUCCESS(0x00) and Event EWATERHTR.S.E00(BoostEnded) sent"),
TestStep("16a", "TH reads from the DUT the HeatDemand",
"Value has to be 0x00 (no demand on any source)"),
TestStep("16b", "TH reads from the DUT the BoostState",
"Value has to be 0 (Inactive)"),
TestStep("17", "TH sends command Boost with Duration=500s,TemporarySetpoint=65C",
"Verify DUT responds w/ status SUCCESS(0x00) and Event EWATERHTR.S.E00(BoostStarted) sent with Duration=500 and TemporarySetpoint=6500"),
TestStep("17a", "TH reads from the DUT the HeatDemand",
"Value has to be greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"),
TestStep("17b", "TH reads from the DUT the BoostState",
"Value has to be 1 (Active)"),
TestStep("18", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TESTEVENT_TRIGGERKEY and EventTrigger field set to PIXIT.EWATERHTR.TESTEVENTTRIGGER for Water Temperature 61C Test Event",
"Verify DUT responds w/ status SUCCESS(0x00)"),
TestStep("18a", "TH reads from the DUT the HeatDemand",
"Value has to be greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"),
TestStep("18b", "TH reads from the DUT the BoostState",
"Value has to be 1 (Active)"),
TestStep("19", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TESTEVENT_TRIGGERKEY and EventTrigger field set to PIXIT.EWATERHTR.TESTEVENTTRIGGER for Water Temperature 66C Test Event",
"Verify DUT responds w/ status SUCCESS(0x00)"),
TestStep("19a", "TH reads from the DUT the HeatDemand",
"Value has to be 0x00 (no demand on any source)"),
TestStep("19b", "TH reads from the DUT the BoostState",
"Value has to be 1 (Active)"),
TestStep("20", "TH sends command Boost with Duration=600s,TemporarySetpoint=70C",
"Verify DUT responds w/ status SUCCESS(0x00) and Event EWATERHTR.S.E00(BoostStarted) sent with Duration=600 and TemporarySetpoint=7000"),
TestStep("20a", "TH reads from the DUT the HeatDemand",
"Value has to be greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"),
TestStep("20b", "TH reads from the DUT the BoostState",
"Value has to be 1 (Active)"),
TestStep("21", "TH sends command CancelBoost",
"Verify DUT responds w/ status SUCCESS(0x00) and Event EWATERHTR.S.E00(BoostEnded) sent"),
TestStep("21a", "TH reads from the DUT the HeatDemand",
"Value has to be 0x00 (no demand on any source)"),
TestStep("21b", "TH reads from the DUT the BoostState",
"Value has to be 0 (Inactive)"),
TestStep("22", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TESTEVENT_TRIGGERKEY and EventTrigger field set to PIXIT.EWATERHTR.TESTEVENTTRIGGER for Water Temperature 20C Test Event",
"Verify DUT responds w/ status SUCCESS(0x00)"),
TestStep("22a", "TH reads from the DUT the HeatDemand",
"Value has to be 0x00 (no demand on any source)"),
TestStep("23", "TH sends command Boost with Duration=200s,EmergencyBoost=True",
"Verify DUT responds w/ status SUCCESS(0x00) and Event EWATERHTR.S.E00(BoostStarted) sent with Duration=200, EmergencyBoost=True and TemporarySetpoint=None"),
TestStep("23a", "TH reads from the DUT the HeatDemand",
"Value has to be 0x00 (no demand on any source)"),
TestStep("23b", "TH reads from the DUT the BoostState",
"Value has to be 0 (Inactive)"),
TestStep("24", "TH sends command CancelBoost",
"Verify DUT responds w/ status SUCCESS(0x00) and Event EWATERHTR.S.E00(BoostEnded) sent"),
TestStep("24a", "TH reads from the DUT the HeatDemand",
"Value has to be 0x00 (no demand on any source)"),
TestStep("24b", "TH reads from the DUT the BoostState",
"Value has to be 0 (Inactive)"),
TestStep("25", "TH sends command CancelBoost",
"Verify DUT responds w/ status SUCCESS(0x00) and no event sent"),
TestStep("26", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TESTEVENT_TRIGGERKEY and EventTrigger field set to PIXIT.EWATERHTR.TESTEVENTTRIGGER for Basic installation Test Event Clear",
"Verify DUT responds w/ status SUCCESS(0x00)"),
]
return steps
@async_test_body
async def test_TC_EWATERHTR_2_2(self):
self.step("1")
# Commission DUT - already done
# Subscribe to Events and when they are sent push them to a queue for checking later
events_callback = EventChangeCallback(Clusters.WaterHeaterManagement)
await events_callback.start(self.default_controller,
self.dut_node_id,
self.matter_test_config.endpoint)
self.step("2")
await self.check_test_event_triggers_enabled()
self.step("3")
await self.send_test_event_trigger_basic_installation_test_event()
self.step("3a")
await self.check_whm_attribute("HeatDemand", 0)
self.step("3b")
await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kInactive)
self.step("3c")
heaterTypes = await self.read_whm_attribute_expect_success(attribute="HeaterTypes")
asserts.assert_greater(heaterTypes, 0,
f"Unexpected HeaterTypes value - expected {heaterTypes} > 0")
asserts.assert_less_equal(heaterTypes, Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterHeatSourceBitmap.kOther,
f"Unexpected HeaterTypes value - expected {heaterTypes} <= WaterHeaterHeatSourceBitmap.kOther")
self.step("4")
await self.send_test_event_trigger_manual_mode_test_event()
self.step("4a")
heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand")
asserts.assert_greater(heatDemand, 0)
asserts.assert_equal(heatDemand & (~heaterTypes), 0, "heatDemand should only be from declared supported types"),
self.step("5")
await self.send_test_event_trigger_water_temperature61C_test_event()
self.step("5a")
heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand")
asserts.assert_equal(heatDemand, 0)
self.step("6")
await self.send_test_event_trigger_water_temperature20C_test_event()
self.step("6a")
heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand")
asserts.assert_greater(heatDemand, 0)
asserts.assert_equal(heatDemand & (~heaterTypes), 0, "heatDemand should only be from declared supported types"),
self.step("7")
await self.send_test_event_trigger_off_mode_test_event()
self.step("7a")
heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand")
asserts.assert_equal(heatDemand, 0)
self.step("8")
await self.send_boost_command(duration=5, one_shot=True)
event_data = events_callback.wait_for_event_report(Clusters.WaterHeaterManagement.Events.BoostStarted)
asserts.assert_equal(event_data.boostInfo.duration, 5)
asserts.assert_equal(event_data.boostInfo.oneShot, True)
self.step("8a")
heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand")
asserts.assert_greater(heatDemand, 0)
asserts.assert_equal(heatDemand & (~heaterTypes), 0, "heatDemand should only be from declared supported types"),
self.step("8b")
await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive)
self.step("9")
time.sleep(6)
self.step("9a")
event_data = events_callback.wait_for_event_report(Clusters.WaterHeaterManagement.Events.BoostEnded)
self.step("9b")
heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand")
asserts.assert_equal(heatDemand, 0)
self.step("9c")
await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kInactive)
self.step("10")
await self.send_boost_command(duration=600, one_shot=True)
event_data = events_callback.wait_for_event_report(Clusters.WaterHeaterManagement.Events.BoostStarted)
asserts.assert_equal(event_data.boostInfo.duration, 600)
asserts.assert_equal(event_data.boostInfo.oneShot, True)
self.step("10a")
heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand")
asserts.assert_greater(heatDemand, 0)
asserts.assert_equal(heatDemand & (~heaterTypes), 0, "heatDemand should only be from declared supported types"),
self.step("10b")
await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive)
self.step("11")
await self.send_test_event_trigger_water_temperature61C_test_event()
event_data = events_callback.wait_for_event_report(Clusters.WaterHeaterManagement.Events.BoostEnded)
self.step("11a")
heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand")
asserts.assert_equal(heatDemand, 0)
self.step("11b")
await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kInactive)
self.step("12")
await self.send_test_event_trigger_water_temperature20C_test_event()
self.step("12a")
heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand")
asserts.assert_equal(heatDemand, 0)
self.step("13")
await self.send_boost_command(duration=600)
event_data = events_callback.wait_for_event_report(Clusters.WaterHeaterManagement.Events.BoostStarted)
asserts.assert_equal(event_data.boostInfo.duration, 600)
asserts.assert_true(event_data.boostInfo.oneShot is None, "oneShot should be None")
self.step("13a")
heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand")
asserts.assert_greater(heatDemand, 0)
asserts.assert_equal(heatDemand & (~heaterTypes), 0, "heatDemand should only be from declared supported types"),
self.step("13b")
await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive)
self.step("14")
await self.send_test_event_trigger_water_temperature61C_test_event()
self.step("14a")
heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand")
asserts.assert_equal(heatDemand, 0)
self.step("14b")
await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive)
self.step("15")
await self.send_test_event_trigger_water_temperature20C_test_event()
self.step("15a")
heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand")
asserts.assert_greater(heatDemand, 0)
asserts.assert_equal(heatDemand & (~heaterTypes), 0, "heatDemand should only be from declared supported types"),
self.step("15b")
await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive)
self.step("16")
await self.send_cancel_boost_command()
event_data = events_callback.wait_for_event_report(Clusters.WaterHeaterManagement.Events.BoostEnded)
self.step("16a")
heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand")
asserts.assert_equal(heatDemand, 0)
self.step("16b")
await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kInactive)
self.step("17")
await self.send_boost_command(duration=500, temporary_setpoint=6500)
event_data = events_callback.wait_for_event_report(Clusters.WaterHeaterManagement.Events.BoostStarted)
asserts.assert_equal(event_data.boostInfo.duration, 500)
asserts.assert_equal(event_data.boostInfo.temporarySetpoint, 6500)
self.step("17a")
heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand")
asserts.assert_greater(heatDemand, 0)
asserts.assert_equal(heatDemand & (~heaterTypes), 0, "heatDemand should only be from declared supported types"),
self.step("17b")
await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive)
self.step("18")
await self.send_test_event_trigger_water_temperature61C_test_event()
self.step("18a")
heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand")
asserts.assert_greater(heatDemand, 0)
asserts.assert_equal(heatDemand & (~heaterTypes), 0, "heatDemand should only be from declared supported types"),
self.step("18b")
await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive)
self.step("19")
await self.send_test_event_trigger_water_temperature66C_test_event()
self.step("19a")
heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand")
asserts.assert_equal(heatDemand, 0)
self.step("19b")
await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive)
self.step("20")
await self.send_boost_command(duration=600, temporary_setpoint=7000)
event_data = events_callback.wait_for_event_report(Clusters.WaterHeaterManagement.Events.BoostStarted)
asserts.assert_equal(event_data.boostInfo.duration, 600)
asserts.assert_equal(event_data.boostInfo.temporarySetpoint, 7000)
self.step("20a")
heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand")
asserts.assert_greater(heatDemand, 0)
asserts.assert_equal(heatDemand & (~heaterTypes), 0, "heatDemand should only be from declared supported types"),
self.step("20b")
await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive)
self.step("21")
await self.send_cancel_boost_command()
event_data = events_callback.wait_for_event_report(Clusters.WaterHeaterManagement.Events.BoostEnded)
self.step("21a")
heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand")
asserts.assert_equal(heatDemand, 0)
self.step("21b")
await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kInactive)
self.step("22")
await self.send_test_event_trigger_water_temperature20C_test_event()
self.step("22a")
heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand")
asserts.assert_equal(heatDemand, 0)
self.step("23")
await self.send_boost_command(duration=200, emergency_boost=True)
event_data = events_callback.wait_for_event_report(Clusters.WaterHeaterManagement.Events.BoostStarted)
asserts.assert_equal(event_data.boostInfo.duration, 200)
asserts.assert_equal(event_data.boostInfo.emergencyBoost, True)
asserts.assert_is_none(event_data.boostInfo.temporarySetpoint)
self.step("23a")
heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand")
asserts.assert_greater(heatDemand, 0)
asserts.assert_equal(heatDemand & (~heaterTypes), 0, "heatDemand should only be from declared supported types"),
self.step("23b")
await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive)
self.step("24")
await self.send_cancel_boost_command()
event_data = events_callback.wait_for_event_report(Clusters.WaterHeaterManagement.Events.BoostEnded)
self.step("24a")
heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand")
asserts.assert_equal(heatDemand, 0)
self.step("24b")
await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kInactive)
self.step("25")
await self.send_cancel_boost_command()
event_data = events_callback.wait_for_event_expect_no_report()
self.step("26")
await self.send_test_event_trigger_basic_installation_test_event_clear()
if __name__ == "__main__":
default_matter_test_main()