@@ -110,7 +110,7 @@ async def setup_test(self):
110110 [(self .endpoint , Clusters .Descriptor .Attributes .ServerList )]
111111 )
112112 self .logger .info (f"Device supported clusters on endpoint { self .endpoint } : { descriptor } " )
113-
113+
114114 # Extract the server list from the nested structure
115115 server_list = None
116116 for endpoint_data in descriptor .values ():
@@ -141,7 +141,7 @@ async def test_TC_CC_6_5(self):
141141 cluster = Clusters .Objects .ColorControl
142142 attributes = cluster .Attributes
143143 self .logger .info (f"Starting test with endpoint { self .endpoint } " )
144-
144+
145145 # commissioning - already done
146146 self .step ("0" )
147147
@@ -155,7 +155,7 @@ async def test_TC_CC_6_5(self):
155155 except Exception as e :
156156 self .logger .error (f"Failed to write Options attribute: { e } " )
157157 raise
158-
158+
159159 self .step ("0b" )
160160 self .logger .info (f"Sending MoveToColorTemperature command to endpoint { self .endpoint } " )
161161 try :
@@ -236,14 +236,16 @@ def extract_attribute_value(response, endpoint, attribute_class):
236236 self .dut_node_id , [(self .endpoint , attributes .StartUpColorTemperatureMireds )]
237237 )
238238 self .logger .info (f"Startup color temperature response: { startup_color_temp } " )
239- startup_color_temp_value = extract_attribute_value (startup_color_temp , self .endpoint , attributes .StartUpColorTemperatureMireds )
239+ startup_color_temp_value = extract_attribute_value (
240+ startup_color_temp , self .endpoint , attributes .StartUpColorTemperatureMireds )
240241 self .logger .info (f"Extracted startup color temperature value: { startup_color_temp_value } " )
241242 if startup_color_temp_value is not None :
242- asserts .assert_true (isinstance (startup_color_temp_value , int ), "Startup color temperature value should be an integer" )
243- asserts .assert_greater_equal (startup_color_temp_value , MIN_STARTUP_COLOR_TEMP ,
244- f"Startup color temperature { startup_color_temp_value } should be >= { MIN_STARTUP_COLOR_TEMP } " )
243+ asserts .assert_true (isinstance (startup_color_temp_value , int ),
244+ "Startup color temperature value should be an integer" )
245+ asserts .assert_greater_equal (startup_color_temp_value , MIN_STARTUP_COLOR_TEMP ,
246+ f"Startup color temperature { startup_color_temp_value } should be >= { MIN_STARTUP_COLOR_TEMP } " )
245247 asserts .assert_less_equal (startup_color_temp_value , MAX_STARTUP_COLOR_TEMP ,
246- f"Startup color temperature { startup_color_temp_value } should be <= { MAX_STARTUP_COLOR_TEMP } " )
248+ f"Startup color temperature { startup_color_temp_value } should be <= { MAX_STARTUP_COLOR_TEMP } " )
247249 except Exception as e :
248250 self .logger .error (f"Failed to read StartUpColorTemperatureMireds: { e } " )
249251 raise
@@ -258,12 +260,12 @@ def extract_attribute_value(response, endpoint, attribute_class):
258260 target_color_temp = MIN_STARTUP_COLOR_TEMP
259261 elif target_color_temp > MAX_STARTUP_COLOR_TEMP :
260262 target_color_temp = MAX_STARTUP_COLOR_TEMP
261-
263+
262264 self .logger .info (f"Writing StartUpColorTemperatureMireds with value { target_color_temp } " )
263-
265+
264266 # Add a small delay before writing
265267 await asyncio .sleep (0.3 )
266-
268+
267269 # Try to reset the session before writing
268270 try :
269271 # First try to close any existing session
@@ -274,7 +276,7 @@ def extract_attribute_value(response, endpoint, attribute_class):
274276 self .logger .info ("Successfully established new session" )
275277 except Exception as e :
276278 self .logger .warning (f"Failed to reset session: { e } " )
277-
279+
278280 # Try to write the attribute with a simpler format
279281 try :
280282 # First attempt: Write with minimal parameters
@@ -291,16 +293,16 @@ def extract_attribute_value(response, endpoint, attribute_class):
291293 self .dut_node_id ,
292294 [(self .endpoint , attributes .StartUpColorTemperatureMireds , target_color_temp )]
293295 )
294-
296+
295297 self .logger .info (f"Write StartUpColorTemperatureMireds response: { response } " )
296-
298+
297299 # Check if the write was successful
298300 if hasattr (response , 'status' ):
299301 asserts .assert_equal (response .status , Status .Success , "Write operation should succeed" )
300302 else :
301303 self .logger .error (f"Unexpected response format: { response } " )
302304 raise Exception ("Write operation failed: unexpected response format" )
303-
305+
304306 except Exception as e :
305307 self .logger .error (f"Failed to write StartUpColorTemperatureMireds: { e } " )
306308 raise
@@ -336,9 +338,11 @@ def extract_attribute_value(response, endpoint, attribute_class):
336338 self .dut_node_id , [(self .endpoint , attributes .StartUpColorTemperatureMireds )]
337339 )
338340 self .logger .info (f"Post cycle startup response: { post_cycle_startup } " )
339- post_cycle_startup_value = extract_attribute_value (post_cycle_startup , self .endpoint , attributes .StartUpColorTemperatureMireds )
341+ post_cycle_startup_value = extract_attribute_value (
342+ post_cycle_startup , self .endpoint , attributes .StartUpColorTemperatureMireds )
340343 self .logger .info (f"Extracted post cycle startup value: { post_cycle_startup_value } " )
341- asserts .assert_equal (post_cycle_startup_value , target_color_temp , "Post cycle startup color temperature should match target value" )
344+ asserts .assert_equal (post_cycle_startup_value , target_color_temp ,
345+ "Post cycle startup color temperature should match target value" )
342346 except Exception as e :
343347 self .logger .error (f"Failed to read post cycle StartUpColorTemperatureMireds: { e } " )
344348 raise
@@ -351,7 +355,8 @@ def extract_attribute_value(response, endpoint, attribute_class):
351355 self .logger .info (f"Post cycle color response: { post_cycle_color } " )
352356 post_cycle_color_value = extract_attribute_value (post_cycle_color , self .endpoint , attributes .ColorTemperatureMireds )
353357 self .logger .info (f"Extracted post cycle color value: { post_cycle_color_value } " )
354- asserts .assert_equal (post_cycle_color_value , target_color_temp , "Post cycle color temperature should match target value" )
358+ asserts .assert_equal (post_cycle_color_value , target_color_temp ,
359+ "Post cycle color temperature should match target value" )
355360 except Exception as e :
356361 self .logger .error (f"Failed to read post cycle ColorTemperatureMireds: { e } " )
357362 raise
0 commit comments