diff --git a/dcmihandler.cpp b/dcmihandler.cpp
index aa9f14e..e5a5384 100644
--- a/dcmihandler.cpp
+++ b/dcmihandler.cpp
@@ -731,6 +731,117 @@
     return IPMI_CC_OK;
 }
 
+namespace dcmi
+{
+namespace temp_readings
+{
+
+std::tuple<Response, NumInstances> read(const std::string& type,
+                                        uint8_t instance)
+{
+    Response empty{};
+    return std::make_tuple(empty, 0);
+}
+
+std::tuple<ResponseList, NumInstances> readAll(const std::string& type,
+                                               uint8_t instanceStart)
+{
+    ResponseList empty{};
+    return std::make_tuple(empty, 0);
+}
+
+} // namsespace temp_readings
+} // namsepace dcmi
+
+ipmi_ret_t getTempReadings(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
+                       ipmi_request_t request, ipmi_response_t response,
+                       ipmi_data_len_t data_len, ipmi_context_t context)
+{
+    // Refer Table 6-14, DCMI Entity ID Extension, DCMI v1.5 spec
+    static const std::map<uint8_t, std::string> entityIdToName
+    {
+        {0x40, "inlet"},
+        {0x37, "inlet"},
+        {0x41, "cpu"},
+        {0x03, "cpu"},
+        {0x42, "baseboard"},
+        {0x07, "baseboard"}
+    };
+
+    auto requestData =
+        reinterpret_cast<const dcmi::GetTempReadingsRequest*>(request);
+    auto responseData =
+        reinterpret_cast<dcmi::GetTempReadingsResponseHdr*>(response);
+
+    if (*data_len != sizeof(dcmi::GetTempReadingsRequest))
+    {
+        log<level::ERR>("Malformed request data",
+                        entry("DATA_SIZE=%d", *data_len));
+        return IPMI_CC_REQ_DATA_LEN_INVALID;
+    }
+    *data_len = 0;
+
+    auto it = entityIdToName.find(requestData->entityId);
+    if (it == entityIdToName.end())
+    {
+        log<level::ERR>("Unknown Entity ID",
+                        entry("ENTITY_ID=%d", requestData->entityId));
+        return IPMI_CC_INVALID_FIELD_REQUEST;
+    }
+
+    if (requestData->groupID != dcmi::groupExtId)
+    {
+        log<level::ERR>("Invalid Group ID",
+                        entry("GROUP_ID=%d", requestData->groupID));
+        return IPMI_CC_INVALID_FIELD_REQUEST;
+    }
+
+    if (requestData->sensorType != dcmi::temperatureSensorType)
+    {
+        log<level::ERR>("Invalid sensor type",
+                        entry("SENSOR_TYPE=%d", requestData->sensorType));
+        return IPMI_CC_INVALID_FIELD_REQUEST;
+    }
+
+    dcmi::temp_readings::ResponseList temps{};
+    try
+    {
+        if (!requestData->entityInstance)
+        {
+            // Read all instances
+            std::tie(temps, responseData->numInstances) =
+                dcmi::temp_readings::readAll(it->second,
+                                             requestData->instanceStart);
+        }
+        else
+        {
+            // Read one instance
+            temps.resize(1);
+            std::tie(temps[0], responseData->numInstances) =
+                dcmi::temp_readings::read(it->second,
+                                          requestData->entityInstance);
+        }
+        responseData->numDataSets = temps.size();
+    }
+    catch (InternalFailure& e)
+    {
+        return IPMI_CC_UNSPECIFIED_ERROR;
+    }
+
+    responseData->groupID = dcmi::groupExtId;
+    size_t payloadSize =
+        temps.size() * sizeof(dcmi::temp_readings::Response);
+    if (!temps.empty())
+    {
+        memcpy(responseData + 1, // copy payload right after the response header
+               temps.data(),
+               payloadSize);
+    }
+    *data_len = sizeof(dcmi::GetTempReadingsResponseHdr) + payloadSize;
+
+    return IPMI_CC_OK;
+}
+
 void register_netfn_dcmi_functions()
 {
     // <Get Power Limit>
@@ -784,6 +895,11 @@
     // <Get DCMI capabilities>
     ipmi_register_callback(NETFUN_GRPEXT, dcmi::Commands::GET_CAPABILITIES,
         NULL, getDCMICapabilities, PRIVILEGE_USER);
+
+    // <Get Temperature Readings>
+    ipmi_register_callback(NETFUN_GRPEXT, dcmi::Commands::GET_TEMP_READINGS,
+                           NULL, getTempReadings, PRIVILEGE_USER);
+
     return;
 }
 // 956379
