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 chip in sensors.get_detected_chips():
|
||||||
for feature in chip.get_features():
|
for feature in chip.get_features():
|
||||||
if feature.type == sensors.FEATURE_TEMP:
|
if feature.type == sensors.FEATURE_TEMP:
|
||||||
name = chip.get_label(feature)
|
try:
|
||||||
max = get_subfeature_value(feature, sensors.SUBFEATURE_TEMP_MAX)
|
name = chip.get_label(feature)
|
||||||
current = get_subfeature_value(feature, sensors.SUBFEATURE_TEMP_INPUT)
|
max = get_subfeature_value(feature, sensors.SUBFEATURE_TEMP_MAX)
|
||||||
critical = get_subfeature_value(feature, sensors.SUBFEATURE_TEMP_CRIT)
|
current = get_subfeature_value(feature, sensors.SUBFEATURE_TEMP_INPUT)
|
||||||
if critical:
|
critical = get_subfeature_value(feature, sensors.SUBFEATURE_TEMP_CRIT)
|
||||||
found_sensors.append(Sensor(name=name, current=current, maximum=max, critical=critical))
|
if critical:
|
||||||
|
found_sensors.append(Sensor(name=name, current=current, maximum=max, critical=critical))
|
||||||
|
except sensors.SensorsException:
|
||||||
|
continue
|
||||||
return found_sensors
|
return found_sensors
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user