diff --git a/dbus/README b/dbus/README
new file mode 100644
index 0000000..dd079d8
--- /dev/null
+++ b/dbus/README
@@ -0,0 +1,7 @@
+# DbusPassive
+
+These sensors wait for their updates.
+
+# DbusActive
+
+These sensors reach out for their value.
diff --git a/dbus/dbusactiveread.cpp b/dbus/dbusactiveread.cpp
new file mode 100644
index 0000000..5e046a4
--- /dev/null
+++ b/dbus/dbusactiveread.cpp
@@ -0,0 +1,45 @@
+/**
+ * Copyright 2017 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <chrono>
+#include <cmath>
+#include <iostream>
+
+#include "dbusactiveread.hpp"
+#include "dbus/util.hpp"
+
+
+ReadReturn DbusActiveRead::read(void)
+{
+    struct SensorProperties settings;
+    double value;
+
+    GetProperties(_bus, _service, _path, &settings);
+
+    value = settings.value * pow(10, settings.scale);
+
+    /*
+     * Technically it might not be a value from now, but there's no timestamp
+     * on Sensor.Value yet.
+     */
+    struct ReadReturn r = {
+        value,
+        std::chrono::high_resolution_clock::now()
+    };
+
+    return r;
+}
+
diff --git a/dbus/dbusactiveread.hpp b/dbus/dbusactiveread.hpp
new file mode 100644
index 0000000..a9146b9
--- /dev/null
+++ b/dbus/dbusactiveread.hpp
@@ -0,0 +1,33 @@
+#pragma once
+
+#include <memory>
+#include <string>
+
+#include <sdbusplus/bus.hpp>
+
+#include "interfaces.hpp"
+
+
+/*
+ * This ReadInterface will actively reach out over dbus upon calling read to
+ * get the value from whomever owns the associated dbus path.
+ */
+class DbusActiveRead: public ReadInterface
+{
+    public:
+        DbusActiveRead(sdbusplus::bus::bus& bus,
+                       const std::string& path,
+                       const std::string& service)
+            : ReadInterface(),
+              _bus(bus),
+              _path(path),
+              _service(service)
+        { }
+
+        ReadReturn read(void) override;
+
+    private:
+        sdbusplus::bus::bus& _bus;
+        const std::string _path;
+        const std::string _service; // the sensor service.
+};
diff --git a/dbus/dbuspassive.cpp b/dbus/dbuspassive.cpp
new file mode 100644
index 0000000..25a0148
--- /dev/null
+++ b/dbus/dbuspassive.cpp
@@ -0,0 +1,107 @@
+/**
+ * Copyright 2017 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <chrono>
+#include <cmath>
+#include <mutex>
+
+#include "dbuspassive.hpp"
+
+DbusPassive::DbusPassive(
+    sdbusplus::bus::bus& bus,
+    const std::string& type,
+    const std::string& id)
+    : ReadInterface(),
+      _bus(bus),
+      _signal(bus, GetMatch(type, id).c_str(), DbusHandleSignal, this),
+      _id(id)
+{
+    /* Need to get the scale and initial value */
+    auto tempBus = sdbusplus::bus::new_default();
+    /* service == busname */
+    std::string path = GetSensorPath(type, id);
+    std::string service = GetService(tempBus, sensorintf, path);
+
+    struct SensorProperties settings;
+    GetProperties(tempBus, service, path, &settings);
+
+    _scale = settings.scale;
+    _value = settings.value * pow(10, _scale);
+    _updated = std::chrono::high_resolution_clock::now();
+}
+
+ReadReturn DbusPassive::read(void)
+{
+    std::lock_guard<std::mutex> guard(_lock);
+
+    struct ReadReturn r = {
+        _value,
+        _updated
+    };
+
+    return r;
+}
+
+void DbusPassive::setValue(double value)
+{
+    std::lock_guard<std::mutex> guard(_lock);
+
+    _value = value;
+    _updated = std::chrono::high_resolution_clock::now();
+}
+
+int64_t DbusPassive::getScale(void)
+{
+    return _scale;
+}
+
+std::string DbusPassive::getId(void)
+{
+    return _id;
+}
+
+int DbusHandleSignal(sd_bus_message* msg, void* usrData, sd_bus_error* err)
+{
+    namespace sdm = sdbusplus::message;
+    auto sdbpMsg = sdm::message(msg);
+    DbusPassive* obj = static_cast<DbusPassive*>(usrData);
+
+    std::string msgSensor;
+    std::map<std::string, sdm::variant<int64_t>> msgData;
+    sdbpMsg.read(msgSensor, msgData);
+
+    if (msgSensor == "xyz.openbmc_project.Sensor.Value")
+    {
+        auto valPropMap = msgData.find("Value");
+        if (valPropMap != msgData.end())
+        {
+            int64_t rawValue = sdm::variant_ns::get<int64_t>
+                               (valPropMap->second);
+
+            double value = rawValue * pow(10, obj->getScale());
+
+#if 0
+            std::cerr << "received update: " << value
+                      << " for: " << obj->getId()
+                      << std::endl;
+#endif
+
+            obj->setValue(value);
+        }
+    }
+
+    return 0;
+}
diff --git a/dbus/dbuspassive.hpp b/dbus/dbuspassive.hpp
new file mode 100644
index 0000000..36e0ac1
--- /dev/null
+++ b/dbus/dbuspassive.hpp
@@ -0,0 +1,58 @@
+#pragma once
+
+#include <chrono>
+#include <cmath>
+#include <iostream>
+#include <map>
+#include <mutex>
+#include <set>
+#include <string>
+#include <tuple>
+#include <vector>
+
+
+#include <sdbusplus/bus.hpp>
+#include <sdbusplus/message.hpp>
+#include <sdbusplus/server.hpp>
+
+#include "interfaces.hpp"
+#include "dbus/util.hpp"
+
+int DbusHandleSignal(sd_bus_message* msg, void* data, sd_bus_error* err);
+
+/*
+ * This ReadInterface will passively listen for Value updates from whomever
+ * owns the associated dbus object.
+ *
+ * This requires another modification in phosphor-dbus-interfaces that will
+ * signal a value update every time it's read instead of only when it changes
+ * to help us:
+ * - ensure we're still receiving data (since we don't control the reader)
+ * - simplify stale data detection
+ * - simplify error detection
+ */
+class DbusPassive : public ReadInterface
+{
+    public:
+        DbusPassive(sdbusplus::bus::bus& bus,
+                    const std::string& type,
+                    const std::string& id);
+
+        ReadReturn read(void) override;
+
+        void setValue(double value);
+        int64_t getScale(void);
+        std::string getId(void);
+
+    private:
+        sdbusplus::bus::bus& _bus;
+        sdbusplus::server::match::match _signal;
+        int64_t _scale;
+        std::string _id; // for debug identification
+
+        std::mutex _lock;
+        double _value = 0;
+        /* The last time the value was refreshed, not necessarily changed. */
+        std::chrono::high_resolution_clock::time_point _updated;
+};
+
diff --git a/dbus/util.cpp b/dbus/util.cpp
new file mode 100644
index 0000000..692e9c5
--- /dev/null
+++ b/dbus/util.cpp
@@ -0,0 +1,109 @@
+#include <iostream>
+
+#include "dbus/util.hpp"
+
+using Property = std::string;
+using Value = sdbusplus::message::variant<int64_t, std::string>;
+using PropertyMap = std::map<Property, Value>;
+
+/* TODO(venture): Basically all phosphor apps need this, maybe it should be a
+ * part of sdbusplus.  There is an old version in libmapper.
+ */
+std::string GetService(sdbusplus::bus::bus& bus,
+                       const std::string& intf,
+                       const std::string& path)
+{
+    auto mapper = bus.new_method_call(
+                      "xyz.openbmc_project.ObjectMapper",
+                      "/xyz/openbmc_project/object_mapper",
+                      "xyz.openbmc_project.ObjectMapper",
+                      "GetObject");
+
+    mapper.append(path);
+    mapper.append(std::vector<std::string>({intf}));
+
+    auto responseMsg = bus.call(mapper);
+    if (responseMsg.is_method_error())
+    {
+        throw std::runtime_error("ObjectMapper Call Failure");
+    }
+
+    std::map<std::string, std::vector<std::string>> response;
+    responseMsg.read(response);
+
+    if (response.begin() == response.end())
+    {
+        throw std::runtime_error("Unable to find Object: " + path);
+    }
+
+    return response.begin()->first;
+}
+
+void GetProperties(sdbusplus::bus::bus& bus,
+                   const std::string& service,
+                   const std::string& path,
+                   struct SensorProperties* prop)
+{
+
+    auto pimMsg = bus.new_method_call(service.c_str(),
+                                      path.c_str(),
+                                      propertiesintf.c_str(),
+                                      "GetAll");
+
+    pimMsg.append(sensorintf);
+    auto valueResponseMsg = bus.call(pimMsg);
+
+    if (valueResponseMsg.is_method_error())
+    {
+        std::cerr << "Error in value call\n";
+        throw std::runtime_error("ERROR in value call.");
+    }
+
+    // The PropertyMap returned will look like this because it's always
+    // reading a Sensor.Value interface.
+    // a{sv} 3:
+    // "Value" x 24875
+    // "Unit" s "xyz.openbmc_project.Sensor.Value.Unit.DegreesC"
+    // "Scale" x -3
+    PropertyMap propMap;
+    valueResponseMsg.read(propMap);
+
+    if (propMap.size() != 3)
+    {
+        throw std::runtime_error("ERROR in results, expected three properties");
+    }
+
+    prop->unit = sdbusplus::message::variant_ns::get<std::string>(propMap["Unit"]);
+    prop->scale = sdbusplus::message::variant_ns::get<int64_t>(propMap["Scale"]);
+    prop->value = sdbusplus::message::variant_ns::get<int64_t>(propMap["Value"]);
+
+    return;
+}
+
+std::string GetSensorPath(const std::string& type, const std::string& id)
+{
+    std::string layer = type;
+    if (type == "fan")
+    {
+        layer = "fan_tach";
+    }
+    else if (type == "temp")
+    {
+        layer = "temperature";
+    }
+    else
+    {
+        layer = "unknown"; // TODO(venture): Need to handle.
+    }
+
+    return std::string("/xyz/openbmc_project/sensors/" + layer + "/" + id);
+}
+
+std::string GetMatch(const std::string& type, const std::string& id)
+{
+    return std::string("type='signal',"
+                       "interface='org.freedesktop.DBus.Properties',"
+                       "member='PropertiesChanged',"
+                       "path='" + GetSensorPath(type, id) + "'");
+}
+
diff --git a/dbus/util.hpp b/dbus/util.hpp
new file mode 100644
index 0000000..3ff2424
--- /dev/null
+++ b/dbus/util.hpp
@@ -0,0 +1,29 @@
+#pragma once
+
+#include <sdbusplus/bus.hpp>
+
+struct SensorProperties
+{
+    int64_t scale;
+    int64_t value;
+    std::string unit;
+};
+
+/*
+ * Retrieve the dbus bus (or service) for the given object and interface.
+ */
+std::string GetService(sdbusplus::bus::bus& bus,
+                       const std::string& intf,
+                       const std::string& path);
+
+void GetProperties(sdbusplus::bus::bus& bus,
+                   const std::string& service,
+                   const std::string& path,
+                   struct SensorProperties* prop);
+
+std::string GetSensorPath(const std::string& type, const std::string& id);
+std::string GetMatch(const std::string& type, const std::string& id);
+
+const std::string sensorintf = "xyz.openbmc_project.Sensor.Value";
+const std::string propertiesintf = "org.freedesktop.DBus.Properties";
+
