temp: Ignore pysensors exceptions on unavailable subfeature (#624)
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
This commit is contained in:
parent
17ffa35435
commit
9818e8d750
@ -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
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user