diff --git a/include/ADCSensor.hpp b/include/ADCSensor.hpp
index d4ad601..71b92da 100644
--- a/include/ADCSensor.hpp
+++ b/include/ADCSensor.hpp
@@ -78,10 +78,8 @@
     boost::asio::deadline_timer waitTimer;
     std::shared_ptr<boost::asio::streambuf> readBuf;
     std::string path;
-    size_t errCount;
     double scaleFactor;
     std::optional<BridgeGpio> bridgeGpio;
-    PowerState readState;
     thresholds::ThresholdTimer thresholdTimer;
     void handleResponse(const boost::system::error_code& err);
     void checkThresholds(void) override;
diff --git a/include/CPUSensor.hpp b/include/CPUSensor.hpp
index 29cd54a..4cad880 100644
--- a/include/CPUSensor.hpp
+++ b/include/CPUSensor.hpp
@@ -44,7 +44,6 @@
     double privTcontrol;
     double dtsOffset;
     bool show;
-    size_t errCount;
     void setupRead(void);
     void handleResponse(const boost::system::error_code& err);
     void checkThresholds(void) override;
diff --git a/include/HwmonTempSensor.hpp b/include/HwmonTempSensor.hpp
index 7da2a4d..a35cb90 100644
--- a/include/HwmonTempSensor.hpp
+++ b/include/HwmonTempSensor.hpp
@@ -29,7 +29,6 @@
     boost::asio::deadline_timer waitTimer;
     boost::asio::streambuf readBuf;
     std::string path;
-    PowerState readState;
     size_t errCount;
 
     void handleResponse(const boost::system::error_code& err);
diff --git a/include/IpmbSensor.hpp b/include/IpmbSensor.hpp
index 3d78bfa..e1b1ddb 100644
--- a/include/IpmbSensor.hpp
+++ b/include/IpmbSensor.hpp
@@ -52,8 +52,7 @@
     void init(void);
     void loadDefaults(void);
     void runInitCmd(void);
-    void processError(void);
-    double processReading(const std::vector<uint8_t>& data);
+    bool processReading(const std::vector<uint8_t>& data, double& resp);
 
     IpmbType type;
     IpmbSubType subType;
@@ -68,8 +67,6 @@
     std::optional<uint8_t> initCommand;
     std::vector<uint8_t> initData;
 
-    // to date all ipmb sensors are power on only
-    PowerState readState;
     ReadingFormat readingFormat;
 
   private:
diff --git a/include/NVMeSensor.hpp b/include/NVMeSensor.hpp
index ec0bfd1..132ef29 100644
--- a/include/NVMeSensor.hpp
+++ b/include/NVMeSensor.hpp
@@ -18,7 +18,6 @@
 
     NVMeSensor& operator=(const NVMeSensor& other) = delete;
 
-    size_t errorCount;
     int bus;
 
   private:
diff --git a/include/sensor.hpp b/include/sensor.hpp
index 21878f3..982365a 100644
--- a/include/sensor.hpp
+++ b/include/sensor.hpp
@@ -1,6 +1,7 @@
 #pragma once
 
 #include "Thresholds.hpp"
+#include "Utils.hpp"
 
 #include <sdbusplus/asio/object_server.hpp>
 
@@ -14,17 +15,23 @@
 constexpr const char* sensorValueInterface = "xyz.openbmc_project.Sensor.Value";
 constexpr const char* availableInterfaceName =
     "xyz.openbmc_project.State.Decorator.Availability";
+constexpr const char* operationalInterfaceName =
+    "xyz.openbmc_project.State.Decorator.OperationalStatus";
+constexpr const size_t errorThreshold = 5;
+
 struct Sensor
 {
     Sensor(const std::string& name,
            std::vector<thresholds::Threshold>&& thresholdData,
            const std::string& configurationPath, const std::string& objectType,
-           const double max, const double min) :
+           const double max, const double min,
+           PowerState readState = PowerState::always) :
         name(std::regex_replace(name, std::regex("[^a-zA-Z0-9_/]+"), "_")),
         configurationPath(configurationPath), objectType(objectType),
         maxValue(max), minValue(min), thresholds(std::move(thresholdData)),
         hysteresisTrigger((max - min) * 0.01),
-        hysteresisPublish((max - min) * 0.0001)
+        hysteresisPublish((max - min) * 0.0001), readState(readState),
+        errCount(0)
     {}
     virtual ~Sensor() = default;
     virtual void checkThresholds(void) = 0;
@@ -39,12 +46,14 @@
     std::shared_ptr<sdbusplus::asio::dbus_interface> thresholdInterfaceCritical;
     std::shared_ptr<sdbusplus::asio::dbus_interface> association;
     std::shared_ptr<sdbusplus::asio::dbus_interface> availableInterface;
+    std::shared_ptr<sdbusplus::asio::dbus_interface> operationalInterface;
     double value = std::numeric_limits<double>::quiet_NaN();
     bool overriddenState = false;
     bool internalSet = false;
-    bool available = true;
     double hysteresisTrigger;
     double hysteresisPublish;
+    PowerState readState;
+    size_t errCount;
 
     int setSensorValue(const double& newValue, double& oldValue)
     {
@@ -68,6 +77,11 @@
                              const std::string label = std::string(),
                              size_t thresholdSize = 0)
     {
+        if (readState == PowerState::on || readState == PowerState::biosPost)
+        {
+            setupPowerMatch(conn);
+        }
+
         createAssociation(association, configurationPath);
 
         sensorInterface->register_property("MaxValue", maxValue);
@@ -172,26 +186,101 @@
                     {
                         return 1;
                     }
+                    old = propIn;
                     if (!propIn)
                     {
                         updateValue(std::numeric_limits<double>::quiet_NaN());
                     }
-                    old = propIn;
-                    available = propIn;
                     return 1;
                 });
             availableInterface->initialize();
         }
+        if (!operationalInterface)
+        {
+            operationalInterface =
+                std::make_shared<sdbusplus::asio::dbus_interface>(
+                    conn, sensorInterface->get_object_path(),
+                    operationalInterfaceName);
+            operationalInterface->register_property("Functional", true);
+            operationalInterface->initialize();
+        }
+    }
+
+    bool readingStateGood()
+    {
+        if (readState == PowerState::on && !isPowerOn())
+        {
+            return false;
+        }
+        if (readState == PowerState::biosPost &&
+            (!hasBiosPost() || !isPowerOn()))
+        {
+            return false;
+        }
+
+        return true;
+    }
+
+    void markFunctional(bool isFunctional)
+    {
+        if (operationalInterface)
+        {
+            operationalInterface->set_property("Functional", isFunctional);
+        }
+        if (isFunctional)
+        {
+            errCount = 0;
+        }
+        else
+        {
+            updateValue(std::numeric_limits<double>::quiet_NaN());
+        }
+    }
+
+    void markAvailable(bool isAvailable)
+    {
+        if (availableInterface)
+        {
+            availableInterface->set_property("Available", isAvailable);
+            errCount = 0;
+        }
+    }
+
+    void incrementError()
+    {
+        if (!readingStateGood())
+        {
+            markAvailable(false);
+            return;
+        }
+
+        if (errCount >= errorThreshold)
+        {
+            return;
+        }
+
+        errCount++;
+        if (errCount == errorThreshold)
+        {
+            std::cerr << "Sensor " << name << " reading error!\n";
+            markFunctional(false);
+        }
     }
 
     void updateValue(const double& newValue)
     {
         // Ignore if overriding is enabled
-        if (overriddenState || !available)
+        if (overriddenState)
         {
             return;
         }
 
+        if (!readingStateGood())
+        {
+            markAvailable(false);
+            return;
+        }
+
         // Indicate that it is internal set call
         internalSet = true;
         updateProperty(sensorInterface, value, newValue, "Value");
@@ -203,6 +292,11 @@
         // which is called by checkThresholds() below,
         // in all current implementations of sensors that have thresholds.
         checkThresholds();
+        if (!std::isnan(newValue))
+        {
+            markFunctional(true);
+            markAvailable(true);
+        }
     }
 
     void updateProperty(
diff --git a/src/ADCSensor.cpp b/src/ADCSensor.cpp
index bfe17ac..20e8041 100644
--- a/src/ADCSensor.cpp
+++ b/src/ADCSensor.cpp
@@ -54,11 +54,12 @@
                      std::optional<BridgeGpio>&& bridgeGpio) :
     Sensor(boost::replace_all_copy(sensorName, " ", "_"),
            std::move(_thresholds), sensorConfiguration,
-           "xyz.openbmc_project.Configuration.ADC", maxReading, minReading),
+           "xyz.openbmc_project.Configuration.ADC", maxReading, minReading,
+           readState),
     std::enable_shared_from_this<ADCSensor>(), objServer(objectServer),
     inputDev(io, open(path.c_str(), O_RDONLY)), waitTimer(io), path(path),
-    errCount(0), scaleFactor(scaleFactor), bridgeGpio(std::move(bridgeGpio)),
-    readState(std::move(readState)), thresholdTimer(io, this)
+    scaleFactor(scaleFactor), bridgeGpio(std::move(bridgeGpio)),
+    thresholdTimer(io, this)
 {
     sensorInterface = objectServer.add_interface(
         "/xyz/openbmc_project/sensors/voltage/" + name,
@@ -78,9 +79,6 @@
     association = objectServer.add_interface(
         "/xyz/openbmc_project/sensors/voltage/" + name, association::interface);
     setInitialProperties(conn);
-
-    // setup match
-    setupPowerMatch(conn);
 }
 
 ADCSensor::~ADCSensor()
@@ -174,32 +172,15 @@
             nvalue = std::round(nvalue * roundFactor) / roundFactor;
 
             updateValue(nvalue);
-            errCount = 0;
         }
         catch (std::invalid_argument&)
         {
-            errCount++;
+            incrementError();
         }
     }
-    else if (readState == PowerState::on && !isPowerOn())
-    {
-        errCount = 0;
-        updateValue(std::numeric_limits<double>::quiet_NaN());
-    }
     else
     {
-        errCount++;
-    }
-    // only print once
-    if (errCount == warnAfterErrorCount)
-    {
-        std::cerr << "Failure to read sensor " << name << " at " << path
-                  << " ec:" << err << "\n";
-    }
-
-    if (errCount >= warnAfterErrorCount)
-    {
-        updateValue(0);
+        incrementError();
     }
 
     responseStream.clear();
@@ -231,7 +212,7 @@
 
 void ADCSensor::checkThresholds(void)
 {
-    if (readState == PowerState::on && !isPowerOn())
+    if (!readingStateGood())
     {
         return;
     }
diff --git a/src/CPUSensor.cpp b/src/CPUSensor.cpp
index afc4706..bf2b6aa 100644
--- a/src/CPUSensor.cpp
+++ b/src/CPUSensor.cpp
@@ -43,11 +43,11 @@
                      bool show, double dtsOffset) :
     Sensor(boost::replace_all_copy(sensorName, " ", "_"),
            std::move(_thresholds), sensorConfiguration, objectType, maxReading,
-           minReading),
+           minReading, PowerState::on),
     objServer(objectServer), inputDev(io, open(path.c_str(), O_RDONLY)),
     waitTimer(io), path(path),
     privTcontrol(std::numeric_limits<double>::quiet_NaN()),
-    dtsOffset(dtsOffset), show(show), errCount(0)
+    dtsOffset(dtsOffset), show(show)
 {
     nameTcontrol = labelTcontrol;
     nameTcontrol += " CPU" + std::to_string(cpuId);
@@ -87,6 +87,8 @@
             setInitialProperties(conn);
         }
     }
+
+    // call setup always as not all sensors call setInitialProperties
     setupPowerMatch(conn);
     setupRead();
 }
@@ -223,52 +225,16 @@
                     }
                 }
             }
-            errCount = 0;
         }
         catch (const std::invalid_argument&)
         {
-            errCount++;
+            incrementError();
         }
     }
     else
     {
         pollTime = sensorFailedPollTimeMs;
-        errCount++;
-    }
-
-    if (errCount >= warnAfterErrorCount)
-    {
-        // only an error if power is on
-        if (isPowerOn())
-        {
-            // only print once
-            if (errCount == warnAfterErrorCount)
-            {
-                std::cerr << "Failure to read sensor " << name << " at " << path
-                          << "\n";
-            }
-            if (show)
-            {
-                updateValue(0);
-            }
-            else
-            {
-                value = 0;
-            }
-            errCount++;
-        }
-        else
-        {
-            errCount = 0; // check power again in 10 cycles
-            if (show)
-            {
-                updateValue(std::numeric_limits<double>::quiet_NaN());
-            }
-            else
-            {
-                value = std::numeric_limits<double>::quiet_NaN();
-            }
-        }
+        incrementError();
     }
 
     responseStream.clear();
diff --git a/src/ExitAirTempSensor.cpp b/src/ExitAirTempSensor.cpp
index 70c7bae..7197c4a 100644
--- a/src/ExitAirTempSensor.cpp
+++ b/src/ExitAirTempSensor.cpp
@@ -166,7 +166,7 @@
     Sensor(boost::replace_all_copy(sensorName, " ", "_"),
            std::move(thresholdData), sensorConfiguration,
            "xyz.openbmc_project.Configuration.ExitAirTemp", cfmMaxReading,
-           cfmMinReading),
+           cfmMinReading, PowerState::on),
     std::enable_shared_from_this<CFMSensor>(), parent(parent),
     dbusConnection(conn), objServer(objectServer)
 {
@@ -494,7 +494,7 @@
     Sensor(boost::replace_all_copy(sensorName, " ", "_"),
            std::move(thresholdData), sensorConfiguration,
            "xyz.openbmc_project.Configuration.ExitAirTemp", exitAirMaxReading,
-           exitAirMinReading),
+           exitAirMinReading, PowerState::on),
     std::enable_shared_from_this<ExitAirTempSensor>(), dbusConnection(conn),
     objServer(objectServer)
 {
@@ -518,7 +518,6 @@
         "/xyz/openbmc_project/sensors/temperature/" + name,
         association::interface);
     setInitialProperties(conn);
-    setupPowerMatch(conn);
 }
 
 ExitAirTempSensor::~ExitAirTempSensor()
diff --git a/src/HwmonTempSensor.cpp b/src/HwmonTempSensor.cpp
index 71ff4ed..38bc96b 100644
--- a/src/HwmonTempSensor.cpp
+++ b/src/HwmonTempSensor.cpp
@@ -47,10 +47,9 @@
     const std::string& sensorConfiguration, const PowerState powerState) :
     Sensor(boost::replace_all_copy(sensorName, " ", "_"),
            std::move(_thresholds), sensorConfiguration, objectType, maxReading,
-           minReading),
+           minReading, powerState),
     std::enable_shared_from_this<HwmonTempSensor>(), objServer(objectServer),
-    inputDev(io, open(path.c_str(), O_RDONLY)), waitTimer(io), path(path),
-    errCount(0), readState(powerState)
+    inputDev(io, open(path.c_str(), O_RDONLY)), waitTimer(io), path(path)
 {
     sensorInterface = objectServer.add_interface(
         "/xyz/openbmc_project/sensors/temperature/" + name,
@@ -72,7 +71,6 @@
         "/xyz/openbmc_project/sensors/temperature/" + name,
         association::interface);
     setInitialProperties(conn);
-    setupPowerMatch(conn);
 }
 
 HwmonTempSensor::~HwmonTempSensor()
@@ -119,34 +117,17 @@
             double nvalue = std::stod(response);
             nvalue /= sensorScaleFactor;
             updateValue(nvalue);
-            errCount = 0;
         }
         catch (const std::invalid_argument&)
         {
-            errCount++;
+            incrementError();
         }
     }
-    else if (readState == PowerState::on && !isPowerOn())
-    {
-        errCount = 0;
-        updateValue(std::numeric_limits<double>::quiet_NaN());
-    }
     else
     {
-        errCount++;
+        incrementError();
     }
 
-    // only print once
-    if (errCount == warnAfterErrorCount)
-    {
-        std::cerr << "Failure to read sensor " << name << " at " << path
-                  << " ec:" << err << "\n";
-    }
-
-    if (errCount >= warnAfterErrorCount)
-    {
-        updateValue(0);
-    }
     responseStream.clear();
     inputDev.close();
     int fd = open(path.c_str(), O_RDONLY);
@@ -172,9 +153,5 @@
 
 void HwmonTempSensor::checkThresholds(void)
 {
-    if (readState == PowerState::on && !isPowerOn())
-    {
-        return;
-    }
     thresholds::checkThresholds(this);
 }
diff --git a/src/IpmbSensor.cpp b/src/IpmbSensor.cpp
index f36e836..d8b0d4f 100644
--- a/src/IpmbSensor.cpp
+++ b/src/IpmbSensor.cpp
@@ -69,9 +69,9 @@
     Sensor(boost::replace_all_copy(sensorName, " ", "_"),
            std::move(thresholdData), sensorConfiguration,
            "xyz.openbmc_project.Configuration.ExitAirTemp", ipmbMaxReading,
-           ipmbMinReading),
-    deviceAddress(deviceAddress), readState(PowerState::on),
-    objectServer(objectServer), dbusConnection(conn), waitTimer(io)
+           ipmbMinReading, PowerState::on),
+    deviceAddress(deviceAddress), objectServer(objectServer),
+    dbusConnection(conn), waitTimer(io)
 {
     std::string dbusPath = sensorPathPrefix + sensorTypeName + "/" + name;
 
@@ -89,7 +89,6 @@
             dbusPath, "xyz.openbmc_project.Sensor.Threshold.Critical");
     }
     association = objectServer.add_interface(dbusPath, association::interface);
-    setupPowerMatch(conn);
 }
 
 IpmbSensor::~IpmbSensor()
@@ -226,68 +225,55 @@
 
 void IpmbSensor::checkThresholds(void)
 {
-    if (readState == PowerState::on && !isPowerOn())
-    {
-        return;
-    }
-    else if (readState == PowerState::biosPost && !hasBiosPost())
-    {
-        return;
-    }
     thresholds::checkThresholds(this);
 }
 
-void IpmbSensor::processError(void)
-{
-    static constexpr size_t errorFilter = 2;
-
-    if (!errorCount)
-    {
-        std::cerr << "Invalid data from device: " << name << "\n";
-    }
-    else if (errorCount > errorFilter)
-    {
-        updateValue(0);
-    }
-    if (errorCount < std::numeric_limits<uint8_t>::max())
-    {
-        errorCount++;
-    }
-}
-
-double IpmbSensor::processReading(const std::vector<uint8_t>& data)
+bool IpmbSensor::processReading(const std::vector<uint8_t>& data, double& resp)
 {
 
     switch (readingFormat)
     {
         case (ReadingFormat::byte0):
-            return data[0];
+            resp = data[0];
+            return true;
         case (ReadingFormat::byte3):
             if (data.size() < 4)
             {
-                std::cerr << "Invalid data length returned for " << name
-                          << "\n";
-                return 0;
+                if (!errCount)
+                {
+                    std::cerr << "Invalid data length returned for " << name
+                              << "\n";
+                }
+                return false;
             }
-            return data[3];
+            resp = data[3];
+            return true;
         case (ReadingFormat::elevenBit):
             if (data.size() < 5)
             {
-                std::cerr << "Invalid data length returned for " << name
-                          << "\n";
-                return 0;
+                if (!errCount)
+                {
+                    std::cerr << "Invalid data length returned for " << name
+                              << "\n";
+                }
+                return false;
             }
 
-            return ((data[4] << 8) | data[3]);
+            resp = ((data[4] << 8) | data[3]);
+            return true;
         case (ReadingFormat::elevenBitShift):
             if (data.size() < 5)
             {
-                std::cerr << "Invalid data length returned for " << name
-                          << "\n";
-                return 0;
+                if (!errCount)
+                {
+                    std::cerr << "Invalid data length returned for " << name
+                              << "\n";
+                }
+                return false;
             }
 
-            return ((data[4] << 8) | data[3]) >> 3;
+            resp = ((data[4] << 8) | data[3]) >> 3;
+            return true;
         default:
             throw std::runtime_error("Invalid reading type");
     }
@@ -305,7 +291,6 @@
         }
         if (!isPowerOn() && readState != PowerState::always)
         {
-            updateValue(0);
             read();
             return;
         }
@@ -315,14 +300,7 @@
                 const int& status = std::get<0>(response);
                 if (ec || status)
                 {
-                    processError();
-                    updateValue(0);
-                    read();
-                    return;
-                }
-                if (!isPowerOn() && readState != PowerState::always)
-                {
-                    updateValue(0);
+                    incrementError();
                     read();
                     return;
                 }
@@ -338,17 +316,24 @@
                 }
                 if (data.empty())
                 {
-                    processError();
+                    incrementError();
                     read();
                     return;
                 }
-                double value = processReading(data);
+
+                double value = 0;
+
+                if (!processReading(data, value))
+                {
+                    incrementError();
+                    read();
+                    return;
+                }
 
                 /* Adjust value as per scale and offset */
                 value = (value * scaleVal) + offsetVal;
                 updateValue(value);
                 read();
-                errorCount = 0; // success
             },
             "xyz.openbmc_project.Ipmi.Channel.Ipmb",
             "/xyz/openbmc_project/Ipmi/Channel/Ipmb", "org.openbmc.Ipmb",
diff --git a/src/MCUTempSensor.cpp b/src/MCUTempSensor.cpp
index a413214..69a3226 100644
--- a/src/MCUTempSensor.cpp
+++ b/src/MCUTempSensor.cpp
@@ -186,7 +186,7 @@
         else
         {
             std::cerr << "Invalid read getMCURegsInfoWord\n";
-            updateValue(-1);
+            incrementError();
         }
         read();
     });
diff --git a/src/NVMeSensor.cpp b/src/NVMeSensor.cpp
index 8cdf744..d683174 100644
--- a/src/NVMeSensor.cpp
+++ b/src/NVMeSensor.cpp
@@ -229,23 +229,11 @@
             constexpr const size_t errorThreshold = 5;
             if (errorCode)
             {
-                sensor->errorCount = 0;
+                // timer cancelled successfully
                 return;
             }
-            if (!isPowerOn())
-            {
-                sensor->errorCount = 0;
-                sensor->updateValue(std::numeric_limits<double>::quiet_NaN());
-            }
-            else if (sensor->errorCount < errorThreshold)
-            {
-                std::cerr << "MCTP timeout device " << sensor->name << "\n";
-                sensor->errorCount++;
-            }
-            else
-            {
-                sensor->updateValue(0);
-            }
+
+            sensor->incrementError();
 
             // cycle it back
             nvmeDevice->sensors.pop_front();
@@ -441,8 +429,9 @@
                        const int busNumber) :
     Sensor(boost::replace_all_copy(sensorName, " ", "_"),
            std::move(_thresholds), sensorConfiguration,
-           "xyz.openbmc_project.Configuration.NVMe", maxReading, minReading),
-    objServer(objectServer), errorCount(0), bus(busNumber)
+           "xyz.openbmc_project.Configuration.NVMe", maxReading, minReading,
+           PowerState::on),
+    objServer(objectServer), bus(busNumber)
 {
     sensorInterface = objectServer.add_interface(
         "/xyz/openbmc_project/sensors/temperature/" + name,
@@ -465,8 +454,6 @@
         association::interface);
 
     setInitialProperties(conn);
-    // setup match
-    setupPowerMatch(conn);
 }
 
 NVMeSensor::~NVMeSensor()
@@ -480,9 +467,5 @@
 
 void NVMeSensor::checkThresholds(void)
 {
-    if (!isPowerOn())
-    {
-        return;
-    }
     thresholds::checkThresholds(this);
 }
diff --git a/src/PSUSensor.cpp b/src/PSUSensor.cpp
index 4d6bc1d..577f3e4 100644
--- a/src/PSUSensor.cpp
+++ b/src/PSUSensor.cpp
@@ -47,7 +47,7 @@
     Sensor(boost::replace_all_copy(sensorName, " ", "_"),
            std::move(_thresholds), sensorConfiguration, objectType, max, min),
     std::enable_shared_from_this<PSUSensor>(), objServer(objectServer),
-    inputDev(io), waitTimer(io), path(path), errCount(0), sensorFactor(factor)
+    inputDev(io), waitTimer(io), path(path), sensorFactor(factor)
 {
     if constexpr (DEBUG)
     {
@@ -147,28 +147,17 @@
             nvalue /= sensorFactor;
 
             updateValue(nvalue);
-            errCount = 0;
         }
         catch (const std::invalid_argument&)
         {
             std::cerr << "Could not parse " << response << "\n";
-            errCount++;
+            incrementError();
         }
     }
     else
     {
         std::cerr << "System error " << err << "\n";
-        errCount++;
-    }
-
-    if (errCount >= warnAfterErrorCount)
-    {
-        if (errCount == warnAfterErrorCount)
-        {
-            std::cerr << "Failure to read sensor " << name << "\n";
-        }
-        updateValue(0);
-        errCount++;
+        incrementError();
     }
 
     lseek(fd, 0, SEEK_SET);
diff --git a/src/TachSensor.cpp b/src/TachSensor.cpp
index c45fcb0..953f26c 100644
--- a/src/TachSensor.cpp
+++ b/src/TachSensor.cpp
@@ -51,11 +51,11 @@
                        const std::string& sensorConfiguration,
                        const std::pair<size_t, size_t>& limits) :
     Sensor(boost::replace_all_copy(fanName, " ", "_"), std::move(_thresholds),
-           sensorConfiguration, objectType, limits.second, limits.first),
+           sensorConfiguration, objectType, limits.second, limits.first,
+           PowerState::on),
     objServer(objectServer), redundancy(redundancy),
     presence(std::move(presenceSensor)),
-    inputDev(io, open(path.c_str(), O_RDONLY)), waitTimer(io), path(path),
-    errCount(0)
+    inputDev(io, open(path.c_str(), O_RDONLY)), waitTimer(io), path(path)
 {
     sensorInterface = objectServer.add_interface(
         "/xyz/openbmc_project/sensors/fan_tach/" + name,
@@ -96,7 +96,6 @@
         itemAssoc->initialize();
     }
     setInitialProperties(conn);
-    setupPowerMatch(conn);
     setupRead();
 }
 
@@ -133,7 +132,7 @@
     {
         if (!presence->getValue())
         {
-            updateValue(std::numeric_limits<double>::quiet_NaN());
+            markAvailable(false);
             missing = true;
             pollTime = sensorFailedPollTimeMs;
         }
@@ -151,35 +150,17 @@
                 double nvalue = std::stod(response);
                 responseStream.clear();
                 updateValue(nvalue);
-                errCount = 0;
             }
             catch (const std::invalid_argument&)
             {
-                errCount++;
+                incrementError();
+                pollTime = sensorFailedPollTimeMs;
             }
         }
         else
         {
-            if (!isPowerOn())
-            {
-                errCount = 0;
-                updateValue(std::numeric_limits<double>::quiet_NaN());
-            }
-            else
-            {
-                pollTime = sensorFailedPollTimeMs;
-                errCount++;
-            }
-        }
-        if (errCount >= warnAfterErrorCount)
-        {
-            // only print once
-            if (errCount == warnAfterErrorCount)
-            {
-                std::cerr << "Failure to read sensor " << name << " at " << path
-                          << " ec:" << err << "\n";
-            }
-            updateValue(0);
+            incrementError();
+            pollTime = sensorFailedPollTimeMs;
         }
     }
     responseStream.clear();
@@ -202,11 +183,6 @@
 
 void TachSensor::checkThresholds(void)
 {
-    if (!isPowerOn())
-    {
-        return;
-    }
-
     bool status = thresholds::checkThresholds(this);
 
     if (redundancy && *redundancy)
