Code: Select all
#!/usr/bin/python
#Open the temperature sensor and read it and process the result
tfile = open("/sys/bus/w1/devices/28-000004757789/w1_slave")
text = tfile.read()
tfile.close()
temperature_data = text.split()[-1]
temperature = float(temperature_data[2:])
temperature = temperature / 1000
out_file = open("7784.txt","w")
out_file.write(str(temperature))
out_file.close()

I permessi dello script e del file sul quale lo scipt deve lavorare sono questi:

Qualche suggerimento?