@@ -39,16 +39,25 @@ def desc_TC_MWOCTRL_2_2(self) -> str:
39
39
def steps_TC_MWOCTRL_2_2 (self ) -> list [TestStep ]:
40
40
steps = [
41
41
TestStep (1 , "Commissioning, already done" , is_commissioning = True ),
42
- TestStep (2 , "Read the PowerSetting attribute" ),
43
- TestStep (3 , "Send the SetCookingParameters command" ),
44
- TestStep (4 , "Read and verify the PowerSetting attribute" ),
45
- TestStep (5 , "Cause constraint error response" ),
42
+ TestStep (2 , "Set MinPowerValue variable" ),
43
+ TestStep (3 , "Read the MinPower attribute" ),
44
+ TestStep (4 , "Set the MaxPowerValue variable" ),
45
+ TestStep (5 , "Read the MaxPower attribute" ),
46
+ TestStep (6 , "Set the PowerStepValue variable" ),
47
+ TestStep (7 , "Read the PowerStep attribute" ),
48
+ TestStep (8 , "Read the PowerSetting attribute" ),
49
+ TestStep (9 , "Send the SetCookingParameters command" ),
50
+ TestStep (10 , "Read and verify the PowerSetting attribute" ),
51
+ TestStep (11 , "Set the PowerSetting attribute to the minimum value" ),
52
+ TestStep (12 , "Set the PowerSetting attribute to the maximum value" ),
53
+ TestStep (13 , "Cause constraint error response" ),
46
54
]
47
55
return steps
48
56
49
57
def pics_TC_MWOCTRL_2_2 (self ) -> list [str ]:
50
58
pics = [
51
59
"MWOCTRL.S" ,
60
+ "MWOCTRL.S.F00" ,
52
61
]
53
62
return pics
54
63
@@ -63,40 +72,78 @@ async def test_TC_MWOCTRL_2_2(self):
63
72
features = Clusters .MicrowaveOvenControl .Bitmaps .Feature
64
73
commands = Clusters .Objects .MicrowaveOvenControl .Commands
65
74
66
- feature_map = await self .read_mwoctrl_attribute_expect_success (endpoint = endpoint , attribute = attributes .FeatureMap )
67
-
68
- only_pwrnum_supported = feature_map == features .kPowerAsNumber
69
-
70
- if not only_pwrnum_supported :
71
- logging .info ("More than PWRNUM is supported so skipping remaining test steps" )
75
+ if not feature_map & features .kPowerAsNumber :
76
+ logging .info ("PWRNUM is not supported so skipping remaining test steps" )
72
77
self .skip_all_remaining_steps (2 )
73
78
return
74
79
75
- logging .info ("Only the PWRNUM feature is supported so continuing with remaining test steps" )
80
+ logging .info ("The PWRNUM feature is supported so continuing with remaining test steps" )
81
+
76
82
self .step (2 )
77
- powerValue = await self .read_mwoctrl_attribute_expect_success (endpoint = endpoint , attribute = attributes .PowerSetting )
78
- asserts .assert_greater_equal (powerValue , 10 , "PowerSetting is less than 10" )
79
- asserts .assert_less_equal (powerValue , 100 , "PowerSetting is greater than 100" )
80
- asserts .assert_true (powerValue % 10 == 0 , "PowerSetting is not a multiple of 10" )
83
+ minPowerValue = 10
81
84
82
85
self .step (3 )
83
- newPowerValue = (powerValue + 10 ) % 100
86
+ if self .pics_guard (self .check_pics ("MWOCTRL.S.F02" )):
87
+ minPowerValue = await self .read_mwoctrl_attribute_expect_success (endpoint = endpoint , attribute = attributes .MinPower )
88
+ logging .info ("MinPower is %s" % minPowerValue )
89
+ asserts .assert_true (minPowerValue >= 1 , "MinPower is less than 1" )
90
+
91
+ self .step (4 )
92
+ maxPowerValue = 100
93
+
94
+ self .step (5 )
95
+ if self .pics_guard (self .check_pics ("MWOCTRL.S.F02" )):
96
+ maxPowerValue = await self .read_mwoctrl_attribute_expect_success (endpoint = endpoint , attribute = attributes .MaxPower )
97
+ logging .info ("MaxPower is %s" % maxPowerValue )
98
+ asserts .assert_true (maxPowerValue >= minPowerValue , "MaxPower is less than MinPower" )
99
+ asserts .assert_true (maxPowerValue <= 100 , "MaxPower is greater than 100" )
100
+
101
+ self .step (6 )
102
+ powerStepValue = 10
103
+
104
+ self .step (7 )
105
+ if self .pics_guard (self .check_pics ("MWOCTRL.S.F02" )):
106
+ powerStepValue = await self .read_mwoctrl_attribute_expect_success (endpoint = endpoint , attribute = attributes .PowerStep )
107
+ logging .info ("PowerStep is %s" % powerStepValue )
108
+ asserts .assert_true (powerStepValue >= 1 , "PowerStep is less than 1" )
109
+ asserts .assert_true (powerStepValue <= maxPowerValue , "PowerStep is greater than MaxPower" )
110
+
111
+ self .step (8 )
112
+ powerValue = await self .read_mwoctrl_attribute_expect_success (endpoint = endpoint , attribute = attributes .PowerSetting )
113
+ asserts .assert_greater_equal (powerValue , minPowerValue , "PowerSetting is less than the minimum." )
114
+ asserts .assert_less_equal (powerValue , maxPowerValue , "PowerSetting is greater than the maxium" )
115
+ asserts .assert_true ((powerValue - minPowerValue ) % powerStepValue == 0 , "PowerSetting is not a multiple of power step" )
116
+
117
+ self .step (9 )
118
+ newPowerValue = (powerValue - minPowerValue ) % (maxPowerValue - minPowerValue )+ powerStepValue + minPowerValue
84
119
try :
85
120
await self .send_single_cmd (cmd = commands .SetCookingParameters (powerSetting = newPowerValue ), endpoint = endpoint )
86
121
except InteractionModelError as e :
87
122
asserts .assert_equal (e .status , Status .Success , "Unexpected error returned" )
88
123
89
- self .step (4 )
124
+ self .step (10 )
90
125
powerValue = await self .read_mwoctrl_attribute_expect_success (endpoint = endpoint , attribute = attributes .PowerSetting )
91
126
asserts .assert_true (powerValue == newPowerValue , "PowerSetting was not correctly set" )
92
127
93
- self .step (5 )
94
- newPowerValue = 125
128
+ self .step (11 )
129
+ try :
130
+ await self .send_single_cmd (cmd = commands .SetCookingParameters (powerSetting = minPowerValue ), endpoint = endpoint )
131
+ except InteractionModelError as e :
132
+ asserts .assert_equal (e .status , Status .Success , "Unable to set power value to minimum" )
133
+
134
+ self .step (12 )
135
+ try :
136
+ await self .send_single_cmd (cmd = commands .SetCookingParameters (powerSetting = maxPowerValue ), endpoint = endpoint )
137
+ except InteractionModelError as e :
138
+ asserts .assert_equal (e .status , Status .Success , "Unable to set power value to maximum" )
139
+
140
+ self .step (13 )
141
+ newPowerValue = maxPowerValue + 1
95
142
try :
96
143
await self .send_single_cmd (cmd = commands .SetCookingParameters (powerSetting = newPowerValue ), endpoint = endpoint )
97
144
asserts .assert_fail ("Expected an exception but received none." )
98
145
except InteractionModelError as e :
99
- asserts .assert_equal (e .status , Status .ConstraintError , "Expected ConstraintError but received a different error ." )
146
+ asserts .assert_equal (e .status , Status .ConstraintError , "Expected ConstraintError but received a different response ." )
100
147
101
148
102
149
if __name__ == "__main__" :
0 commit comments