Change power control match to use host state

Lower level signals were removed, use host state instead.
Also fix bug that was introduced, std::abs(nan, number)
returns nan, so checkThresholds wasn't being called.

Tested: Put in prints and saw power/post state change to on

Change-Id: I98df270237900c3a0b01c03ec7905851bc47e3b3
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/include/IpmbSensor.hpp b/include/IpmbSensor.hpp
index 1775c13..56e8b2f 100644
--- a/include/IpmbSensor.hpp
+++ b/include/IpmbSensor.hpp
@@ -41,7 +41,7 @@
     std::vector<uint8_t> initData;
 
     // to date all ipmb sensors are power on only
-    PowerState readState = PowerState::on;
+    PowerState readState;
 
   private:
     sdbusplus::asio::object_server& objectServer;
diff --git a/include/Utils.hpp b/include/Utils.hpp
index f3abc7f..4f595c9 100644
--- a/include/Utils.hpp
+++ b/include/Utils.hpp
@@ -78,6 +78,23 @@
 constexpr const char* get = "Get";
 } // namespace properties
 
+namespace power
+{
+const static constexpr char* busname = "xyz.openbmc_project.State.Host";
+const static constexpr char* interface = "xyz.openbmc_project.State.Host";
+const static constexpr char* path = "/xyz/openbmc_project/state/host0";
+const static constexpr char* property = "CurrentHostState";
+} // namespace power
+namespace post
+{
+const static constexpr char* busname =
+    "xyz.openbmc_project.State.OperatingSystem";
+const static constexpr char* interface =
+    "xyz.openbmc_project.State.OperatingSystem.Status";
+const static constexpr char* path = "/xyz/openbmc_project/state/os";
+const static constexpr char* property = "OperatingSystemState";
+} // namespace post
+
 template <typename T>
 inline T loadVariant(
     const boost::container::flat_map<std::string, BasicVariantType>& data,
@@ -103,7 +120,7 @@
     }
     else
     {
-        static_assert("Type Not Implemented");
+        static_assert(!std::is_same_v<T, T>, "Type Not Implemented");
     }
 }
 
diff --git a/include/sensor.hpp b/include/sensor.hpp
index 3ff37f7..57b9987 100644
--- a/include/sensor.hpp
+++ b/include/sensor.hpp
@@ -146,7 +146,8 @@
             internalSet = true;
             sensorInterface->set_property("Value", newValue);
             internalSet = false;
-            if (std::abs(value - newValue) > hysteresis)
+            double diff = std::abs(value - newValue);
+            if (std::isnan(diff) || diff > hysteresis)
             {
                 value = newValue;
                 checkThresholds();