![]() |
Fat man in the greenhouse. |
In the end, I got fed up with the temperate readings being messed up by the Sense HAT being inside the case, and no cooling fan being able to keep its sensors cool enough. I dispensed with the Sense HAT, which I will find some other use for, and put a cheap temperature and humidity sensor on wires lead out of the case.
Having arranged a shade to keep direct sunlight off the sensor, I now get sensible readings. I missed being able to look at the greenhouse and see the temperature scroll past, so I had the computer report temperature and humidity to another Pi indoors.
Code…
textA = [“<!doctype html>n”,”<html lang=”en”>n”,”<head>n”,”<meta charset=”utf-8″>n”,
“<title>Greenhouse</title>”,”<link rel=”stylesheet” href=”mystyle.css”>”,
“<meta http-equiv=”refresh” content=”150″ >”,
“</head>”,”<body>”,”<h1>Greenhouse</h1>”,”<p>”]
textZ = [“</body>n”,”</html>n”]
def update_greenhouse_website():
global previous_time, greenhouse_temp_file_modified
greenhouse_temp_file_modified = os.stat(‘/home/pi/ftp/files/gth.txt’).st_mtime
if greenhouse_temp_file_modified == previous_time:
#print(‘Same time’)
textM = “No greenhouse data received.nCheck greenhouse computer!”
else:
#print(‘New time’)
fp = open(‘/home/pi/ftp/files/gth.txt’, ‘r’)
textM = fp.read()
fp.close()
fp = open(‘/var/www/html/greenhouse.html’, ‘w’)
for line in textA:
fp.write(line)
fp.write(textM)
fp.write(“n”)
for line in textZ:
fp.write(line)
fp.close()
previous_time = greenhouse_temp_file_modified
return