summaryrefslogtreecommitdiff
path: root/redfish-core/lib/sensors.hpp
diff options
context:
space:
mode:
authorGunnar Mills <gmills@us.ibm.com>2022-04-20 22:43:45 +0300
committerEd Tanous <ed@tanous.net>2022-04-25 05:13:35 +0300
commit5deabed966f0ae5953dfb3a250a42b0046257ee8 (patch)
treec210bd1163f427917c57fdfbedc370cbce5bc5b4 /redfish-core/lib/sensors.hpp
parenteb1c47d3d98a186164ffb90214037c6062da7937 (diff)
downloadbmcweb-5deabed966f0ae5953dfb3a250a42b0046257ee8.tar.xz
Sensors: Add humidity hierarchy
As stated in PDI humidity is a valid hierarchy. https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/yaml/xyz/openbmc_project/Sensor/Value.interface.yaml From https://redfish.dmtf.org/schemas/v1/Sensor.v1_5_0.json: Humidity is a valid ReadingType and Humidity ReadingUnits shall be %. This follows the following Redfish mockup: https://redfish.dmtf.org/redfish/mockups/v1/1156 This is not under BMCWEB_NEW_POWERSUBSYSTEM_THERMALSUBSYSTEM due to not being part of the old thermal or power resources. Tested: Validator passes. See a Humidity sensor in the Sensor colleciton: { "@odata.id": "/redfish/v1/Chassis/chassis/Sensors/Relative_Humidity", "@odata.type": "#Sensor.v1_0_0.Sensor", "Id": "Relative_Humidity", "Name": "Relative Humidity", "Reading": 61.935424802658005, "ReadingRangeMax": 100.0, "ReadingRangeMin": 0.0, "ReadingType": "Humidity", "ReadingUnits": "%", ... Signed-off-by: Gunnar Mills <gmills@us.ibm.com> Change-Id: Ib1f52b0b0e3d8c4bfec8c4389c811fdb8b9d887a
Diffstat (limited to 'redfish-core/lib/sensors.hpp')
-rw-r--r--redfish-core/lib/sensors.hpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp
index ec63945d7c..58e8891eb3 100644
--- a/redfish-core/lib/sensors.hpp
+++ b/redfish-core/lib/sensors.hpp
@@ -56,6 +56,7 @@ static const boost::container::flat_map<std::string_view,
{"/xyz/openbmc_project/sensors/power",
"/xyz/openbmc_project/sensors/current",
"/xyz/openbmc_project/sensors/airflow",
+ "/xyz/openbmc_project/sensors/humidity",
#ifdef BMCWEB_NEW_POWERSUBSYSTEM_THERMALSUBSYSTEM
"/xyz/openbmc_project/sensors/voltage",
"/xyz/openbmc_project/sensors/fan_tach",
@@ -97,6 +98,10 @@ inline const char* toReadingType(const std::string& sensorType)
{
return "Percent";
}
+ if (sensorType == "humidity")
+ {
+ return "Humidity";
+ }
if (sensorType == "altitude")
{
return "Altitude";
@@ -134,7 +139,8 @@ inline const char* toReadingUnits(const std::string& sensorType)
{
return "Cel";
}
- if (sensorType == "fan_pwm" || sensorType == "utilization")
+ if (sensorType == "fan_pwm" || sensorType == "utilization" ||
+ sensorType == "humidity")
{
return "%";
}