local INLET_TEMP_NAME<const> = 'Inlet Temp'
local CPU_TEMP_NAME<const> = 'CPU.* Core Rem'
local sensors = ProcessingFlow[1].Destination.SensorList or {}
local temperature_list = {}
local index = 1
table.sort(sensors, function(a, b)
return a.SensorName < b.SensorName
end)
for _, v in pairs(sensors) do
local temp_obj = ''
if v.SensorIdentifier == INLET_TEMP_NAME then
temp_obj = 'Inlet'
end
if string.match(v.SensorIdentifier, CPU_TEMP_NAME) then
temp_obj = string.sub(v.SensorIdentifier, 1, 4)
end
if temp_obj ~= '' then
temperature_list[#temperature_list + 1] = {
temperatureIndex = index,
temperatureObject = temp_obj,
temperatureReading = v.SensorReading == 'na' and 65535 or tonumber(v.SensorReading) * 10,
temperatureUpperNonRecoverable = v.UpperThresholdFatal ==
'null' and 65535 or tonumber(v.UpperThresholdFatal) * 10,
temperatureUpperCritical = v.UpperThresholdCritical ==
'null' and 65535 or tonumber(v.UpperThresholdCritical) * 10,
temperatureUpperMinor = v.UpperThresholdNonCritical ==
'null' and 65535 or tonumber(v.UpperThresholdNonCritical) * 10
}
index = index + 1
end
end
return temperature_list