Add Accuracy property to sensors
Base on Sensor.v1_2_0.json[1], add the Accuracy property to sensors.
At present, the D-Bus interface[2] has been exposed in the
phosphor-hwmon repo[3], and this function will be synchronized to the
dbus-sensor repo in the future.
[1]http://redfish.dmtf.org/schemas/v1/Sensor.v1_2_0.json
[2]https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/53569
[3]https://gerrit.openbmc.org/c/openbmc/phosphor-hwmon/+/57839
Tested: built bmcweb successfully and validator passes
get Accuracy:
curl -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/
Chassis/chassis/Sensors/temperature_inlet
{
"@odata.id": "/redfish/v1/Chassis/chassis/Sensors/temperature_inlet",
"@odata.type": "#Sensor.v1_2_0.Sensor",
"Accuracy": 5.0,
"Id": "Sensors_inlet",
"Name": "inlet",
...
}
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: Ie51356d810f63ba70c56ce702d6bbeb97e279530
diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp
index 697bf0d..b87c060 100644
--- a/redfish-core/lib/sensors.hpp
+++ b/redfish-core/lib/sensors.hpp
@@ -895,6 +895,8 @@
"/ReadingRangeMin"_json_pointer);
properties.emplace_back("xyz.openbmc_project.Sensor.Value", "MaxValue",
"/ReadingRangeMax"_json_pointer);
+ properties.emplace_back("xyz.openbmc_project.Sensor.Accuracy",
+ "Accuracy", "/Accuracy"_json_pointer);
}
else if (sensorType == "temperature")
{