{"id":1859,"date":"2021-02-09T08:41:07","date_gmt":"2021-02-09T14:41:07","guid":{"rendered":"https:\/\/www.dalemorin.com\/?p=1859"},"modified":"2021-03-08T08:13:25","modified_gmt":"2021-03-08T14:13:25","slug":"raspberry-pi-project-tweaks","status":"publish","type":"post","link":"https:\/\/www.dalemorin.com\/?p=1859","title":{"rendered":"Raspberry Pi project &#8211; tweaks"},"content":{"rendered":"<p>My temperature monitoring project has been running very well, especially since I corrected the humidity sensor readings by applying a correction factor.\u00a0 And the upstairs temperatures did drop below freezing a couple of days ago, so the tasks of shutting off the pump, draining the plumbing, and adding antifreeze in the traps were absolutely worthwhile.<\/p>\n<p>But I decided that it would be nice to know when some threshold temperatures were reached without checking the web page.\u00a0 I added code to the python3 logger script to write a file when a cold or heat threshold was reached.\u00a0 It also sends an alert email message when this happens.\u00a0 The web page that displays the temperature and humidity graphs looks for this file and indicates that a threshold has been crossed for cold or hot temperatures.<\/p>\n<p>It seems the DHT22 sensors can waver back and forth a few tenths of a degree, and if that happens right at one of your threshold values, you will get an annoying collection of emails.\u00a0 To address this, I implemented a buffer mechanism.\u00a0 Now, the heat\/cold alert will only happen when the temperature crosses the threshold and stays there for 3 consecutive checks.\u00a0 Since I&#8217;m logging the values every 5 minutes, that means the temperature must remain either above (heat) or below (cold) for at least 10 minutes before an alert is sent.\u00a0 When the temperature rises above the cold threshold, it must remain above the threshold for 3 consecutive checks before the alert is rescinded.\u00a0 Rescinding a heat threshold works the same way.<\/p>\n<p>I also added some code to rescind any existing cold or heat alerts when the logging daemon is restarted.\u00a0 Since you can edit the threshold temperatures, it seems reasonable to start clean.\u00a0 If an alert should be issued, it will take just a few minutes to get past the buffer mechanism.<\/p>\n<p>So far this is working well.\u00a0 On my next trip up there, I&#8217;ll recheck the sensors using the hygrometer and see if any alterations to the correction factors are needed.\u00a0 If they are, it&#8217;s a trivial change to make.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>My temperature monitoring project has been running very well, especially since I corrected the humidity sensor readings by applying a correction factor.\u00a0 And the upstairs temperatures did drop below freezing a couple of days ago, so the tasks of shutting off the pump, draining the plumbing, and adding antifreeze in the traps were absolutely worthwhile. &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.dalemorin.com\/?p=1859\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Raspberry Pi project &#8211; tweaks&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[55],"tags":[],"class_list":["post-1859","post","type-post","status-publish","format-standard","hentry","category-raspberry-pi"],"_links":{"self":[{"href":"https:\/\/www.dalemorin.com\/index.php?rest_route=\/wp\/v2\/posts\/1859","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dalemorin.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dalemorin.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dalemorin.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dalemorin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1859"}],"version-history":[{"count":8,"href":"https:\/\/www.dalemorin.com\/index.php?rest_route=\/wp\/v2\/posts\/1859\/revisions"}],"predecessor-version":[{"id":1926,"href":"https:\/\/www.dalemorin.com\/index.php?rest_route=\/wp\/v2\/posts\/1859\/revisions\/1926"}],"wp:attachment":[{"href":"https:\/\/www.dalemorin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1859"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dalemorin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1859"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dalemorin.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1859"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}