#!/usr/bin/python -O


import time


timestamp = time.strftime("%d-%m-%Y,%H:%M:%S")

logname = time.strftime("%d-%m-%Y")

filename = "".join(["temp_log_", logname, ".txt"])

datafile = open(filename, "a")

tfile = open("/sys/bus/w1/devices/28-000003f1cede/w1_slave")

text = tfile.read()

tfile.close()

temperature_data = text.split()[-1]

temperature = float(temperature_data[2:])

temperature = temperature / 1000

datafile.write(timestamp + "," + str(temperature) + ",\n")

datafile.close()
