From ba3edc2c0220200c92773a4ef9187b15fb7ff907 Mon Sep 17 00:00:00 2001 From: Markus Hilger Date: Fri, 14 Aug 2026 02:44:58 +0200 Subject: [PATCH] Match sensor categories against modern redfish sensors A caller asking for fans or energy got nothing from any bmc that serves the Sensors collection. Those sensors were filed under their redfish reading type, Rotational for a fan, while the categories are named after the ipmi sensor types the rest of the code uses, so nothing matched. Power appeared to work only by coincidence, Power and Current happening to be spelled the same in both vocabularies. Translate the reading type as the sensor is mapped, so a sensor means the same thing whether it came from the Sensors collection, from the older Thermal and Power documents, or from ipmi. On the bmc this was found on, fans go from nothing to the 24 tachometers, and temperature and power already agreed with what the same hardware reports over ipmi. The fan controls stay out, and cannot be brought in. Their reading type is Percent, which is also what a battery state of health reports, and this bmc fills in no PhysicalContext to tell them apart, so there is nothing to classify them by that would not also drag in unrelated percentages. --- confluent_server/aiohmi/redfish/command.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/confluent_server/aiohmi/redfish/command.py b/confluent_server/aiohmi/redfish/command.py index 1d9494b8..66ee07ae 100644 --- a/confluent_server/aiohmi/redfish/command.py +++ b/confluent_server/aiohmi/redfish/command.py @@ -68,6 +68,23 @@ _healthmap = { None: const.Health.Ok, } +# A sensor from the modern Sensors collection describes itself by its redfish +# reading type, while a sensor from the older Thermal and Power documents, and +# every sensor over ipmi, is described by the ipmi sensor type. Callers ask +# for a category by the latter, so translate, and a sensor means the same thing +# whichever document it was read from. +_readingtypes = { + 'Temperature': 'Temperature', + 'Rotational': 'Fan', + 'AirFlow': 'Cooling Device', + 'Voltage': 'Voltage', + 'Current': 'Current', + 'Power': 'Power', + 'EnergyJoules': 'Energy', + 'EnergykWh': 'Energy', + 'EnergyWh': 'Energy', +} + def _mask_to_cidr(mask): maskn = socket.inet_pton(socket.AF_INET, mask) @@ -719,6 +736,7 @@ class Command(object): sensedata = await self._do_web_request(sensor['@odata.id']) if 'Name' in sensedata: sensetype = sensedata.get('ReadingType', 'Unknown') + sensetype = _readingtypes.get(sensetype, sensetype) self._varsensormap[sensedata['Name']] = { 'name': sensedata['Name'], 'type': sensetype, 'url': sensor['@odata.id'], 'generic': True}