Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 25 lines (19 sloc) 707 Bytes
import re
filename = '/sys/devices/w1_bus_master1/28-05168661eaff/w1_slave'
valid = False
print "Content-Type: text/plain"
print ""
# execute the command and parse each line of output
with open(filename) as f:
for line in f:
if'crc=.*YES', line):
# the CRC is valid. Continue processing
valid = True
if valid and't=[0-9]+', line):
# extract the temperature value
temperature ='t=([0-9]+)', line)
# convert to degrees celsius and keep 1 digit of accuracy
output = "%.1f" % (float(
print output
You can’t perform that action at this time.