mirror of
https://opendev.org/x/pyghmi
synced 2026-03-27 21:33:31 +00:00
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
This commit is contained in:
@@ -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 + \
|
||||
|
||||
Reference in New Issue
Block a user