@@ -1102,7 +1102,8 @@ async def TEST_TC_OPSTATE_BASE_2_5(self, endpoint=1):
1102
1102
f"Completion event error code mismatched from expectation on endpoint { endpoint } ." )
1103
1103
1104
1104
if event_data .totalOperationalTime is not NullValue :
1105
- asserts .assert_less_equal (initial_countdown_time , event_data .totalOperationalTime ,
1105
+ time_diff = abs (initial_countdown_time - event_data .totalOperationalTime )
1106
+ asserts .assert_less_equal (time_diff , 1 ,
1106
1107
f"The total operation time shall be at least { initial_countdown_time :.1f} " )
1107
1108
1108
1109
asserts .assert_equal (0 , event_data .pausedTime ,
@@ -1231,15 +1232,20 @@ def steps_TC_OPSTATE_BASE_2_6(self) -> list[TestStep]:
1231
1232
TestStep (2 , "Subscribe to CountdownTime attribute" ),
1232
1233
TestStep (3 , "Manually put the DUT into a state where it will use the CountdownTime attribute, "
1233
1234
"the initial value of the CountdownTime is greater than 30, "
1234
- "and it will begin counting down the CountdownTime attribute." ),
1235
- TestStep (4 , "Over a period of 30 seconds, TH counts all report transactions with an attribute "
1235
+ "and it will begin counting down the CountdownTime attribute. "
1236
+ "Test harness reads the CountdownTime attribute." ),
1237
+ TestStep (4 , "Test harness reads the CountdownTime attribute." ),
1238
+ TestStep (5 , "Over a period of 30 seconds, TH counts all report transactions with an attribute "
1236
1239
"report for the CountdownTime attribute in numberOfReportsReceived" ),
1237
- TestStep (5 , "Until the current operation finishes, TH counts all report transactions with "
1240
+ TestStep (6 , "Test harness reads the CountdownTime attribute." ),
1241
+ TestStep (7 , "Until the current operation finishes, TH counts all report transactions with "
1238
1242
"an attribute report for the CountdownTime attribute in numberOfReportsReceived and saves up to 5 such reports." ),
1239
- TestStep (6 , "Manually put the DUT into a state where it will use the CountdownTime attribute, "
1240
- "the initial value of the CountdownTime is greater than 30, and it will begin counting down the CountdownTime attribute." ),
1241
- TestStep (7 , "TH reads from the DUT the OperationalState attribute" ),
1242
- TestStep (8 , "Manually put the device in the Paused(0x02) operational state" )
1243
+ TestStep (8 , "Manually put the DUT into a state where it will use the CountdownTime attribute, "
1244
+ "the initial value of the CountdownTime is greater than 30, and it will begin counting down the CountdownTime attribute."
1245
+ "Test harness reads the CountdownTime attribute." ),
1246
+ TestStep (9 , "TH reads from the DUT the OperationalState attribute" ),
1247
+ TestStep (10 , "Test harness reads the CountdownTime attribute." ),
1248
+ TestStep (11 , "Manually put the device in the Paused(0x02) operational state" )
1243
1249
]
1244
1250
return steps
1245
1251
@@ -1267,26 +1273,35 @@ async def TEST_TC_OPSTATE_BASE_2_6(self, endpoint=1):
1267
1273
await self .read_and_expect_value (endpoint = endpoint ,
1268
1274
attribute = attributes .OperationalState ,
1269
1275
expected_value = cluster .Enums .OperationalStateEnum .kRunning )
1270
- count = sub_handler .attribute_report_counts [attributes .CountdownTime ]
1271
- asserts .assert_greater (count , 0 , "Did not receive any reports for CountdownTime" )
1276
+ countdownTime = await self .read_expect_success (endpoint = endpoint , attribute = attributes .CountdownTime )
1277
+ if countdownTime is not NullValue :
1278
+ count = sub_handler .attribute_report_counts [attributes .CountdownTime ]
1279
+ asserts .assert_greater (count , 0 , "Did not receive any reports for CountdownTime" )
1272
1280
else :
1273
1281
self .skip_step (3 )
1274
1282
1275
1283
sub_handler .reset ()
1276
1284
self .step (4 )
1277
- logging .info ('Test will now collect data for 30 seconds' )
1278
- time .sleep (30 )
1285
+ countdownTime = await self .read_expect_success (endpoint = endpoint , attribute = attributes .CountdownTime )
1286
+ if countdownTime is not NullValue :
1287
+ self .step (5 )
1288
+ logging .info ('Test will now collect data for 10 seconds' )
1289
+ time .sleep (10 )
1279
1290
1280
- count = sub_handler .attribute_report_counts [attributes .CountdownTime ]
1281
- sub_handler .reset ()
1282
- asserts .assert_less_equal (count , 5 , "Received more than 5 reports for CountdownTime" )
1283
- asserts .assert_greater_equal (count , 0 , "Did not receive any reports for CountdownTime" )
1291
+ count = sub_handler .attribute_report_counts [attributes .CountdownTime ]
1292
+ sub_handler .reset ()
1293
+ asserts .assert_less_equal (count , 5 , "Received more than 5 reports for CountdownTime" )
1294
+ asserts .assert_greater_equal (count , 0 , "Did not receive any reports for CountdownTime" )
1295
+ else :
1296
+ self .skip_step (5 )
1284
1297
1298
+ self .step (6 )
1299
+ countdownTime = await self .read_expect_success (endpoint = endpoint , attribute = attributes .CountdownTime )
1285
1300
attr_value = await self .read_expect_success (
1286
1301
endpoint = endpoint ,
1287
1302
attribute = attributes .OperationalState )
1288
- if attr_value == cluster .Enums .OperationalStateEnum .kRunning :
1289
- self .step (5 )
1303
+ if attr_value == cluster .Enums .OperationalStateEnum .kRunning and countdownTime is not NullValue :
1304
+ self .step (7 )
1290
1305
wait_count = 0
1291
1306
while (attr_value != cluster .Enums .OperationalStateEnum .kStopped ) and (wait_count < 20 ):
1292
1307
time .sleep (1 )
@@ -1298,36 +1313,40 @@ async def TEST_TC_OPSTATE_BASE_2_6(self, endpoint=1):
1298
1313
asserts .assert_less_equal (count , 5 , "Received more than 5 reports for CountdownTime" )
1299
1314
asserts .assert_greater (count , 0 , "Did not receive any reports for CountdownTime" )
1300
1315
else :
1301
- self .skip_step (5 )
1316
+ self .skip_step (7 )
1302
1317
1303
1318
sub_handler .reset ()
1304
- self .step (6 )
1305
1319
if self .pics_guard (self .check_pics (f"{ self .test_info .pics_code } .S.M.ST_RUNNING" )):
1320
+ self .step (8 )
1306
1321
self .send_manual_or_pipe_command (name = "OperationalStateChange" ,
1307
1322
device = self .device ,
1308
1323
operation = "Start" )
1309
1324
time .sleep (1 )
1310
1325
await self .read_and_expect_value (endpoint = endpoint ,
1311
1326
attribute = attributes .OperationalState ,
1312
1327
expected_value = cluster .Enums .OperationalStateEnum .kRunning )
1313
- count = sub_handler .attribute_report_counts [attributes .CountdownTime ]
1314
- asserts .assert_greater (count , 0 , "Did not receive any reports for CountdownTime" )
1328
+ countdownTime = await self .read_expect_success (endpoint = endpoint , attribute = attributes .CountdownTime )
1329
+ if countdownTime is not NullValue :
1330
+ count = sub_handler .attribute_report_counts [attributes .CountdownTime ]
1331
+ asserts .assert_greater (count , 0 , "Did not receive any reports for CountdownTime" )
1315
1332
else :
1316
- self .skip_step (6 )
1333
+ self .skip_step (8 )
1317
1334
1318
- self .step (7 )
1335
+ self .step (9 )
1319
1336
await self .read_and_expect_value (endpoint = endpoint ,
1320
1337
attribute = attributes .OperationalState ,
1321
1338
expected_value = cluster .Enums .OperationalStateEnum .kRunning )
1322
1339
1323
1340
sub_handler .reset ()
1324
- self .step (8 )
1325
- if self .pics_guard (self .check_pics (f"{ self .test_info .pics_code } .S.M.ST_PAUSED" )):
1341
+ self .step (10 )
1342
+ countdownTime = await self .read_expect_success (endpoint = endpoint , attribute = attributes .CountdownTime )
1343
+ if self .pics_guard (self .check_pics (f"{ self .test_info .pics_code } .S.M.ST_PAUSED" )) and countdownTime is not NullValue :
1344
+ self .step (11 )
1326
1345
self .send_manual_or_pipe_command (name = "OperationalStateChange" ,
1327
1346
device = self .device ,
1328
1347
operation = "Pause" )
1329
1348
time .sleep (1 )
1330
1349
count = sub_handler .attribute_report_counts [attributes .CountdownTime ]
1331
1350
asserts .assert_greater (count , 0 , "Did not receive any reports for CountdownTime" )
1332
1351
else :
1333
- self .skip_step (8 )
1352
+ self .skip_step (11 )
0 commit comments