diff --git a/dcmihandler.cpp b/dcmihandler.cpp
index 54c8799..fa3b55b 100644
--- a/dcmihandler.cpp
+++ b/dcmihandler.cpp
@@ -1113,20 +1113,98 @@
 namespace sensor_info
 {
 
+Response createFromJson(const Json& config)
+{
+    Response response{};
+    uint16_t recordId = config.value("record_id", 0);
+    response.recordIdLsb = recordId & 0xFF;
+    response.recordIdMsb = (recordId >> 8) & 0xFF;
+    return response;
+}
+
 std::tuple<Response, NumInstances> read(const std::string& type,
                                         uint8_t instance,
                                         const Json& config)
 {
-    Response empty{};
-    return std::make_tuple(empty, 0);
+    Response response{};
+
+    if (!instance)
+    {
+        log<level::ERR>("Expected non-zero instance");
+        elog<InternalFailure>();
+    }
+
+    static const std::vector<Json> empty{};
+    std::vector<Json> readings = config.value(type, empty);
+    size_t numInstances = readings.size();
+    for (const auto& reading : readings)
+    {
+        uint8_t instanceNum = reading.value("instance", 0);
+        // Not the instance we're interested in
+        if (instanceNum != instance)
+        {
+            continue;
+        }
+
+        response = createFromJson(reading);
+
+        // Found the instance we're interested in
+        break;
+    }
+
+    if (numInstances > maxInstances)
+    {
+        log<level::DEBUG>("Trimming IPMI num instances",
+                          entry("NUM_INSTANCES=%d", numInstances));
+        numInstances = maxInstances;
+    }
+    return std::make_tuple(response, numInstances);
 }
 
 std::tuple<ResponseList, NumInstances> readAll(const std::string& type,
                                                uint8_t instanceStart,
                                                const Json& config)
 {
-    ResponseList empty{};
-    return std::make_tuple(empty, 0);
+    ResponseList responses{};
+
+    size_t numInstances = 0;
+    static const std::vector<Json> empty{};
+    std::vector<Json> readings = config.value(type, empty);
+    numInstances = readings.size();
+    for (const auto& reading : readings)
+    {
+        try
+        {
+            // Max of 8 records
+            if (responses.size() == maxRecords)
+            {
+                break;
+            }
+
+            uint8_t instanceNum = reading.value("instance", 0);
+            // Not in the instance range we're interested in
+            if (instanceNum < instanceStart)
+            {
+                continue;
+            }
+
+            Response response = createFromJson(reading);
+            responses.push_back(response);
+        }
+        catch (std::exception& e)
+        {
+            log<level::DEBUG>(e.what());
+            continue;
+        }
+    }
+
+    if (numInstances > maxInstances)
+    {
+        log<level::DEBUG>("Trimming IPMI num instances",
+                          entry("NUM_INSTANCES=%d", numInstances));
+        numInstances = maxInstances;
+    }
+    return std::make_tuple(responses, numInstances);
 }
 
 } // namespace sensor_info
diff --git a/dcmihandler.hpp b/dcmihandler.hpp
index 09921a0..e2a4c10 100644
--- a/dcmihandler.hpp
+++ b/dcmihandler.hpp
@@ -449,6 +449,14 @@
 
 namespace sensor_info
 {
+    /** @brief Create response from JSON config.
+     *
+     *  @param[in] config - JSON config info about DCMI sensors
+     *
+     *  @return Sensor info response
+     */
+    Response createFromJson(const Json& config);
+
     /** @brief Read sensor info and fill up DCMI response for the Get
      *         Sensor Info command. This looks at a specific
      *         instance.
