diff --git a/redfish-core/lib/power_supply.hpp b/redfish-core/lib/power_supply.hpp
index 190352a..4a766d3 100644
--- a/redfish-core/lib/power_supply.hpp
+++ b/redfish-core/lib/power_supply.hpp
@@ -18,25 +18,31 @@
 namespace redfish
 {
 
-inline void
-    updatePowerSupplyList(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
-                          const std::string& chassisId,
-                          const std::string& powerSupplyPath)
+static constexpr std::array<std::string_view, 1> powerSupplyInterface = {
+    "xyz.openbmc_project.Inventory.Item.PowerSupply"};
+
+inline void updatePowerSupplyList(
+    const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+    const std::string& chassisId,
+    const dbus::utility::MapperGetSubTreePathsResponse& powerSupplyPaths)
 {
-    std::string powerSupplyName =
-        sdbusplus::message::object_path(powerSupplyPath).filename();
-    if (powerSupplyName.empty())
-    {
-        return;
-    }
-
-    nlohmann::json item = nlohmann::json::object();
-    item["@odata.id"] = boost::urls::format(
-        "/redfish/v1/Chassis/{}/PowerSubsystem/PowerSupplies/{}", chassisId,
-        powerSupplyName);
-
     nlohmann::json& powerSupplyList = asyncResp->res.jsonValue["Members"];
-    powerSupplyList.emplace_back(std::move(item));
+    for (const std::string& powerSupplyPath : powerSupplyPaths)
+    {
+        std::string powerSupplyName =
+            sdbusplus::message::object_path(powerSupplyPath).filename();
+        if (powerSupplyName.empty())
+        {
+            continue;
+        }
+
+        nlohmann::json item = nlohmann::json::object();
+        item["@odata.id"] = boost::urls::format(
+            "/redfish/v1/Chassis/{}/PowerSubsystem/PowerSupplies/{}", chassisId,
+            powerSupplyName);
+
+        powerSupplyList.emplace_back(std::move(item));
+    }
     asyncResp->res.jsonValue["Members@odata.count"] = powerSupplyList.size();
 }
 
@@ -65,24 +71,24 @@
     asyncResp->res.jsonValue["Members@odata.count"] = 0;
 
     std::string powerPath = *validChassisPath + "/powered_by";
-    dbus::utility::getAssociationEndPoints(
-        powerPath, [asyncResp, chassisId](
-                       const boost::system::error_code& ec,
-                       const dbus::utility::MapperEndPoints& endpoints) {
-            if (ec)
+    dbus::utility::getAssociatedSubTreePaths(
+        powerPath,
+        sdbusplus::message::object_path("/xyz/openbmc_project/inventory"), 0,
+        powerSupplyInterface,
+        [asyncResp, chassisId](
+            const boost::system::error_code& ec,
+            const dbus::utility::MapperGetSubTreePathsResponse& subtreePaths) {
+        if (ec)
+        {
+            if (ec.value() != EBADR)
             {
-                if (ec.value() != EBADR)
-                {
-                    BMCWEB_LOG_ERROR << "DBUS response error" << ec.value();
-                    messages::internalError(asyncResp->res);
-                }
-                return;
+                BMCWEB_LOG_ERROR << "DBUS response error" << ec.value();
+                messages::internalError(asyncResp->res);
             }
+            return;
+        }
 
-            for (const auto& endpoint : endpoints)
-            {
-                updatePowerSupplyList(asyncResp, chassisId, endpoint);
-            }
+        updatePowerSupplyList(asyncResp, chassisId, subtreePaths);
         });
 }
 
@@ -154,42 +160,44 @@
     std::function<void(const std::string& powerSupplyPath)>&& callback)
 {
     std::string powerPath = validChassisPath + "/powered_by";
-    dbus::utility::getAssociationEndPoints(
-        powerPath, [asyncResp, powerSupplyId, callback{std::move(callback)}](
-                       const boost::system::error_code& ec,
-                       const dbus::utility::MapperEndPoints& endpoints) {
-            if (ec)
+    dbus::utility::getAssociatedSubTreePaths(
+        powerPath,
+        sdbusplus::message::object_path("/xyz/openbmc_project/inventory"), 0,
+        powerSupplyInterface,
+        [asyncResp, powerSupplyId, callback{std::move(callback)}](
+            const boost::system::error_code& ec,
+            const dbus::utility::MapperGetSubTreePathsResponse& subtreePaths) {
+        if (ec)
+        {
+            if (ec.value() != EBADR)
             {
-                if (ec.value() != EBADR)
-                {
-                    BMCWEB_LOG_ERROR
-                        << "DBUS response error for getAssociationEndPoints"
-                        << ec.value();
-                    messages::internalError(asyncResp->res);
-                    return;
-                }
-                messages::resourceNotFound(asyncResp->res, "PowerSupplies",
-                                           powerSupplyId);
+                BMCWEB_LOG_ERROR
+                    << "DBUS response error for getAssociatedSubTreePaths"
+                    << ec.value();
+                messages::internalError(asyncResp->res);
                 return;
             }
+            messages::resourceNotFound(asyncResp->res, "PowerSupplies",
+                                       powerSupplyId);
+            return;
+        }
 
-            for (const auto& endpoint : endpoints)
+        for (const std::string& path : subtreePaths)
+        {
+            if (checkPowerSupplyId(path, powerSupplyId))
             {
-                if (checkPowerSupplyId(endpoint, powerSupplyId))
-                {
-                    callback(endpoint);
-                    return;
-                }
-            }
-
-            if (!endpoints.empty())
-            {
-                BMCWEB_LOG_WARNING << "Power supply not found: "
-                                   << powerSupplyId;
-                messages::resourceNotFound(asyncResp->res, "PowerSupplies",
-                                           powerSupplyId);
+                callback(path);
                 return;
             }
+        }
+
+        if (!subtreePaths.empty())
+        {
+            BMCWEB_LOG_WARNING << "Power supply not found: " << powerSupplyId;
+            messages::resourceNotFound(asyncResp->res, "PowerSupplies",
+                                       powerSupplyId);
+            return;
+        }
         });
 }
 
@@ -387,10 +395,8 @@
         asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
         asyncResp->res.jsonValue["Status"]["Health"] = "OK";
 
-        constexpr std::array<std::string_view, 1> interfaces = {
-            "xyz.openbmc_project.Inventory.Item.PowerSupply"};
         dbus::utility::getDbusObject(
-            powerSupplyPath, interfaces,
+            powerSupplyPath, powerSupplyInterface,
             [asyncResp,
              powerSupplyPath](const boost::system::error_code& ec,
                               const dbus::utility::MapperGetObject& object) {
