Skip to content

Commit 527c219

Browse files
committed
Fall back on Absolute setpoints, and then defaults, when user-configured setpoints are unimplemented
1 parent 75bf625 commit 527c219

File tree

1 file changed

+35
-7
lines changed

1 file changed

+35
-7
lines changed

src/python_testing/TC_TSTAT_4_2.py

+35-7
Original file line numberDiff line numberDiff line change
@@ -274,26 +274,54 @@ async def test_TC_TSTAT_4_2(self):
274274

275275
supportsHeat = self.check_pics("TSTAT.S.F00")
276276
supportsCool = self.check_pics("TSTAT.S.F01")
277-
supportsOccupancy = self.check_pics("TSTAT.S.F02")
278-
279-
occupied = True
280277

281278
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+
284288
asserts.assert_true(minHeatSetpointLimit < maxHeatSetpointLimit, "Heat setpoint range invalid")
285289

286290
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+
289300
asserts.assert_true(minCoolSetpointLimit < maxCoolSetpointLimit, "Cool setpoint range invalid")
290301

302+
# Servers that do not support occupancy are always "occupied"
303+
occupied = True
304+
305+
supportsOccupancy = self.check_pics("TSTAT.S.F02")
291306
if supportsOccupancy:
292307
occupied = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=cluster.Attributes.Occupancy) & 1
293308

309+
# Target setpoints
294310
heatSetpoint = minHeatSetpointLimit + ((maxHeatSetpointLimit - minHeatSetpointLimit) / 2)
295311
coolSetpoint = minCoolSetpointLimit + ((maxCoolSetpointLimit - minCoolSetpointLimit) / 2)
296312

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+
297325
self.step("2")
298326
if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050")):
299327

0 commit comments

Comments
 (0)