def _create_definitions(self): for type in ORDER: for chip in sensors.iter_detected_chips(): prefix = '_'.join(str(chip.path.decode()).split('/')[3:]) name = "" lines = [] pref = str(chip.prefix.decode()) if len(self.chips) != 0 and not any([ex.startswith(pref) for ex in self.chips]): continue for feature in chip: try: float(feature.get_value()) except ValueError: continue if feature.get_value() < 0: continue if sensors.TYPE_DICT[feature.type] == type: name = pref + "_" + sensors.TYPE_DICT[feature.type] if name not in self.order: options = list(CHARTS[type]['options']) options[1] = pref + options[1] self.definitions[name] = {'options': options} self.definitions[name]['lines'] = [] self.order.append(name) line = list(CHARTS[type]['lines'][0]) line[0] = prefix + "_" + str(feature.name.decode()) line[1] = str(feature.label) self.definitions[name]['lines'].append(line)
def _create_definitions(self): for type in ORDER: for chip in sensors.iter_detected_chips(): prefix = '_'.join(str(chip.path.decode()).split('/')[3:]) name = "" lines = [] pref = str(chip.prefix.decode()) if len(self.chips) != 0 and not any( [ex.startswith(pref) for ex in self.chips]): continue pref = pref + '_' + str(chip.addr) for feature in chip: try: float(feature.get_value()) except ValueError: continue if feature.get_value() < 0: continue if sensors.TYPE_DICT[feature.type] == type: name = pref + "_" + sensors.TYPE_DICT[feature.type] if name not in self.order: options = list(CHARTS[type]['options']) options[1] = pref + options[1] self.definitions[name] = {'options': options} self.definitions[name]['lines'] = [] self.order.append(name) line = list(CHARTS[type]['lines'][0]) line[0] = prefix + "_" + str(feature.name.decode()) line[1] = str(feature.label) self.definitions[name]['lines'].append(line)
def _get_data(self): data = {} try: for chip in sensors.iter_detected_chips(): prefix = '_'.join(str(chip.path.decode()).split('/')[3:]) lines = {} for feature in chip: data[prefix + "_" + str(feature.name.decode())] = feature.get_value() * 1000 except Exception as e: self.error(e) return None if len(data) == 0: return None return data
def _get_data(self): data = {} try: for chip in sensors.iter_detected_chips(): prefix = '_'.join(str(chip.path.decode()).split('/')[3:]) lines = {} for feature in chip: data[prefix + "_" + str( feature.name.decode())] = feature.get_value() * 1000 except Exception as e: self.error(e) return None if len(data) == 0: return None return data