From c0927c9f2e57cea2cd5e4d71af2b6a4493a03d83 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 20 Jul 2023 08:29:05 -0400 Subject: [PATCH] Add missing class to generic redfish support Change-Id: I4d9c2cb163ba0f8f3e4b1c878b1dec26ae8f7422 --- pyghmi/redfish/oem/generic.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/pyghmi/redfish/oem/generic.py b/pyghmi/redfish/oem/generic.py index 13a479ca..60dff73c 100644 --- a/pyghmi/redfish/oem/generic.py +++ b/pyghmi/redfish/oem/generic.py @@ -21,6 +21,25 @@ import pyghmi.constants as const import pyghmi.exceptions as exc import pyghmi.media as media +class SensorReading(object): + def __init__(self, healthinfo, sensor=None, value=None, units=None, + unavailable=False): + if sensor: + self.name = sensor['name'] + else: + self.name = healthinfo['Name'] + self.health = _healthmap.get(healthinfo.get( + 'Status', {}).get('Health', None), const.Health.Warning) + self.states = [healthinfo.get('Status', {}).get('Health', + 'Unknown')] + self.health = _healthmap[healthinfo['Status']['Health']] + self.states = [healthinfo['Status']['Health']] + self.value = value + self.state_ids = None + self.imprecision = None + self.units = units + self.unavailable = unavailable + _healthmap = { 'Critical': const.Health.Critical, 'Unknown': const.Health.Warning,