+def readsensor(sensorID):
+ sensorfile = "/sys/bus/w1/devices/28-{}/w1_slave".format(sensorID)
+ file = open(sensorfile)
+
+ # Inhalt des Sensors:
+ # 64 01 4b 46 7f ff 0c 10 01 : crc=01 YES
+ # 64 01 4b 46 7f ff 0c 10 01 t=22250
+
+ # Suche nach YES
+ linecrc = file.readline()
+ match = re.search(": crc=[0-9a-f]{2} (YES|NO)",linecrc)
+
+ yesno = match.group(1)
+ if yesno != "YES":
+ sys.exit(1)
+
+ # Temperatur raus
+ linetemp = file.readline()
+ match = re.search(" t=([-0-9]+)",linetemp)