Revert clearing PDRs if host power is off

Code was added to clear the PDRs when the host was powered off, but the
next power on occ-control never saw the OCC StateSensor updates.
This change will be reverted to resolve this issue.

Tested on multiple machines with multiple reboots and guarded procs

Change-Id: Ibea28ede25c81f22e4e9fe2574c1668c4a81352c
Signed-off-by: Chris Cain <cjcain@us.ibm.com>
diff --git a/pldm.cpp b/pldm.cpp
index 1ce23f4..470312c 100644
--- a/pldm.cpp
+++ b/pldm.cpp
@@ -131,12 +131,6 @@
 
 void Interface::sensorEvent(sdbusplus::message::message& msg)
 {
-    if (!open_power::occ::utils::isHostRunning())
-    {
-        clearData();
-        return;
-    }
-
     if (!isOCCSensorCacheValid())
     {
         fetchSensorInfo(PLDM_STATE_SET_OPERATIONAL_RUNNING_STATUS,
@@ -243,6 +237,23 @@
     }
 }
 
+void Interface::hostStateEvent(sdbusplus::message::message& msg)
+{
+    std::map<std::string, std::variant<std::string>> properties{};
+    std::string interface;
+    msg.read(interface, properties);
+    const auto stateEntry = properties.find("CurrentHostState");
+    if (stateEntry != properties.end())
+    {
+        auto stateEntryValue = stateEntry->second;
+        auto propVal = std::get<std::string>(stateEntryValue);
+        if (propVal == "xyz.openbmc_project.State.Host.HostState.Off")
+        {
+            clearData();
+        }
+    }
+}
+
 void Interface::clearData()
 {
     if (!sensorToOCCInstance.empty())
@@ -874,8 +885,6 @@
                 "checkActiveSensor: Unable to find PLDM sensor for OCC{}",
                 instance)
                 .c_str());
-        // Clear cache to recollect the sensor ids
-        clearData();
     }
 }