Skip to content

Commit 88fe236

Browse files
committed
Fixes TP project-chip#4504 - Cannot run TC_EWATERHTR_2.1 under test harness using PIXIT values - so using featureMap instead.
1 parent 1d0dcbc commit 88fe236

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

src/python_testing/TC_EWATERHTR_2_1.py

+20-14
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,19 @@ def pics_TC_EWATERHTR_2_1(self):
5151
def steps_TC_EWATERHTR_2_1(self) -> list[TestStep]:
5252
steps = [
5353
TestStep("1", "Commission DUT to TH (can be skipped if done in a preceding test)."),
54-
TestStep("2", "TH reads from the DUT the HeaterTypes attribute.",
54+
TestStep("2", "TH reads from the DUT FeatureMap attribute.",
55+
"Store the value as FeatureMap."),
56+
TestStep("3", "TH reads from the DUT the HeaterTypes attribute.",
5557
"Verify that the DUT response contains a WaterHeaterTypeBitmap (enum8) greater than 0x00 (at least one type supported), and less than 0x20 (no undefined types supported)"),
56-
TestStep("3", "TH reads from the DUT the HeatDemand attribute.",
58+
TestStep("4", "TH reads from the DUT the HeatDemand attribute.",
5759
"Verify that the DUT response contains a WaterHeaterDemandBitmap (enum8)."),
58-
TestStep("4", "TH reads from the DUT the TankVolume attribute.",
60+
TestStep("5", "TH reads from the DUT the TankVolume attribute.",
5961
"Verify that the DUT response contains a uint16 value."),
60-
TestStep("5", "TH reads from the DUT the EstimatedHeatRequired attribute.",
62+
TestStep("6", "TH reads from the DUT the EstimatedHeatRequired attribute.",
6163
"Verify that the DUT response contains an energy-mWh value."),
62-
TestStep("6", "TH reads from the DUT the TankPercentage attribute.",
64+
TestStep("7", "TH reads from the DUT the TankPercentage attribute.",
6365
"Verify that the DUT response contains a percent value."),
64-
TestStep("7", "TH reads from the DUT the BoostState attribute.",
66+
TestStep("8", "TH reads from the DUT the BoostState attribute.",
6567
"Verify that the DUT response contains a BoostStateEnum (enum8) value."),
6668
]
6769

@@ -70,48 +72,52 @@ def steps_TC_EWATERHTR_2_1(self) -> list[TestStep]:
7072
@async_test_body
7173
async def test_TC_EWATERHTR_2_1(self):
7274

73-
em_supported = self.matter_test_config.global_test_params['PIXIT.EWATERHTR.EM']
74-
tp_supported = self.matter_test_config.global_test_params['PIXIT.EWATERHTR.TP']
75-
7675
self.step("1")
7776
# Commission DUT - already done
7877

78+
# Get the feature map for later
7979
self.step("2")
80+
feature_map = await self.read_whm_attribute_expect_success(attribute="FeatureMap")
81+
em_supported = bool(feature_map & Clusters.WaterHeaterManagement.Bitmaps.Feature.kEnergyManagement)
82+
tp_supported = bool(feature_map & Clusters.WaterHeaterManagement.Bitmaps.Feature.kTankPercent)
83+
logger.info(f"FeatureMap: {feature_map} : TP supported: {tp_supported} | EM supported: {em_supported}")
84+
85+
self.step("3")
8086
heaterTypes = await self.read_whm_attribute_expect_success(attribute="HeaterTypes")
8187
asserts.assert_greater(heaterTypes, 0,
8288
f"Unexpected HeaterTypes value - expected {heaterTypes} > 0")
8389
asserts.assert_less_equal(heaterTypes, Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterHeatSourceBitmap.kOther,
8490
f"Unexpected HeaterTypes value - expected {heaterTypes} <= WaterHeaterHeatSourceBitmap.kOther")
8591

86-
self.step("3")
92+
self.step("4")
8793
heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand")
8894
asserts.assert_greater(heatDemand, 0,
8995
f"Unexpected HeatDemand value - expected {heatDemand} > 0")
9096
asserts.assert_less_equal(heatDemand, Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterHeatSourceBitmap.kOther,
9197
f"Unexpected HeatDemand value - expected {heatDemand} <= WaterHeaterHeatSourceBitmap.kOther")
9298

93-
self.step("4")
99+
self.step("5")
94100
if em_supported:
95101
value = await self.read_whm_attribute_expect_success(attribute="TankVolume")
96102
else:
97103
logging.info("Skipping step 4 as PIXIT.EWATERHTR.EM not supported")
98104

99-
self.step("5")
105+
self.step("6")
100106
if em_supported:
101107
value = await self.read_whm_attribute_expect_success(attribute="EstimatedHeatRequired")
102108
asserts.assert_greater_equal(value, 0, f"Unexpected EstimatedHeatRequired value - expected {value} >= 0")
103109
else:
104110
logging.info("Skipping step 5 as PIXIT.EWATERHTR.EM not supported")
105111

106-
self.step("6")
112+
self.step("7")
107113
if tp_supported:
108114
value = await self.read_whm_attribute_expect_success(attribute="TankPercentage")
109115
asserts.assert_greater_equal(value, 0, f"Unexpected TankPercentage value - expected {value} >= 0")
110116
asserts.assert_less_equal(value, 100, f"Unexpected TankPercentage value - expected {value} <= 100")
111117
else:
112118
logging.info("Skipping step 6 as PIXIT.EWATERHTR.TP not supported")
113119

114-
self.step("7")
120+
self.step("8")
115121
boost_state = await self.read_whm_attribute_expect_success(attribute="BoostState")
116122
asserts.assert_less_equal(boost_state, Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kInactive,
117123
f"Unexpected BoostState value - expected {boost_state} should be BoostStateEnum (enum8) value in range 0x00 to 0x01")

0 commit comments

Comments
 (0)