def get_sensors():
import sensors<EOL>found_sensors = list()<EOL>def get_subfeature_value(feature, subfeature_type):<EOL><INDENT>subfeature = chip.get_subfeature(feature, subfeature_type)<EOL>if subfeature:<EOL><INDENT>return chip.get_value(subfeature.number)<EOL><DEDENT><DEDENT>for chip in sensors.get_detected_chips():<EOL><INDENT>for feature in chip.get_features():<EOL><INDENT>if feature.type == sensors.FEATURE_TEMP:<EOL><INDENT>try:<EOL><INDENT>name = chip.get_label(feature)<EOL>max = get_subfeature_value(feature, sensors.SUBFEATURE_TEMP_MAX)<EOL>current = get_subfeature_value(feature, sensors.SUBFEATURE_TEMP_INPUT)<EOL>critical = get_subfeature_value(feature, sensors.SUBFEATURE_TEMP_CRIT)<EOL>if critical:<EOL><INDENT>found_sensors.append(Sensor(name=name, current=current, maximum=max, critical=critical))<EOL><DEDENT><DEDENT>except sensors.SensorsException:<EOL><INDENT>continue<EOL><DEDENT><DEDENT><DEDENT><DEDENT>return found_sensors<EOL>
Detect and return a list of Sensor objects