Skip to content

[HVAC] fix TRV attr MinSetpointDeadBand shall allow 0-127 but ignore any attempted change #38834

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/app/clusters/thermostat-server/thermostat-server.cpp
Original file line number Diff line number Diff line change
@@ -720,6 +720,18 @@ CHIP_ERROR ThermostatAttrAccess::Write(const ConcreteDataAttributePath & aPath,

switch (aPath.mAttributeId)
{
case MinSetpointDeadBand::Id: {
int8_t minSetpointDeadBand;
ReturnErrorOnFailure(aDecoder.Decode(minSetpointDeadBand));
if (minSetpointDeadBand < 0) // || (minSetpointDeadBand > 127): type is int8_t, check is skipped
{
return CHIP_IM_GLOBAL_STATUS(ConstraintError);
}
// Spec requirement: For backwards compatiblity, this attribute is optionally writable. However any
// writes to this attribute SHALL be silently ignored.
return CHIP_NO_ERROR;
}
break;
case RemoteSensing::Id:
if (localTemperatureNotExposedSupported)
{
28 changes: 21 additions & 7 deletions src/python_testing/TC_TSTAT_2_2.py
Original file line number Diff line number Diff line change
@@ -592,15 +592,19 @@ async def test_TC_TSTAT_2_2(self):
# Test Harness Reads MinSetpointDeadBand attribute from Server DUT and verifies that the value is within range
if self.pics_guard(hasAutoModeFeature):
val = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=cluster.Attributes.MinSetpointDeadBand)
asserts.assert_less_equal(val, 25)
asserts.assert_less_equal(val, 127)
asserts.assert_greater_equal(val, 0)

if self.pics_guard(self.check_pics("TSTAT.S.M.MinSetpointDeadBandWritable")):
validval = val - 1 if val > 0 else 5 # only non-negative integer smaller than val is guaranteed valid
# otherwise if val = 0 then randomly pick 5 for testing as the write will always be discarded

# Test Harness Writes a value back that is different but valid for MinSetpointDeadBand attribute
await self.write_single_attribute(attribute_value=cluster.Attributes.MinSetpointDeadBand(5), endpoint_id=endpoint)
await self.write_single_attribute(attribute_value=cluster.Attributes.MinSetpointDeadBand(validval), endpoint_id=endpoint)

# Test Harness Reads it back again to confirm the successful write of MinSetpointDeadBand attribute
val = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=cluster.Attributes.MinSetpointDeadBand)
asserts.assert_equal(val, 5)
# Test Harness Reads it back again to confirm the write of MinSetpointDeadBand attribute is discarded
newval = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=cluster.Attributes.MinSetpointDeadBand)
asserts.assert_equal(val, newval)

self.step("11b")

@@ -610,17 +614,27 @@ async def test_TC_TSTAT_2_2(self):
asserts.assert_equal(status, Status.ConstraintError)

# Test Harness Writes the value above MinSetpointDeadBand
status = await self.write_single_attribute(attribute_value=cluster.Attributes.MinSetpointDeadBand(30), endpoint_id=endpoint, expect_success=False)
status = await self.write_single_attribute(attribute_value=cluster.Attributes.MinSetpointDeadBand(128), endpoint_id=endpoint, expect_success=False)
asserts.assert_equal(status, Status.ConstraintError)

self.step("11c")

if self.pics_guard(hasAutoModeFeature and self.check_pics("TSTAT.S.M.MinSetpointDeadBandWritable")):
val = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=cluster.Attributes.MinSetpointDeadBand)

# Test Harness Writes the min limit of MinSetpointDeadBand
await self.write_single_attribute(attribute_value=cluster.Attributes.MinSetpointDeadBand(0), endpoint_id=endpoint)

# Test Harness Reads it back again to confirm the write of MinSetpointDeadBand attribute is discarded
newval = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=cluster.Attributes.MinSetpointDeadBand)
asserts.assert_equal(val, newval)

# Test Harness Writes the max limit of MinSetpointDeadBand
await self.write_single_attribute(attribute_value=cluster.Attributes.MinSetpointDeadBand(25), endpoint_id=endpoint)
await self.write_single_attribute(attribute_value=cluster.Attributes.MinSetpointDeadBand(127), endpoint_id=endpoint)

# Test Harness Reads it back again to confirm the write of MinSetpointDeadBand attribute is discarded
newval = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=cluster.Attributes.MinSetpointDeadBand)
asserts.assert_equal(val, newval)

self.step("12")