@@ -91,8 +91,10 @@ def _verify_supported_mode(self, supported_mode):
91
91
logger .info (
92
92
"SupportedMode.semanticTags contains values, verifying attributes for manufacturedcode and value are not longer than 16bits int" )
93
93
for semantictag in supported_mode .semanticTags :
94
- asserts .assert_true (semantictag .mfgCode <= self ._16bitshex , "Element semantictag.Mfgcode is greater than 16 bits" )
95
- asserts .assert_true (semantictag .value <= self ._16bitshex , "Element semantictag.Value is greater than 16 bits" )
94
+ asserts .assert_true (semantictag >= 0 and semantictag .mfgCode <= self ._16bitshex ,
95
+ "Element semantictag.Mfgcode is greater than 16 bits" )
96
+ asserts .assert_true (semantictag >= 0 and semantictag .value <= self ._16bitshex ,
97
+ "Element semantictag.Value is greater than 16 bits" )
96
98
97
99
def _log_attribute (self , name , value ):
98
100
logger .info (f"{ name } attribute { value } with type { type (value )} " )
@@ -112,7 +114,7 @@ async def test_MOD_1_2(self):
112
114
# Verify contains attributes label and mode
113
115
# Verify if semantic tags has elements in list , and if there are values assert the values
114
116
self .step (2 )
115
- supported_modes = await self .read_single_attribute_check_success (endpoint = 1 , cluster = self .cluster , attribute = self .cluster .Attributes .SupportedModes )
117
+ supported_modes = await self .read_single_attribute_check_success (endpoint = self . endpoint , cluster = self .cluster , attribute = self .cluster .Attributes .SupportedModes )
116
118
logger .info (f"Supported modes { supported_modes } " )
117
119
# List must not be empty
118
120
asserts .assert_true (len (supported_modes ) > 0 , "Supported modes can not be empty." )
@@ -128,32 +130,32 @@ async def test_MOD_1_2(self):
128
130
129
131
# Currentmode attribute check must be int and must be in the supported modes values.
130
132
self .step (3 )
131
- current_mode = await self .read_single_attribute_check_success (endpoint = 1 , cluster = self .cluster , attribute = self .cluster .Attributes .CurrentMode )
133
+ current_mode = await self .read_single_attribute_check_success (endpoint = self . endpoint , cluster = self .cluster , attribute = self .cluster .Attributes .CurrentMode )
132
134
self ._log_attribute ('CurrentMode' , current_mode )
133
135
asserts .assert_true (isinstance (current_mode , int ), "Current mode is not int" )
134
136
asserts .assert_in (current_mode , supported_modes_values , f"Current mode { current_mode } is not in { supported_modes_values } " )
135
137
136
- # Onmode can be null
137
138
self .step (4 )
138
- on_mode = await self .read_single_attribute_check_success (endpoint = 1 , cluster = self .cluster , attribute = self .cluster .Attributes .OnMode )
139
- # on mode can be null
139
+ on_mode = await self .read_single_attribute_check_success (endpoint = self . endpoint , cluster = self .cluster , attribute = self .cluster .Attributes .OnMode )
140
+ # On mode can be null
140
141
self ._log_attribute ("OnMode" , on_mode )
141
142
asserts .assert_true ((isinstance (on_mode , int ) or isinstance (on_mode , Nullable )),
142
143
"Onmode is not int or is not clusters.Types.Nullable" )
144
+ # verify that OnMode is in the list of Supported Modes, but if null, cant be verified.
143
145
if not isinstance (on_mode , Nullable ):
144
146
asserts .assert_in (on_mode , supported_modes_values , f"Onmode { current_mode } is not in { supported_modes_values } " )
145
147
146
148
# Validate startup mode
147
149
self .step (5 )
148
- startup_mode = await self .read_single_attribute_check_success (endpoint = 1 , cluster = self .cluster , attribute = self .cluster .Attributes .StartUpMode )
150
+ startup_mode = await self .read_single_attribute_check_success (endpoint = self . endpoint , cluster = self .cluster , attribute = self .cluster .Attributes .StartUpMode )
149
151
self ._log_attribute ("StartupMode" , startup_mode )
150
152
asserts .assert_true (isinstance (startup_mode , int ), "Startupmode is not int" )
151
153
asserts .assert_in (startup_mode , supported_modes_values , f"Startupmode { current_mode } is not in { supported_modes_values } " )
152
154
153
155
# Verify the string for ci is larger that 1 char.
154
156
# If is non ci ask the user if can read and understand the string.
155
157
self .step (6 )
156
- description = await self .read_single_attribute_check_success (endpoint = 1 , cluster = self .cluster , attribute = self .cluster .Attributes .Description )
158
+ description = await self .read_single_attribute_check_success (endpoint = self . endpoint , cluster = self .cluster , attribute = self .cluster .Attributes .Description )
157
159
self ._log_attribute ("Description" , description )
158
160
if self .is_ci :
159
161
asserts .assert_true (isinstance (description , str ), "Description attribute is not str" )
@@ -164,12 +166,12 @@ async def test_MOD_1_2(self):
164
166
default_value = "y" )
165
167
asserts .assert_true (user_response .lower () == 'y' , "The description is not understandable to the user." )
166
168
167
- # Verify the StandardNamespace can be 16bits integer or null
169
+ # Verify the StandardNamespace can be 16 bits enum or null
168
170
self .step (7 )
169
- standard_namepace = await self .read_single_attribute_check_success (endpoint = 1 , cluster = self .cluster , attribute = self .cluster .Attributes .StandardNamespace )
171
+ standard_namepace = await self .read_single_attribute_check_success (endpoint = self . endpoint , cluster = self .cluster , attribute = self .cluster .Attributes .StandardNamespace )
170
172
self ._log_attribute ("StandardNamespace" , standard_namepace )
171
- asserts .assert_true ((isinstance (standard_namepace , Nullable ) or (isinstance (standard_namepace , int ) and standard_namepace <= self ._16bitshex )),
172
- "Standard namespace is not 16bit or not nullable " )
173
+ asserts .assert_true ((isinstance (standard_namepace , Nullable ) or (isinstance (standard_namepace , int ) and ( standard_namepace >= 0 and standard_namepace <= self ._16bitshex ) )),
174
+ "Standard namespace is not 16bit enum or not Nullable " )
173
175
174
176
175
177
if __name__ == "__main__" :
0 commit comments