diff --git a/src/python_testing/TC_PWRTL_2_1.py b/src/python_testing/TC_PWRTL_2_1.py
index 3de09c6..9d4b3de 100644
--- a/src/python_testing/TC_PWRTL_2_1.py
+++ b/src/python_testing/TC_PWRTL_2_1.py
@@ -53,30 +53,43 @@
 
         endpoint = self.user_params.get("endpoint", 1)
 
+        powertop_attr_list = Clusters.Objects.PowerTopology.Attributes.AttributeList
+        powertop_cluster = Clusters.Objects.PowerTopology
+        attribute_list = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=powertop_cluster, attribute=powertop_attr_list)
+        avail_endpoints_attr_id = Clusters.Objects.PowerTopology.Attributes.ActiveEndpoints.attribute_id
+        act_endpoints_attr_id = Clusters.Objects.PowerTopology.Attributes.AvailableEndpoints.attribute_id
+
         self.print_step(1, "Commissioning, already done")
 
-        if not self.check_pics("PWRTL.S.A0000"):
-            logging.info("Test skipped because PICS PWRTL.S.A0000 is not set")
-            return
-
         self.print_step(2, "Read AvailableAttributes attribute")
-        available_endpoints = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=Clusters.Objects.PowerTopology, attribute=attributes.AvailableEndpoints)
+        if avail_endpoints_attr_id in attribute_list:
+            available_endpoints = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=Clusters.Objects.PowerTopology, attribute=attributes.AvailableEndpoints)
 
-        asserts.assert_less_equal(len(available_endpoints), 20,
-                                  "AvailableEndpoints length %d must be less than 21!" % len(available_endpoints))
+            if available_endpoints == []:
+                logging.info("AvailableEndpoints is an empty list")
+            else:
+                logging.info("AvailableEndpoints: %s" % (available_endpoints))
+                asserts.assert_less_equal(len(available_endpoints), 20,
+                                          "AvailableEndpoints length %d must be less than 21!" % len(available_endpoints))
 
-        if not self.check_pics("PWRTL.S.A0001"):
-            logging.info("Test skipped because PICS PWRTL.S.A0001 is not set")
-            return
+        else:
+            self.mark_current_step_skipped()
 
         self.print_step(3, "Read ActiveEndpoints attribute")
-        active_endpoints = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=Clusters.Objects.PowerTopology,  attribute=attributes.ActiveEndpoints)
-        logging.info("ActiveEndpoints: %s" % (active_endpoints))
-        asserts.assert_less_equal(len(active_endpoints), 20,
-                                  "ActiveEndpoints length %d must be less than 21!" % len(active_endpoints))
-        # Verify that ActiveEndpoints is a subset of AvailableEndpoints
-        asserts.assert_true(set(active_endpoints).issubset(set(available_endpoints)),
-                            "ActiveEndpoints should be a subset of AvailableEndpoints")
+
+        if act_endpoints_attr_id in attribute_list:
+            active_endpoints = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=Clusters.Objects.PowerTopology,  attribute=attributes.ActiveEndpoints)
+            logging.info("ActiveEndpoints: %s" % (active_endpoints))
+            asserts.assert_less_equal(len(active_endpoints), 20,
+                                      "ActiveEndpoints length %d must be less than 21!" % len(active_endpoints))
+
+            if available_endpoints == []:
+                # Verify that ActiveEndpoints is a subset of AvailableEndpoints
+                asserts.assert_true(set(active_endpoints).issubset(set(available_endpoints)),
+                                    "ActiveEndpoints should be a subset of AvailableEndpoints")
+
+        else:
+            self.mark_current_step_skipped()
 
 
 if __name__ == "__main__":
