@@ -29,29 +29,43 @@ async def read_ts_attribute_expect_success(self, endpoint, attribute):
29
29
cluster = Clusters .Objects .TimeSynchronization
30
30
return await self .read_single_attribute_check_success (endpoint = endpoint , cluster = cluster , attribute = attribute )
31
31
32
+ def pics_TC_TIMESYNC_2_1 (self ) -> list [str ]:
33
+ return ["TIMESYNC.S" ]
34
+
32
35
@async_test_body
33
36
async def test_TC_TIMESYNC_2_1 (self ):
34
- endpoint = self . user_params . get ( "endpoint" , 0 )
37
+ endpoint = 0
35
38
36
39
features = await self .read_single_attribute (dev_ctrl = self .default_controller , node_id = self .dut_node_id ,
37
40
endpoint = endpoint , attribute = Clusters .TimeSynchronization .Attributes .FeatureMap )
41
+
38
42
self .supports_time_zone = bool (features & Clusters .TimeSynchronization .Bitmaps .Feature .kTimeZone )
39
43
self .supports_ntpc = bool (features & Clusters .TimeSynchronization .Bitmaps .Feature .kNTPClient )
40
44
self .supports_ntps = bool (features & Clusters .TimeSynchronization .Bitmaps .Feature .kNTPServer )
41
45
self .supports_trusted_time_source = bool (features & Clusters .TimeSynchronization .Bitmaps .Feature .kTimeSyncClient )
46
+ timesource_attr_id = Clusters .Objects .TimeSynchronization .Attributes .TimeSource .attribute_id
47
+
48
+ # Reading attributes from DUT
49
+ timesync_attr_list = Clusters .Objects .TimeSynchronization .Attributes .AttributeList
50
+ read_request = await self .default_controller .ReadAttribute (self .dut_node_id , [timesync_attr_list ])
51
+ attributes_list = read_request [0 ]
52
+
53
+ # Extracting gathered attributes dictionary values into a list containing only supported attribute ids
54
+ attribute_list_confined = list ([values for values in attributes_list [list (attributes_list .keys ())[0 ]].values ()])[1 ]
42
55
43
56
self .print_step (1 , "Commissioning, already done" )
44
57
attributes = Clusters .TimeSynchronization .Attributes
45
-
58
+
46
59
self .print_step (2 , "Read Granularity attribute" )
47
60
granularity_dut = await self .read_ts_attribute_expect_success (endpoint = endpoint , attribute = attributes .Granularity )
48
61
asserts .assert_less (granularity_dut , Clusters .TimeSynchronization .Enums .GranularityEnum .kUnknownEnumValue ,
49
62
"Granularity is not in valid range" )
50
63
51
64
self .print_step (3 , "Read TimeSource" )
52
- time_source = await self .read_ts_attribute_expect_success (endpoint = endpoint , attribute = attributes .TimeSource )
53
- asserts .assert_less (time_source , Clusters .TimeSynchronization .Enums .TimeSourceEnum .kUnknownEnumValue ,
54
- "TimeSource is not in valid range" )
65
+ if timesource_attr_id in attribute_list_confined :
66
+ time_source = await self .read_ts_attribute_expect_success (endpoint = endpoint , attribute = attributes .TimeSource )
67
+ asserts .assert_less (time_source , Clusters .TimeSynchronization .Enums .TimeSourceEnum .kUnknownEnumValue ,
68
+ "TimeSource is not in valid range" )
55
69
56
70
self .print_step (4 , "Read TrustedTimeSource" )
57
71
if self .supports_trusted_time_source :
0 commit comments