Add power state check for HwmonTempSensor

We have some sensors that are on DC power, add the
check so this is configurable.

Tested: DC cycled, saw no logs

Change-Id: I0f2fc5c96c46d8c782f4bc364f649a9f2f699c3a
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/src/HwmonTempMain.cpp b/src/HwmonTempMain.cpp
index d26b2d6..55d4508 100644
--- a/src/HwmonTempMain.cpp
+++ b/src/HwmonTempMain.cpp
@@ -201,12 +201,20 @@
                     std::cerr << "error populating thresholds for "
                               << sensorName << "\n";
                 }
+                auto findPowerOn = baseConfiguration->second.find("PowerState");
+                PowerState readState = PowerState::always;
+                if (findPowerOn != baseConfiguration->second.end())
+                {
+                    std::string powerState = std::visit(
+                        VariantToStringVisitor(), findPowerOn->second);
+                    setReadState(powerState, readState);
+                }
                 auto& sensor = sensors[sensorName];
                 sensor = nullptr;
                 sensor = std::make_unique<HwmonTempSensor>(
                     directory.string() + "/temp1_input", sensorType,
                     objectServer, dbusConnection, io, sensorName,
-                    std::move(sensorThresholds), *interfacePath);
+                    std::move(sensorThresholds), *interfacePath, readState);
 
                 // Looking for keys like "Name1" for temp2_input,
                 // "Name2" for temp3_input, etc.
@@ -230,7 +238,7 @@
                             "_input",
                         sensorType, objectServer, dbusConnection, io,
                         sensorName, std::vector<thresholds::Threshold>(),
-                        *interfacePath);
+                        *interfacePath, readState);
                 }
             }
         }));