@@ -45,11 +45,13 @@ def steps_TC_VALCC_3_1(self) -> list[TestStep]:
45
45
steps = [
46
46
TestStep (1 , "Commissioning, already done" , is_commissioning = True ),
47
47
TestStep (2 , "Send Open command" ),
48
- TestStep (3 , "Read TargetState attribute" ),
49
- TestStep (4 , "Read CurrentState attribute" ),
48
+ TestStep (3 , "Read CurrentState and TargetState attribute until CurrentState is Open" ,
49
+ "Target state is Open while CurrentState is Transitioning" ),
50
+ TestStep (4 , "Read CurrentState and TargetState attribute" , "CurrentState is Open, TargetState is NULL" ),
50
51
TestStep (5 , "Send Close command" ),
51
- TestStep (6 , "Read TargetState attribute" ),
52
- TestStep (7 , "Read CurrentState attribute" ),
52
+ TestStep (6 , "Read CurrentState and TargetState attribute until CurrentState is Open" ,
53
+ "Target state is Closed while CurrentState is Transitioning" ),
54
+ TestStep (7 , "Read CurrentState and TargetState attribute" , "CurrentState is Closed, TargetState is NULL" ),
53
55
]
54
56
return steps
55
57
@@ -65,7 +67,8 @@ async def test_TC_VALCC_3_1(self):
65
67
endpoint = self .user_params .get ("endpoint" , 1 )
66
68
67
69
self .step (1 )
68
- attributes = Clusters .ValveConfigurationAndControl .Attributes
70
+ cluster = Clusters .ValveConfigurationAndControl
71
+ attributes = cluster .Attributes
69
72
70
73
self .step (2 )
71
74
try :
@@ -75,24 +78,26 @@ async def test_TC_VALCC_3_1(self):
75
78
pass
76
79
77
80
self .step (3 )
78
- target_state_dut = await self .read_valcc_attribute_expect_success (endpoint = endpoint , attribute = attributes .TargetState )
79
-
80
- asserts .assert_true (target_state_dut is not NullValue , "TargetState is null" )
81
- asserts .assert_equal (target_state_dut , Clusters .Objects .ValveConfigurationAndControl .Enums .ValveStateEnum .kOpen ,
82
- "TargetState is not the expected value" )
83
81
84
- self .step (4 )
82
+ # Read target state first in case the current state goes to open between these calls.
83
+ # The test re-reads target state after CurrentState goes to open.
84
+ target_state_dut = await self .read_valcc_attribute_expect_success (endpoint = endpoint , attribute = attributes .TargetState )
85
85
current_state_dut = await self .read_valcc_attribute_expect_success (endpoint = endpoint , attribute = attributes .CurrentState )
86
- asserts .assert_true (current_state_dut is not NullValue , "CurrentState is null" )
87
86
88
- while current_state_dut is Clusters .Objects .ValveConfigurationAndControl .Enums .ValveStateEnum .kTransitioning :
87
+ while current_state_dut is cluster .Enums .ValveStateEnum .kTransitioning :
88
+ asserts .assert_equal (target_state_dut , cluster .Enums .ValveStateEnum .kOpen , "TargetState is incorrect" )
89
89
time .sleep (1 )
90
90
91
+ target_state_dut = await self .read_valcc_attribute_expect_success (endpoint = endpoint , attribute = attributes .TargetState )
91
92
current_state_dut = await self .read_valcc_attribute_expect_success (endpoint = endpoint , attribute = attributes .CurrentState )
92
93
asserts .assert_true (current_state_dut is not NullValue , "CurrentState is null" )
94
+ asserts .assert_true (target_state_dut is not NullValue , "TargetState is null" )
93
95
94
- asserts .assert_equal (current_state_dut , Clusters .Objects .ValveConfigurationAndControl .Enums .ValveStateEnum .kOpen ,
95
- "CurrentState is not the expected value" )
96
+ self .step (4 )
97
+ current_state_dut = await self .read_valcc_attribute_expect_success (endpoint = endpoint , attribute = attributes .CurrentState )
98
+ asserts .assert_equal (current_state_dut , cluster .Enums .ValveStateEnum .kOpen , "CurrentState is incorrect" )
99
+ target_state_dut = await self .read_valcc_attribute_expect_success (endpoint = endpoint , attribute = attributes .TargetState )
100
+ asserts .assert_true (target_state_dut is NullValue , "TargetState is not null" )
96
101
97
102
self .step (5 )
98
103
try :
@@ -103,23 +108,22 @@ async def test_TC_VALCC_3_1(self):
103
108
104
109
self .step (6 )
105
110
target_state_dut = await self .read_valcc_attribute_expect_success (endpoint = endpoint , attribute = attributes .TargetState )
106
-
107
- asserts .assert_true (target_state_dut is not NullValue , "TargetState is null" )
108
- asserts .assert_equal (target_state_dut , Clusters .Objects .ValveConfigurationAndControl .Enums .ValveStateEnum .kClosed ,
109
- "TargetState is not the expected value" )
110
-
111
- self .step (7 )
112
111
current_state_dut = await self .read_valcc_attribute_expect_success (endpoint = endpoint , attribute = attributes .CurrentState )
113
- asserts .assert_true (current_state_dut is not NullValue , "CurrentState is null" )
114
112
115
- while current_state_dut is Clusters .Objects .ValveConfigurationAndControl .Enums .ValveStateEnum .kTransitioning :
113
+ while current_state_dut is cluster .Enums .ValveStateEnum .kTransitioning :
114
+ asserts .assert_equal (target_state_dut , cluster .Enums .ValveStateEnum .kClosed , "TargetState is incorrect" )
116
115
time .sleep (1 )
117
116
117
+ target_state_dut = await self .read_valcc_attribute_expect_success (endpoint = endpoint , attribute = attributes .TargetState )
118
118
current_state_dut = await self .read_valcc_attribute_expect_success (endpoint = endpoint , attribute = attributes .CurrentState )
119
119
asserts .assert_true (current_state_dut is not NullValue , "CurrentState is null" )
120
+ asserts .assert_true (target_state_dut is not NullValue , "TargetState is null" )
120
121
121
- asserts .assert_equal (current_state_dut , Clusters .Objects .ValveConfigurationAndControl .Enums .ValveStateEnum .kClosed ,
122
- "CurrentState is not the expected value" )
122
+ self .step (7 )
123
+ current_state_dut = await self .read_valcc_attribute_expect_success (endpoint = endpoint , attribute = attributes .CurrentState )
124
+ asserts .assert_equal (current_state_dut , cluster .Enums .ValveStateEnum .kClosed , "CurrentState is incorrect" )
125
+ target_state_dut = await self .read_valcc_attribute_expect_success (endpoint = endpoint , attribute = attributes .TargetState )
126
+ asserts .assert_true (target_state_dut is NullValue , "TargetState is not null" )
123
127
124
128
125
129
if __name__ == "__main__" :
0 commit comments