{"id":150,"date":"2020-08-02T14:02:00","date_gmt":"2020-08-02T14:02:00","guid":{"rendered":"http:\/\/doctor-dark.co.uk\/blog\/2020\/08\/02\/greenhouse-computer-ravings-continued\/"},"modified":"2023-12-18T12:18:14","modified_gmt":"2023-12-18T12:18:14","slug":"greenhouse-computer-ravings-continued","status":"publish","type":"post","link":"https:\/\/doctor-dark.co.uk\/blog\/greenhouse-computer-ravings-continued\/","title":{"rendered":"Greenhouse computer ravings continued."},"content":{"rendered":"<table align=\"center\" cellpadding=\"0\" cellspacing=\"0\" style=\"float: left; margin-right: 1em; text-align: left;\">\n<tbody>\n<tr>\n<td style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" border=\"0\" data-original-height=\"1102\" data-original-width=\"1468\" height=\"300\" src=\"https:\/\/1.bp.blogspot.com\/-QOl8w8eespE\/XybEDUvWdHI\/AAAAAAABH0I\/oinwlGHgJqQWB2RJruHJ_T-gRkikfGJ4QCLcBGAsYHQ\/w400-h300\/fat%2Bman%2Bin%2Bgreenhouse.jpg\" style=\"margin-left: auto; margin-right: auto;\" title=\"Fat man in the greenhouse\" width=\"400\" \/><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">Fat man in the greenhouse.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div><\/div>\n<div>\n<div style=\"text-align: justify;\"><\/div>\n<div style=\"text-align: justify;\"><\/div>\n<div style=\"text-align: justify;\"><\/div>\n<div style=\"text-align: justify;\"><\/div>\n<div style=\"text-align: justify;\"><\/div>\n<div style=\"text-align: justify;\"><\/div>\n<div style=\"text-align: justify;\"><\/div>\n<div style=\"text-align: justify;\"><\/div>\n<div style=\"text-align: justify;\"><\/div>\n<div style=\"text-align: justify;\"><\/div>\n<div style=\"text-align: justify;\"><\/div>\n<div style=\"text-align: justify;\"><\/div>\n<div style=\"text-align: justify;\"><\/div>\n<div style=\"text-align: justify;\"><\/div>\n<div style=\"text-align: justify;\"><\/div>\n<div style=\"text-align: justify;\"><\/div>\n<div style=\"text-align: justify;\"><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-family: verdana;\">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.<\/span><\/div>\n<div style=\"text-align: justify;\"><\/div>\n<div style=\"text-align: justify;\">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.&nbsp;<\/div>\n<div><\/div>\n<div><\/div>\n<div>\n<table align=\"center\" cellpadding=\"0\" cellspacing=\"0\" style=\"float: left; margin-right: 1em; text-align: left;\">\n<tbody>\n<tr>\n<td style=\"text-align: center;\"><a href=\"https:\/\/1.bp.blogspot.com\/-hUK6iDlK51M\/XybEChSAZLI\/AAAAAAABH0A\/bknZojVPevEUnVEvVG4AxnbP8vS-BPECQCLcBGAsYHQ\/s740\/greenhouse%2Bpage.jpg\" style=\"margin-left: auto; margin-right: auto;\"><img loading=\"lazy\" decoding=\"async\" border=\"0\" data-original-height=\"313\" data-original-width=\"740\" height=\"170\" src=\"https:\/\/1.bp.blogspot.com\/-hUK6iDlK51M\/XybEChSAZLI\/AAAAAAABH0A\/bknZojVPevEUnVEvVG4AxnbP8vS-BPECQCLcBGAsYHQ\/w400-h170\/greenhouse%2Bpage.jpg\" title=\"Simple web site\" width=\"400\" \/><\/a><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">Simple web site<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span style=\"font-family: verdana;\"><\/p>\n<div style=\"text-align: justify;\">That computer runs the Apache web server, and uses the incoming readings to make a simple web page, which I can look at from my main computer&#8230;<\/div>\n<p><\/span><\/div>\n<\/div>\n<div><span style=\"font-family: verdana;\"><br \/><\/span><\/div>\n<div><span style=\"font-family: verdana;\"><br \/><\/span><\/div>\n<div><span style=\"font-family: verdana;\"><br \/><\/span><\/div>\n<div><span style=\"font-family: verdana;\"><br \/><\/span><\/div>\n<div><span style=\"font-family: verdana;\"><br \/><\/span><\/div>\n<div><span style=\"font-family: verdana;\">Code&#8230;<\/span><\/div>\n<div><span style=\"font-family: verdana;\"><br \/><\/span><\/div>\n<div>\n<div>textA = [&#8220;&lt;!doctype html&gt;n&#8221;,&#8221;&lt;html lang=&#8221;en&#8221;&gt;n&#8221;,&#8221;&lt;head&gt;n&#8221;,&#8221;&lt;meta charset=&#8221;utf-8&#8243;&gt;n&#8221;,<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#8220;&lt;title&gt;Greenhouse&lt;\/title&gt;&#8221;,&#8221;&lt;link rel=&#8221;stylesheet&#8221; href=&#8221;mystyle.css&#8221;&gt;&#8221;,<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#8220;&lt;meta http-equiv=&#8221;refresh&#8221; content=&#8221;150&#8243; &gt;&#8221;,<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#8220;&lt;\/head&gt;&#8221;,&#8221;&lt;body&gt;&#8221;,&#8221;&lt;h1&gt;Greenhouse&lt;\/h1&gt;&#8221;,&#8221;&lt;p&gt;&#8221;]<\/div>\n<div>textZ = [&#8220;&lt;\/body&gt;n&#8221;,&#8221;&lt;\/html&gt;n&#8221;]<\/div>\n<div><\/div>\n<div>def update_greenhouse_website():<\/div>\n<div>&nbsp; &nbsp; global previous_time, greenhouse_temp_file_modified<\/div>\n<div>&nbsp; &nbsp; greenhouse_temp_file_modified = os.stat(&#8216;\/home\/pi\/ftp\/files\/gth.txt&#8217;).st_mtime<\/div>\n<div>&nbsp; &nbsp; if greenhouse_temp_file_modified == previous_time:<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; #print(&#8216;Same time&#8217;)<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; textM = &#8220;No greenhouse data received.nCheck greenhouse computer!&#8221;<\/div>\n<div>&nbsp; &nbsp; else:<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; #print(&#8216;New time&#8217;)<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; fp = open(&#8216;\/home\/pi\/ftp\/files\/gth.txt&#8217;, &#8216;r&#8217;)<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; textM = fp.read()<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; fp.close()<\/div>\n<div>&nbsp; &nbsp;&nbsp;<\/div>\n<div>&nbsp; &nbsp; fp = open(&#8216;\/var\/www\/html\/greenhouse.html&#8217;, &#8216;w&#8217;)<\/div>\n<div>&nbsp; &nbsp; for line in textA:<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; fp.write(line)<\/div>\n<div>&nbsp; &nbsp; fp.write(textM)<\/div>\n<div>&nbsp; &nbsp; fp.write(&#8220;n&#8221;)<\/div>\n<div>&nbsp; &nbsp; for line in textZ:<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; fp.write(line)<\/div>\n<div>&nbsp; &nbsp; fp.close()<\/div>\n<div>&nbsp; &nbsp;&nbsp;<\/div>\n<div>&nbsp; &nbsp; previous_time = greenhouse_temp_file_modified&nbsp;&nbsp;<\/div>\n<div>&nbsp; &nbsp; return<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>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 &hellip; <a href=\"https:\/\/doctor-dark.co.uk\/blog\/greenhouse-computer-ravings-continued\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Greenhouse computer ravings continued.&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-150","post","type-post","status-publish","format-standard","hentry","category-raspberry-pi"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/doctor-dark.co.uk\/blog\/wp-json\/wp\/v2\/posts\/150","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/doctor-dark.co.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/doctor-dark.co.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/doctor-dark.co.uk\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/doctor-dark.co.uk\/blog\/wp-json\/wp\/v2\/comments?post=150"}],"version-history":[{"count":1,"href":"https:\/\/doctor-dark.co.uk\/blog\/wp-json\/wp\/v2\/posts\/150\/revisions"}],"predecessor-version":[{"id":422,"href":"https:\/\/doctor-dark.co.uk\/blog\/wp-json\/wp\/v2\/posts\/150\/revisions\/422"}],"wp:attachment":[{"href":"https:\/\/doctor-dark.co.uk\/blog\/wp-json\/wp\/v2\/media?parent=150"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/doctor-dark.co.uk\/blog\/wp-json\/wp\/v2\/categories?post=150"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/doctor-dark.co.uk\/blog\/wp-json\/wp\/v2\/tags?post=150"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}