From 2d72952e8e82ce012c3d8fa99cdd59974604dc69 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 6 Feb 2020 09:32:53 -0500 Subject: [PATCH] Guess a more specific type than Other Some implementations use 'Other' since none of the specified categories are technically Power. For such a case, when it is in W, Ws, Wm, or Wh, correctly flag them as power or energy category. Change-Id: I515f74af6fc0cf3c2d14c6f94b74a295929cf082 --- pyghmi/ipmi/sdr.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pyghmi/ipmi/sdr.py b/pyghmi/ipmi/sdr.py index 953c13c2..7dd9fdb5 100644 --- a/pyghmi/ipmi/sdr.py +++ b/pyghmi/ipmi/sdr.py @@ -393,6 +393,13 @@ class SDREntry(object): self.percent = '' if entry[15] & 1 == 1: self.percent = '% ' + if self.sensor_type_number == 0xb: + if self.unit_mod == '': + if entry[16] == 6: + self.sensor_type = 'Power' + elif self.unit_mod == ' ': + if entry[16] == 6 and entry[17] in (22, 23, 24): + self.sensor_type = 'Energy' self.baseunit = unit_types[entry[16]] self.modunit = unit_types[entry[17]] self.unit_suffix = self.percent + self.baseunit + self.unit_mod + \