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
diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp
index ec63945..58e8891 100644
--- a/redfish-core/lib/sensors.hpp
+++ b/redfish-core/lib/sensors.hpp
@@ -56,6 +56,7 @@
{"/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 @@
{
return "Percent";
}
+ if (sensorType == "humidity")
+ {
+ return "Humidity";
+ }
if (sensorType == "altitude")
{
return "Altitude";
@@ -134,7 +139,8 @@
{
return "Cel";
}
- if (sensorType == "fan_pwm" || sensorType == "utilization")
+ if (sensorType == "fan_pwm" || sensorType == "utilization" ||
+ sensorType == "humidity")
{
return "%";
}