#!/usr/bin/env python # Public Domain import glob import time # Typical reading # 73 01 4b 46 7f ff 0d 10 41 : crc=41 YES # 73 01 4b 46 7f ff 0d 10 41 t=23187 while True: print "Reading:",time.ctime() for sensor in glob.glob("/sys/bus/w1/devices/28-*/w1_slave"): id = sensor.split("/")[5] try: f = open(sensor, "r") data = f.read() f.close() if "YES" in data: (discard, sep, reading) = data.partition(' t=') t = float(reading) / 1000.0 print("{} {:.1f}".format(id, t)) else: print("999.9") except: pass #time.sleep(3.0)