Here in my city (Sevilla) Spain makes a lot of heat and wanted to know navio2 temperature in flight create this script that I want to share.
> #Python scripts created for good or ill by juan jose casto moreno
> import commands
> import time
> def get_cpu_temp():
> tempFile = open( "/sys/class/thermal/thermal_zone0/temp" )
> cpu_temp = tempFile.read()
> tempFile.close()
> return float(cpu_temp)/1000
> data = open("temp.txt", "w") #This is the file where temperatures are stored and rewrites on every restart.
> data.write("%s,%s\n" % (get_cpu_temp(),time.strftime("%b %d %Y %H:%M:%S")))
> data.close()
> time.sleep(5)#Time between readings is changed here
> for i in range(200):# Number of readings to take is changed here.
> data = open("temp.txt", "a")
> data.write("%s,%s\n" % (get_cpu_temp(),time.strftime("%b %d %Y %H:%M:%S")))
> data.close()
> time.sleep(5)#Time between readings is changed here
Save file as temp.py and give permissions.
Run with sudo python ./temp.py.
Temp.txt creates a file that keeps the temperature, time and date of each reading.
Sorry for my bad English.
Greetings and thanks.