diff --git a/conf.hpp b/conf.hpp
index 0e26f55..265da09 100644
--- a/conf.hpp
+++ b/conf.hpp
@@ -34,13 +34,17 @@
 
 /*
  * Structure for decorating an input sensor's name with additional
- * information, to help out with TempToMargin conversion.
+ * information, such as TempToMargin and MissingIsAcceptable.
+ * This information comes from the PID loop configuration,
+ * not from SensorConfig, in order for it to be able to work
+ * with dynamic sensors from entity-manager.
  */
 struct SensorInput
 {
     std::string name;
     double convertMarginZero = std::numeric_limits<double>::quiet_NaN();
     bool convertTempToMargin = false;
+    bool missingIsAcceptable = false;
 };
 
 /*
diff --git a/dbus/dbusconfiguration.cpp b/dbus/dbusconfiguration.cpp
index 2473252..7b78280 100644
--- a/dbus/dbusconfiguration.cpp
+++ b/dbus/dbusconfiguration.cpp
@@ -670,6 +670,15 @@
                 std::vector<std::string> inputSensorNames(
                     std::get<std::vector<std::string>>(base.at("Inputs")));
                 std::vector<std::string> outputSensorNames;
+                std::vector<std::string> missingAcceptableSensorNames;
+
+                auto findMissingAcceptable = base.find("MissingIsAcceptable");
+                if (findMissingAcceptable != base.end())
+                {
+                    missingAcceptableSensorNames =
+                        std::get<std::vector<std::string>>(
+                            findMissingAcceptable->second);
+                }
 
                 // assumption: all fan pids must have at least one output
                 if (pidClass == "fan")
@@ -689,6 +698,9 @@
 
                 std::vector<SensorInterfaceType> inputSensorInterfaces;
                 std::vector<SensorInterfaceType> outputSensorInterfaces;
+                std::vector<SensorInterfaceType>
+                    missingAcceptableSensorInterfaces;
+
                 /* populate an interface list for different sensor direction
                  * types (input,output)
                  */
@@ -707,6 +719,12 @@
                     findSensors(sensors, sensorNameToDbusName(sensorName),
                                 outputSensorInterfaces);
                 }
+                for (const std::string& sensorName :
+                     missingAcceptableSensorNames)
+                {
+                    findSensors(sensors, sensorNameToDbusName(sensorName),
+                                missingAcceptableSensorInterfaces);
+                }
 
                 inputSensorNames.clear();
                 for (const SensorInterfaceType& inputSensorInterface :
@@ -752,6 +770,35 @@
                     }
                 }
 
+                // MissingIsAcceptable same postprocessing as Inputs
+                missingAcceptableSensorNames.clear();
+                for (const SensorInterfaceType&
+                         missingAcceptableSensorInterface :
+                     missingAcceptableSensorInterfaces)
+                {
+                    const std::string& dbusInterface =
+                        missingAcceptableSensorInterface.second;
+                    const std::string& missingAcceptableSensorPath =
+                        missingAcceptableSensorInterface.first;
+
+                    std::string missingAcceptableSensorName =
+                        getSensorNameFromPath(missingAcceptableSensorPath);
+                    missingAcceptableSensorNames.push_back(
+                        missingAcceptableSensorName);
+
+                    if (dbusInterface != sensorInterface)
+                    {
+                        /* MissingIsAcceptable same error checking as Inputs
+                         */
+                        throw std::runtime_error(
+                            "sensor at dbus path [" +
+                            missingAcceptableSensorPath +
+                            "] has an interface [" + dbusInterface +
+                            "] that does not match the expected interface of " +
+                            sensorInterface);
+                    }
+                }
+
                 /* fan pids need to pair up tach sensors with their pwm
                  * counterparts
                  */
@@ -864,7 +911,8 @@
                 }
 
                 std::vector<pid_control::conf::SensorInput> sensorInputs =
-                    spliceInputs(inputSensorNames, inputTempToMargin);
+                    spliceInputs(inputSensorNames, inputTempToMargin,
+                                 missingAcceptableSensorNames);
 
                 if (offsetType.empty())
                 {
@@ -903,9 +951,19 @@
                 conf::PIDConf& conf = zoneConfig[index];
 
                 std::vector<std::string> inputs;
+                std::vector<std::string> missingAcceptableSensors;
+                std::vector<std::string> missingAcceptableSensorNames;
                 std::vector<std::string> sensorNames =
                     std::get<std::vector<std::string>>(base.at("Inputs"));
 
+                auto findMissingAcceptable = base.find("MissingIsAcceptable");
+                if (findMissingAcceptable != base.end())
+                {
+                    missingAcceptableSensorNames =
+                        std::get<std::vector<std::string>>(
+                            findMissingAcceptable->second);
+                }
+
                 bool unavailableAsFailed = true;
                 auto findUnavailableAsFailed =
                     base.find("InputUnavailableAsFailed");
@@ -928,10 +986,8 @@
 
                     for (const auto& sensorPathIfacePair : sensorPathIfacePairs)
                     {
-                        size_t idx =
-                            sensorPathIfacePair.first.find_last_of("/") + 1;
                         std::string shortName =
-                            sensorPathIfacePair.first.substr(idx);
+                            getSensorNameFromPath(sensorPathIfacePair.first);
 
                         inputs.push_back(shortName);
                         auto& config = sensorConfig[shortName];
@@ -950,6 +1006,30 @@
                 {
                     continue;
                 }
+
+                // MissingIsAcceptable same postprocessing as Inputs
+                for (const std::string& missingAcceptableSensorName :
+                     missingAcceptableSensorNames)
+                {
+                    std::vector<std::pair<std::string, std::string>>
+                        sensorPathIfacePairs;
+                    if (!findSensors(
+                            sensors,
+                            sensorNameToDbusName(missingAcceptableSensorName),
+                            sensorPathIfacePairs))
+                    {
+                        break;
+                    }
+
+                    for (const auto& sensorPathIfacePair : sensorPathIfacePairs)
+                    {
+                        std::string shortName =
+                            getSensorNameFromPath(sensorPathIfacePair.first);
+
+                        missingAcceptableSensors.push_back(shortName);
+                    }
+                }
+
                 conf::ControllerInfo& info = conf[pidName];
 
                 std::vector<double> inputTempToMargin;
@@ -961,7 +1041,8 @@
                         std::get<std::vector<double>>(findTempToMargin->second);
                 }
 
-                info.inputs = spliceInputs(inputs, inputTempToMargin);
+                info.inputs = spliceInputs(inputs, inputTempToMargin,
+                                           missingAcceptableSensors);
 
                 info.type = "stepwise";
                 info.stepwiseInfo.ts = 1.0; // currently unused
diff --git a/pid/builder.cpp b/pid/builder.cpp
index bae0e81..39d0076 100644
--- a/pid/builder.cpp
+++ b/pid/builder.cpp
@@ -95,7 +95,7 @@
                 for (const auto& i : info.inputs)
                 {
                     inputs.push_back(i);
-                    zone->addFanInput(i.name);
+                    zone->addFanInput(i.name, i.missingIsAcceptable);
                 }
 
                 auto pid = FanController::createFanPid(
@@ -108,7 +108,7 @@
                 for (const auto& i : info.inputs)
                 {
                     inputs.push_back(i);
-                    zone->addThermalInput(i.name);
+                    zone->addThermalInput(i.name, i.missingIsAcceptable);
                 }
 
                 auto pid = ThermalController::createThermalPid(
@@ -126,7 +126,7 @@
                 for (const auto& i : info.inputs)
                 {
                     inputs.push_back(i);
-                    zone->addThermalInput(i.name);
+                    zone->addThermalInput(i.name, i.missingIsAcceptable);
                 }
                 auto stepwise = StepwiseController::createStepwiseController(
                     zone.get(), name, splitNames(inputs), info.stepwiseInfo);
@@ -145,6 +145,10 @@
                 {
                     std::cerr << "[" << i.convertMarginZero << "]";
                 }
+                if (i.missingIsAcceptable)
+                {
+                    std::cerr << "?";
+                }
                 std::cerr << ", ";
             }
             std::cerr << "\n";
diff --git a/pid/buildjson.cpp b/pid/buildjson.cpp
index 8396338..dd7d2a3 100644
--- a/pid/buildjson.cpp
+++ b/pid/buildjson.cpp
@@ -37,6 +37,7 @@
 void from_json(const json& j, conf::ControllerInfo& c)
 {
     std::vector<std::string> inputNames;
+    std::vector<std::string> missingAcceptableNames;
 
     j.at("type").get_to(c.type);
     j.at("inputs").get_to(inputNames);
@@ -50,7 +51,14 @@
         findTempToMargin->get_to(inputTempToMargin);
     }
 
-    c.inputs = spliceInputs(inputNames, inputTempToMargin);
+    auto findMissingAcceptable = j.find("missingIsAcceptable");
+    if (findMissingAcceptable != j.end())
+    {
+        findMissingAcceptable->get_to(missingAcceptableNames);
+    }
+
+    c.inputs = spliceInputs(inputNames, inputTempToMargin,
+                            missingAcceptableNames);
 
     /* TODO: We need to handle parsing other PID controller configurations.
      * We can do that by checking for different keys and making the decision
diff --git a/pid/fancontroller.cpp b/pid/fancontroller.cpp
index 44852a0..ddfea20 100644
--- a/pid/fancontroller.cpp
+++ b/pid/fancontroller.cpp
@@ -175,7 +175,7 @@
     {
         auto sensor = _owner->getSensor(it);
         auto redundantWrite = _owner->getRedundantWrite();
-        int64_t rawWritten;
+        int64_t rawWritten = -1;
         sensor->write(percent, redundantWrite, &rawWritten);
 
         // The outputCache will be used later,
diff --git a/pid/zone.cpp b/pid/zone.cpp
index 0b46841..e5eddca 100644
--- a/pid/zone.cpp
+++ b/pid/zone.cpp
@@ -96,6 +96,17 @@
     return !_failSafeSensors.empty();
 }
 
+void DbusPidZone::markSensorMissing(const std::string& name)
+{
+    if (_missingAcceptable.find(name) != _missingAcceptable.end())
+    {
+        // Disallow sensors in MissingIsAcceptable list from causing failsafe
+        return;
+    }
+
+    _failSafeSensors.emplace(name);
+}
+
 int64_t DbusPidZone::getZoneID(void) const
 {
     return _zoneId;
@@ -184,14 +195,25 @@
     _cachedFanOutputs[std::string{name}] = values;
 }
 
-void DbusPidZone::addFanInput(const std::string& fan)
+void DbusPidZone::addFanInput(const std::string& fan, bool missingAcceptable)
 {
     _fanInputs.push_back(fan);
+
+    if (missingAcceptable)
+    {
+        _missingAcceptable.emplace(fan);
+    }
 }
 
-void DbusPidZone::addThermalInput(const std::string& therm)
+void DbusPidZone::addThermalInput(const std::string& therm,
+                                  bool missingAcceptable)
 {
     _thermalInputs.push_back(therm);
+
+    if (missingAcceptable)
+    {
+        _missingAcceptable.emplace(therm);
+    }
 }
 
 // Updates desired RPM setpoint from optional text file
@@ -389,21 +411,23 @@
 
 void DbusPidZone::initializeCache(void)
 {
+    auto nan = std::numeric_limits<double>::quiet_NaN();
+
     for (const auto& f : _fanInputs)
     {
-        _cachedValuesByName[f] = {0, 0};
-        _cachedFanOutputs[f] = {0, 0};
+        _cachedValuesByName[f] = {nan, nan};
+        _cachedFanOutputs[f] = {nan, nan};
 
         // Start all fans in fail-safe mode.
-        _failSafeSensors.insert(f);
+        markSensorMissing(f);
     }
 
     for (const auto& t : _thermalInputs)
     {
-        _cachedValuesByName[t] = {0, 0};
+        _cachedValuesByName[t] = {nan, nan};
 
         // Start all sensors in fail-safe mode.
-        _failSafeSensors.insert(t);
+        markSensorMissing(t);
     }
     // Initialize Pid FailSafePercent
     initPidFailSafePercent();
diff --git a/pid/zone.hpp b/pid/zone.hpp
index 2854997..464e672 100644
--- a/pid/zone.hpp
+++ b/pid/zone.hpp
@@ -71,6 +71,7 @@
     bool getRedundantWrite(void) const override;
     void setManualMode(bool mode);
     bool getFailSafeMode(void) const override;
+    void markSensorMissing(const std::string& name);
 
     int64_t getZoneID(void) const override;
     void addSetPoint(double setPoint, const std::string& name) override;
@@ -99,8 +100,8 @@
     double getCachedValue(const std::string& name) override;
     ValueCacheEntry getCachedValues(const std::string& name) override;
 
-    void addFanInput(const std::string& fan);
-    void addThermalInput(const std::string& therm);
+    void addFanInput(const std::string& fan, bool missingAcceptable);
+    void addThermalInput(const std::string& therm, bool missingAcceptable);
 
     void initializeLog(void) override;
     void writeLog(const std::string& value) override;
@@ -166,7 +167,8 @@
             // check if fan fail.
             if (sensor->getFailed())
             {
-                _failSafeSensors.insert(sensorInput);
+                markSensorMissing(sensorInput);
+
                 if (debugEnabled)
                 {
                     std::cerr << sensorInput << " sensor get failed\n";
@@ -174,7 +176,8 @@
             }
             else if (timeout != 0 && duration >= period)
             {
-                _failSafeSensors.insert(sensorInput);
+                markSensorMissing(sensorInput);
+
                 if (debugEnabled)
                 {
                     std::cerr << sensorInput << " sensor timeout\n";
@@ -191,6 +194,7 @@
                         std::cerr << sensorInput
                                   << " is erased from failsafe sensor set\n";
                     }
+
                     _failSafeSensors.erase(kt);
                 }
             }
@@ -213,6 +217,7 @@
     const conf::CycleTime _cycleTime;
 
     std::set<std::string> _failSafeSensors;
+    std::set<std::string> _missingAcceptable;
 
     std::vector<double> _SetPoints;
     std::vector<double> _RPMCeilings;
diff --git a/test/pid_zone_unittest.cpp b/test/pid_zone_unittest.cpp
index f0b96b1..6c570cc 100644
--- a/test/pid_zone_unittest.cpp
+++ b/test/pid_zone_unittest.cpp
@@ -376,8 +376,8 @@
     EXPECT_EQ(mgr.getSensor(name2), sensor_ptr2);
 
     // Now that the sensors exist, add them to the zone.
-    zone->addThermalInput(name1);
-    zone->addThermalInput(name2);
+    zone->addThermalInput(name1, false);
+    zone->addThermalInput(name2, false);
 
     // Initialize Zone
     zone->initializeCache();
@@ -428,8 +428,8 @@
     EXPECT_EQ(mgr.getSensor(name2), sensor_ptr2);
 
     // Now that the sensors exist, add them to the zone.
-    zone->addFanInput(name1);
-    zone->addFanInput(name2);
+    zone->addFanInput(name1, false);
+    zone->addFanInput(name2, false);
 
     // Initialize Zone
     zone->initializeCache();
@@ -475,8 +475,8 @@
     mgr.addSensor(type, name2, std::move(sensor2));
     EXPECT_EQ(mgr.getSensor(name2), sensor_ptr2);
 
-    zone->addThermalInput(name1);
-    zone->addThermalInput(name2);
+    zone->addThermalInput(name1, false);
+    zone->addThermalInput(name2, false);
 
     // Initialize Zone
     zone->initializeCache();
@@ -512,6 +512,105 @@
     EXPECT_TRUE(zone->getFailSafeMode());
 }
 
+TEST_F(PidZoneTest, ThermalInput_MissingIsAcceptableNoFailSafe)
+{
+    // This is similar to the above test, but because missingIsAcceptable
+    // is set for sensor1, the zone should not enter failsafe mode when
+    // only sensor1 goes missing.
+    // However, sensor2 going missing should still trigger failsafe mode.
+
+    int64_t timeout = 1;
+
+    std::string name1 = "temp1";
+    std::unique_ptr<Sensor> sensor1 = std::make_unique<SensorMock>(name1,
+                                                                   timeout);
+    SensorMock* sensor_ptr1 = reinterpret_cast<SensorMock*>(sensor1.get());
+
+    std::string name2 = "temp2";
+    std::unique_ptr<Sensor> sensor2 = std::make_unique<SensorMock>(name2,
+                                                                   timeout);
+    SensorMock* sensor_ptr2 = reinterpret_cast<SensorMock*>(sensor2.get());
+
+    std::string type = "unchecked";
+    mgr.addSensor(type, name1, std::move(sensor1));
+    EXPECT_EQ(mgr.getSensor(name1), sensor_ptr1);
+    mgr.addSensor(type, name2, std::move(sensor2));
+    EXPECT_EQ(mgr.getSensor(name2), sensor_ptr2);
+
+    // Only sensor1 has MissingIsAcceptable enabled for it
+    zone->addThermalInput(name1, true);
+    zone->addThermalInput(name2, false);
+
+    // Initialize Zone
+    zone->initializeCache();
+
+    // As sensors are not initialized, zone should be in failsafe mode
+    EXPECT_TRUE(zone->getFailSafeMode());
+
+    // r1 not populated here, intentionally, to simulate a sensor that
+    // is not available yet, perhaps takes a long time to start up.
+    ReadReturn r1;
+    EXPECT_CALL(*sensor_ptr1, read()).WillOnce(Return(r1));
+
+    ReadReturn r2;
+    r2.value = 11.0;
+    r2.updated = std::chrono::high_resolution_clock::now();
+    EXPECT_CALL(*sensor_ptr2, read()).WillOnce(Return(r2));
+
+    zone->updateSensors();
+
+    // Only sensor2 has been initialized here. Failsafe should be false,
+    // because sensor1 MissingIsAcceptable so it is OK for it to go missing.
+    EXPECT_FALSE(zone->getFailSafeMode());
+
+    r1.value = 10.0;
+    r1.updated = std::chrono::high_resolution_clock::now();
+
+    EXPECT_CALL(*sensor_ptr1, read()).WillOnce(Return(r1));
+    EXPECT_CALL(*sensor_ptr2, read()).WillOnce(Return(r2));
+    zone->updateSensors();
+
+    // Both sensors are now properly initialized
+    EXPECT_FALSE(zone->getFailSafeMode());
+
+    // Ok, so we're not in failsafe mode, so let's set updated to the past.
+    // sensor1 will have an updated field older than its timeout value, but
+    // sensor2 will be fine. :D
+    r1.updated -= std::chrono::seconds(3);
+    r2.updated = std::chrono::high_resolution_clock::now();
+
+    EXPECT_CALL(*sensor_ptr1, read()).WillOnce(Return(r1));
+    EXPECT_CALL(*sensor_ptr2, read()).WillOnce(Return(r2));
+    zone->updateSensors();
+
+    // MissingIsAcceptable is true for sensor1, so the zone should not be
+    // thrown into failsafe mode.
+    EXPECT_FALSE(zone->getFailSafeMode());
+
+    // Do the same thing, but for the opposite sensors: r1 is good,
+    // but r2 is set to some time in the past.
+    r1.updated = std::chrono::high_resolution_clock::now();
+    r2.updated -= std::chrono::seconds(3);
+
+    EXPECT_CALL(*sensor_ptr1, read()).WillOnce(Return(r1));
+    EXPECT_CALL(*sensor_ptr2, read()).WillOnce(Return(r2));
+    zone->updateSensors();
+
+    // Now, the zone should be in failsafe mode, because sensor2 does not
+    // have MissingIsAcceptable set true, it is still subject to failsafe.
+    EXPECT_TRUE(zone->getFailSafeMode());
+
+    r1.updated = std::chrono::high_resolution_clock::now();
+    r2.updated = std::chrono::high_resolution_clock::now();
+
+    EXPECT_CALL(*sensor_ptr1, read()).WillOnce(Return(r1));
+    EXPECT_CALL(*sensor_ptr2, read()).WillOnce(Return(r2));
+    zone->updateSensors();
+
+    // The failsafe mode should cease, as both sensors are good again.
+    EXPECT_FALSE(zone->getFailSafeMode());
+}
+
 TEST_F(PidZoneTest, FanInputTest_FailsafeToValid_ReadsSensors)
 {
     // This will add a couple fan inputs, and verify the values are cached.
@@ -535,8 +634,8 @@
     EXPECT_EQ(mgr.getSensor(name2), sensor_ptr2);
 
     // Now that the sensors exist, add them to the zone.
-    zone->addFanInput(name1);
-    zone->addFanInput(name2);
+    zone->addFanInput(name1, false);
+    zone->addFanInput(name2, false);
 
     // Initialize Zone
     zone->initializeCache();
@@ -588,8 +687,8 @@
     EXPECT_EQ(mgr.getSensor(name2), sensor_ptr2);
 
     // Now that the sensors exist, add them to the zone.
-    zone->addFanInput(name1);
-    zone->addFanInput(name2);
+    zone->addFanInput(name1, false);
+    zone->addFanInput(name2, false);
 
     // Initialize Zone
     zone->initializeCache();
@@ -639,7 +738,7 @@
     mgr.addSensor(type, name1, std::move(sensor1));
     EXPECT_EQ(mgr.getSensor(name1), sensor_ptr1);
 
-    zone->addThermalInput(name1);
+    zone->addThermalInput(name1, false);
 
     // Verify method under test returns the pointer we expect.
     EXPECT_EQ(mgr.getSensor(name1), zone->getSensor(name1));
diff --git a/test/zone_mock.hpp b/test/zone_mock.hpp
index 8ba9c85..a3d6be9 100644
--- a/test/zone_mock.hpp
+++ b/test/zone_mock.hpp
@@ -23,7 +23,7 @@
     ValueCacheEntry getCachedValues(const std::string& s)
     {
         auto v = getCachedValue(s);
-        return ValueCacheEntry(v, v);
+        return {v, v};
     }
 
     MOCK_CONST_METHOD0(getRedundantWrite, bool(void));
diff --git a/util.cpp b/util.cpp
index 87c4deb..b83ed43 100644
--- a/util.cpp
+++ b/util.cpp
@@ -103,15 +103,16 @@
 
 std::vector<conf::SensorInput>
     spliceInputs(const std::vector<std::string>& inputNames,
-                 const std::vector<double>& inputTempToMargin)
+                 const std::vector<double>& inputTempToMargin,
+                 const std::vector<std::string>& missingAcceptableNames)
 {
     std::vector<conf::SensorInput> results;
 
-    // Default to the TempToMargin feature disabled
+    // Default to TempToMargin and MissingIsAcceptable disabled
     for (const auto& inputName : inputNames)
     {
         conf::SensorInput newInput{
-            inputName, std::numeric_limits<double>::quiet_NaN(), false};
+            inputName, std::numeric_limits<double>::quiet_NaN(), false, false};
 
         results.emplace_back(newInput);
     }
@@ -132,6 +133,23 @@
         results[index].convertTempToMargin = true;
     }
 
+    std::set<std::string> acceptableSet;
+
+    // Copy vector to set, to avoid O(n^2) runtime below
+    for (const auto& name : missingAcceptableNames)
+    {
+        acceptableSet.emplace(name);
+    }
+
+    // Flag missingIsAcceptable true if name found in that set
+    for (auto& result : results)
+    {
+        if (acceptableSet.find(result.name) != acceptableSet.end())
+        {
+            result.missingIsAcceptable = true;
+        }
+    }
+
     return results;
 }
 
diff --git a/util.hpp b/util.hpp
index 0588934..7617562 100644
--- a/util.hpp
+++ b/util.hpp
@@ -46,7 +46,8 @@
  */
 std::vector<conf::SensorInput>
     spliceInputs(const std::vector<std::string>& inputNames,
-                 const std::vector<double>& inputTempToMargin);
+                 const std::vector<double>& inputTempToMargin,
+                 const std::vector<std::string>& missingAcceptableNames);
 
 /*
  * Recovers the original "Inputs" vector from spliceInputs().
