Ejemplo n.º 1
0
def coretemp():
    rv = {}
    for chip in sensors.ChipIterator():
        chipname = sensors.chip_snprintf_name(chip)
        if "temp" not in chipname:
            continue

        chipdata = {}
        for feature in sensors.FeatureIterator(chip):
            label = sensors.get_label(chip, feature)

            sfs = list(sensors.SubFeatureIterator(chip, feature)) # get a list of all subfeatures
            vals = [sensors.get_value(chip, sf.number) for sf in sfs]
            names = [sf.name[len(feature.name)+1:].decode("utf-8") for sf in sfs]

            data = dict(zip(names, vals))
            # We use the label instead of the name because the name is typically unhelpful.
            chipdata[sanitizeName(label)] = data["input"]
        
        rv[chipname] = chipdata
    
    return rv
Ejemplo n.º 2
0
def get_temp():
    sensors.init()
    temp = 0
    try:
        for chip in sensors.ChipIterator():
            for feature in sensors.FeatureIterator(chip):
                subs = list(sensors.SubFeatureIterator(chip, feature))
                try:
                    sensor_temp = sensors.get_value(chip, subs[0].number)
                    # el 200 es por que en las maquinas de desarrollo devuelve
                    # los RPM de los ventiladores como features. Esta es la
                    # solucion menos compleja para descartar ese valor.
                    if sensor_temp < 200 and sensor_temp > temp:
                        temp = sensor_temp
                except Exception:
                    # alguno de los sensores no se pudo leer. en circunstancias
                    # normales no pasa pero atajamoe el error para que siga con
                    # el resto de las featuras
                    pass
    finally:
        sensors.cleanup()

    return temp
Ejemplo n.º 3
0
            end = time.time()
            temp = end - start
            minutes = temp // 60
            #print(minutes)
            if minutes > 15:
                rep = 1
                critical_alarm0 = 0
                critical_alarm1 = 0
                critical_alarm2 = 0
                critical_alarm3 = 0
                critical_alarm4 = 0
                critical_alarm5 = 0
    #print("*********************************")
        print "Time :  %f " % time.time()
        cnt = 0
        for chip in sensors.ChipIterator(
        ):  # optional arg like "coretemp-*" restricts iterator
            #print(sensors.chip_snprintf_name(chip)+" ("+sensors.get_adapter_name(chip.bus)+")")
            print("*********************************")
            for feature in sensors.FeatureIterator(chip):
                #print_feature(chip, feature)
                #value = sensors.get_value(chip, feature.number)

                #print(value)
                #print(feature.number)
                if cnt == 1:
                    coretemp[0] = sensors.get_value(chip, 4)
                    coretemp[1] = sensors.get_value(chip, 8)
                    coretemp[2] = sensors.get_value(chip, 12)
                    coretemp[3] = sensors.get_value(chip, 16)
                    coretemp[4] = sensors.get_value(chip, 20)
                    coretemp[5] = sensors.get_value(chip, 24)