@@ -274,26 +274,54 @@ async def test_TC_TSTAT_4_2(self):
274
274
275
275
supportsHeat = self .check_pics ("TSTAT.S.F00" )
276
276
supportsCool = self .check_pics ("TSTAT.S.F01" )
277
- supportsOccupancy = self .check_pics ("TSTAT.S.F02" )
278
-
279
- occupied = True
280
277
281
278
if supportsHeat :
282
- minHeatSetpointLimit = await self .read_single_attribute_check_success (endpoint = endpoint , cluster = cluster , attribute = cluster .Attributes .MinHeatSetpointLimit )
283
- 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
+
284
288
asserts .assert_true (minHeatSetpointLimit < maxHeatSetpointLimit , "Heat setpoint range invalid" )
285
289
286
290
if supportsCool :
287
- minCoolSetpointLimit = await self .read_single_attribute_check_success (endpoint = endpoint , cluster = cluster , attribute = cluster .Attributes .MinCoolSetpointLimit )
288
- 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
+
289
300
asserts .assert_true (minCoolSetpointLimit < maxCoolSetpointLimit , "Cool setpoint range invalid" )
290
301
302
+ # Servers that do not support occupancy are always "occupied"
303
+ occupied = True
304
+
305
+ supportsOccupancy = self .check_pics ("TSTAT.S.F02" )
291
306
if supportsOccupancy :
292
307
occupied = await self .read_single_attribute_check_success (endpoint = endpoint , cluster = cluster , attribute = cluster .Attributes .Occupancy ) & 1
293
308
309
+ # Target setpoints
294
310
heatSetpoint = minHeatSetpointLimit + ((maxHeatSetpointLimit - minHeatSetpointLimit ) / 2 )
295
311
coolSetpoint = minCoolSetpointLimit + ((maxCoolSetpointLimit - minCoolSetpointLimit ) / 2 )
296
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
+
297
325
self .step ("2" )
298
326
if self .pics_guard (self .check_pics ("TSTAT.S.F08" ) and self .check_pics ("TSTAT.S.A0050" )):
299
327
0 commit comments