Skip to content

Commit abf0270

Browse files
committedAug 29, 2024·
Pick midpoint setpoints for new presets
1 parent 98aa328 commit abf0270

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed
 

‎src/python_testing/TC_TSTAT_4_2.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,12 @@ async def test_TC_TSTAT_4_2(self):
260260
minCoolSetpointLimit = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=cluster.Attributes.MinCoolSetpointLimit)
261261
maxCoolSetpointLimit = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=cluster.Attributes.MaxCoolSetpointLimit)
262262

263+
asserts.assert_true(minHeatSetpointLimit < maxHeatSetpointLimit, "Heat setpoint range invalid")
264+
asserts.assert_true(minCoolSetpointLimit < maxCoolSetpointLimit, "Cool setpoint range invalid")
265+
266+
heatSetpoint = minHeatSetpointLimit + ((maxHeatSetpointLimit - minHeatSetpointLimit) / 2)
267+
coolSetpoint = minCoolSetpointLimit + ((maxCoolSetpointLimit - minCoolSetpointLimit) / 2)
268+
263269
self.step("2")
264270
if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050")):
265271

@@ -439,7 +445,7 @@ async def test_TC_TSTAT_4_2(self):
439445

440446
# Write to the presets attribute after adding a preset with builtIn set to True
441447
test_presets.append(cluster.Structs.PresetStruct(presetHandle=NullValue, presetScenario=availableScenario,
442-
coolingSetpoint=2800, heatingSetpoint=1800, builtIn=True))
448+
coolingSetpoint=coolSetpoint, heatingSetpoint=heatSetpoint, builtIn=True))
443449

444450
status = await self.write_presets(endpoint=endpoint, presets=test_presets, expected_status=Status.ConstraintError)
445451

@@ -458,7 +464,7 @@ async def test_TC_TSTAT_4_2(self):
458464
# Write to the presets attribute after adding a preset with a preset handle that doesn't exist in Presets attribute
459465
test_presets = copy.deepcopy(current_presets)
460466
test_presets.append(cluster.Structs.PresetStruct(presetHandle=random.randbytes(16), presetScenario=cluster.Enums.PresetScenarioEnum.kWake,
461-
name="Wake", coolingSetpoint=2800, heatingSetpoint=1800, builtIn=True))
467+
name="Wake", coolingSetpoint=coolSetpoint, heatingSetpoint=heatSetpoint, builtIn=True))
462468

463469
status = await self.write_presets(endpoint=endpoint, presets=test_presets, expected_status=Status.NotFound)
464470

@@ -523,7 +529,7 @@ async def test_TC_TSTAT_4_2(self):
523529

524530
if len(presets_without_name_support) is 0 and len(availableScenarios) > 0:
525531
new_preset = cluster.Structs.PresetStruct(presetHandle=NullValue, presetScenario=availableScenarios[0],
526-
coolingSetpoint=2800, heatingSetpoint=1800, builtIn=True)
532+
coolingSetpoint=coolSetpoint, heatingSetpoint=heatSetpoint, builtIn=True)
527533
test_presets.append(new_preset)
528534
presets_without_name_support = [new_preset]
529535

@@ -553,7 +559,7 @@ async def test_TC_TSTAT_4_2(self):
553559
# Write to the presets attribute with a new valid preset added
554560
test_presets = copy.deepcopy(current_presets)
555561
test_presets.append(cluster.Structs.PresetStruct(presetHandle=NullValue, presetScenario=availableScenario,
556-
coolingSetpoint=2800, heatingSetpoint=1800, builtIn=False))
562+
coolingSetpoint=coolSetpoint, heatingSetpoint=heatSetpoint, builtIn=False))
557563

558564
# Send the AtomicRequest begin command
559565
await self.send_atomic_request_begin_command()

0 commit comments

Comments
 (0)
Please sign in to comment.