- systemp = feature.get_value()
- logger.debug("found sys input " + feature.label + " at temp " + str(feature.get_value()))
- logger.debug("Core temp data is: " + str(coretemps))
-# core_avg = reduce(lambda x, y: x[1] + y[1], coretemps) / len(coretemps)
- core_avg = sum(core[1] for core in coretemps) / len(coretemps)
- logger.debug("average cpu temp is " + str(core_avg))
- coretemps.append(["avg", str(core_avg)])
- coretemps.append(["pkg", pkgtemp])
- coretemps = [x[0] + ": " + str(x[1]) + DEG + CEL for x in coretemps]
+ systemp_data.items.append([feature.label, str(feature.get_value())])
+ logger.debug("Found sys input " + feature.label + " at temp " + str(feature.get_value()))
+
+ for temp_data in [systemp_data, coretemp_data, pkgtemp_data]:
+ if len(temp_data.items) > 1:
+ avg = sum(feature[1] for feature in temp_data.items) / len(temp_data.items)
+ logger.debug("Avg temp for {0} is {1} {2}{3}".format(temp_data.subtitle, str(avg), DEG, CEL))
+ temp_data.subtitle += " (avg {0}{1}{2}):".format(str(avg), DEG, CEL)
+ temp_data.items = ["{0}: {1}{2}{3}".format(feature[0], feature[1], DEG, CEL) for feature in temp_data]
+ else:
+ temp_data.items = temp_data[0][1] + DEG + CEL
+ section.append_data(temp_data)
+