@@ -261,6 +261,8 @@ async def test_TC_TSTAT_4_2(self):
261
261
nodeId = self .dut_node_id , setupPinCode = params .setupPinCode ,
262
262
filterType = ChipDeviceCtrl .DiscoveryFilterType .LONG_DISCRIMINATOR , filter = 1234 )
263
263
264
+ secondary_fabric_index = await self .read_single_attribute_check_success (dev_ctrl = secondary_controller , endpoint = 0 , cluster = Clusters .Objects .OperationalCredentials , attribute = Clusters .OperationalCredentials .Attributes .CurrentFabricIndex )
265
+
264
266
current_presets = []
265
267
presetTypes = []
266
268
presetScenarioCounts = {}
@@ -272,26 +274,54 @@ async def test_TC_TSTAT_4_2(self):
272
274
273
275
supportsHeat = self .check_pics ("TSTAT.S.F00" )
274
276
supportsCool = self .check_pics ("TSTAT.S.F01" )
275
- supportsOccupancy = self .check_pics ("TSTAT.S.F02" )
276
-
277
- occupied = True
278
277
279
278
if supportsHeat :
280
- minHeatSetpointLimit = await self .read_single_attribute_check_success (endpoint = endpoint , cluster = cluster , attribute = cluster .Attributes .MinHeatSetpointLimit )
281
- maxHeatSetpointLimit = await self .read_single_attribute_check_success (endpoint = endpoint , cluster = cluster , attribute = cluster .Attributes .MaxHeatSetpointLimit )
279
+ # If the server supports MinHeatSetpointLimit & MaxHeatSetpointLimit, use those
280
+ if self .check_pics ("TSTAT.S.A0015" ) and self .check_pics ("TSTAT.S.A0016" ):
281
+ minHeatSetpointLimit = await self .read_single_attribute_check_success (endpoint = endpoint , cluster = cluster , attribute = cluster .Attributes .MinHeatSetpointLimit )
282
+ maxHeatSetpointLimit = await self .read_single_attribute_check_success (endpoint = endpoint , cluster = cluster , attribute = cluster .Attributes .MaxHeatSetpointLimit )
283
+ elif self .check_pics ("TSTAT.S.A0003" ) and self .check_pics ("TSTAT.S.A0004" ):
284
+ # Otherwise, if the server supports AbsMinHeatSetpointLimit & AbsMaxHeatSetpointLimit, use those
285
+ minHeatSetpointLimit = await self .read_single_attribute_check_success (endpoint = endpoint , cluster = cluster , attribute = cluster .Attributes .AbsMinHeatSetpointLimit )
286
+ maxHeatSetpointLimit = await self .read_single_attribute_check_success (endpoint = endpoint , cluster = cluster , attribute = cluster .Attributes .AbsMaxHeatSetpointLimit )
287
+
282
288
asserts .assert_true (minHeatSetpointLimit < maxHeatSetpointLimit , "Heat setpoint range invalid" )
283
289
284
290
if supportsCool :
285
- minCoolSetpointLimit = await self .read_single_attribute_check_success (endpoint = endpoint , cluster = cluster , attribute = cluster .Attributes .MinCoolSetpointLimit )
286
- maxCoolSetpointLimit = await self .read_single_attribute_check_success (endpoint = endpoint , cluster = cluster , attribute = cluster .Attributes .MaxCoolSetpointLimit )
291
+ # If the server supports MinCoolSetpointLimit & MaxCoolSetpointLimit, use those
292
+ if self .check_pics ("TSTAT.S.A0017" ) and self .check_pics ("TSTAT.S.A0018" ):
293
+ minCoolSetpointLimit = await self .read_single_attribute_check_success (endpoint = endpoint , cluster = cluster , attribute = cluster .Attributes .MinCoolSetpointLimit )
294
+ maxCoolSetpointLimit = await self .read_single_attribute_check_success (endpoint = endpoint , cluster = cluster , attribute = cluster .Attributes .MaxCoolSetpointLimit )
295
+ elif self .check_pics ("TSTAT.S.A0005" ) and self .check_pics ("TSTAT.S.A0006" ):
296
+ # Otherwise, if the server supports AbsMinCoolSetpointLimit & AbsMaxCoolSetpointLimit, use those
297
+ minCoolSetpointLimit = await self .read_single_attribute_check_success (endpoint = endpoint , cluster = cluster , attribute = cluster .Attributes .AbsMinCoolSetpointLimit )
298
+ maxCoolSetpointLimit = await self .read_single_attribute_check_success (endpoint = endpoint , cluster = cluster , attribute = cluster .Attributes .AbsMaxCoolSetpointLimit )
299
+
287
300
asserts .assert_true (minCoolSetpointLimit < maxCoolSetpointLimit , "Cool setpoint range invalid" )
288
301
302
+ # Servers that do not support occupancy are always "occupied"
303
+ occupied = True
304
+
305
+ supportsOccupancy = self .check_pics ("TSTAT.S.F02" )
289
306
if supportsOccupancy :
290
307
occupied = await self .read_single_attribute_check_success (endpoint = endpoint , cluster = cluster , attribute = cluster .Attributes .Occupancy ) & 1
291
308
309
+ # Target setpoints
292
310
heatSetpoint = minHeatSetpointLimit + ((maxHeatSetpointLimit - minHeatSetpointLimit ) / 2 )
293
311
coolSetpoint = minCoolSetpointLimit + ((maxCoolSetpointLimit - minCoolSetpointLimit ) / 2 )
294
312
313
+ # Set the heating and cooling setpoints to something other than the target setpoints
314
+ if occupied :
315
+ if supportsHeat :
316
+ await self .write_single_attribute (attribute_value = cluster .Attributes .OccupiedHeatingSetpoint (heatSetpoint - 1 ), endpoint_id = endpoint )
317
+ if supportsCool :
318
+ await self .write_single_attribute (attribute_value = cluster .Attributes .OccupiedCoolingSetpoint (coolSetpoint - 1 ), endpoint_id = endpoint )
319
+ else :
320
+ if supportsHeat :
321
+ await self .write_single_attribute (attribute_value = cluster .Attributes .UnoccupiedHeatingSetpoint (heatSetpoint - 1 ), endpoint_id = endpoint )
322
+ if supportsCool :
323
+ await self .write_single_attribute (attribute_value = cluster .Attributes .UnoccupiedCoolingSetpoint (coolSetpoint - 1 ), endpoint_id = endpoint )
324
+
295
325
self .step ("2" )
296
326
if self .pics_guard (self .check_pics ("TSTAT.S.F08" ) and self .check_pics ("TSTAT.S.A0050" )):
297
327
@@ -643,7 +673,7 @@ async def test_TC_TSTAT_4_2(self):
643
673
await self .send_atomic_request_begin_command (dev_ctrl = secondary_controller )
644
674
645
675
# Primary controller removes the second fabric
646
- await self .send_single_cmd (Clusters .OperationalCredentials .Commands .RemoveFabric (fabricIndex = 2 ), endpoint = 0 )
676
+ await self .send_single_cmd (Clusters .OperationalCredentials .Commands .RemoveFabric (fabricIndex = secondary_fabric_index ), endpoint = 0 )
647
677
648
678
# Send the AtomicRequest begin command from primary controller, which should succeed, as the secondary controller's atomic write state has been cleared
649
679
status = await self .send_atomic_request_begin_command ()
0 commit comments