temp: Ignore pysensors exceptions on unavailable subfeature (#624)

Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
This commit is contained in:
Johannes Löthberg 2017-11-20 08:08:21 +01:00 committed by Facetoe
parent 17ffa35435
commit 9818e8d750

View File

@ -42,12 +42,15 @@ def get_sensors():
for chip in sensors.get_detected_chips():
for feature in chip.get_features():
if feature.type == sensors.FEATURE_TEMP:
name = chip.get_label(feature)
max = get_subfeature_value(feature, sensors.SUBFEATURE_TEMP_MAX)
current = get_subfeature_value(feature, sensors.SUBFEATURE_TEMP_INPUT)
critical = get_subfeature_value(feature, sensors.SUBFEATURE_TEMP_CRIT)
if critical:
found_sensors.append(Sensor(name=name, current=current, maximum=max, critical=critical))
try:
name = chip.get_label(feature)
max = get_subfeature_value(feature, sensors.SUBFEATURE_TEMP_MAX)
current = get_subfeature_value(feature, sensors.SUBFEATURE_TEMP_INPUT)
critical = get_subfeature_value(feature, sensors.SUBFEATURE_TEMP_CRIT)
if critical:
found_sensors.append(Sensor(name=name, current=current, maximum=max, critical=critical))
except sensors.SensorsException:
continue
return found_sensors