Handle hddtemp error

"|/dev/sdX|???|ERR|*|%"
pull/726/head
Alessio Sergi 2015-11-18 11:11:55 +01:00
parent f1162e65b8
commit c6c32513dc
2 changed files with 4 additions and 4 deletions

View File

@ -116,10 +116,10 @@ class GlancesGrabHDDTemp(object):
offset = item * 5
hddtemp_current = {}
device = os.path.basename(nativestr(fields[offset + 1]))
temperature = float(fields[offset + 3])
temperature = fields[offset + 3]
unit = nativestr(fields[offset + 4])
hddtemp_current['label'] = device
hddtemp_current['value'] = temperature
hddtemp_current['value'] = float(temperature) if temperature != b'ERR' else temperature
hddtemp_current['unit'] = unit
self.hddtemp_list.append(hddtemp_current)

View File

@ -183,7 +183,7 @@ class Plugin(GlancesPlugin):
ret.append(self.curse_add_line(msg, "TITLE"))
for i in self.stats:
if i['value']:
if i['value'] != b'ERR':
# New line
ret.append(self.curse_new_line())
# Alias for the lable name ?
@ -250,7 +250,7 @@ class GlancesGrabSensors(object):
try:
sensors_current['label'] = feature.label
sensors_current['value'] = int(feature.get_value())
except Exception as e:
except SensorsError as e:
logger.debug("Cannot grab sensor stat(%s)" % e)
else:
self.sensors_list.append(sensors_current)