{"id":921,"date":"2021-09-29T23:46:27","date_gmt":"2021-09-29T22:46:27","guid":{"rendered":"https:\/\/blog.pgregg.com\/blog\/?p=921"},"modified":"2021-09-29T23:56:16","modified_gmt":"2021-09-29T22:56:16","slug":"raspberry-pi-central-heating-controller-part-2-software","status":"publish","type":"post","link":"https:\/\/blog.pgregg.com\/blog\/2021\/09\/raspberry-pi-central-heating-controller-part-2-software\/","title":{"rendered":"Raspberry Pi Central Heating Controller, part 2 &#8211; Software"},"content":{"rendered":"\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>If you haven&#8217;t seen part 1, the hardware build, you can find that at <a href=\"https:\/\/blog.pgregg.com\/blog\/2018\/11\/building-a-raspberry-pi-based-central-heating-controller\/\">https:\/\/blog.pgregg.com\/blog\/2018\/11\/building-a-raspberry-pi-based-central-heating-controller\/<\/a><\/p><\/blockquote>\n\n\n\n<p><\/p>\n\n\n\n<p>Software installation (Incomplete: I really need to figure out how to use wordpress properly)<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Raspian Lite<\/li><li>python3-dev<\/li><\/ul>\n\n\n\n<p>When the Pi boots up, the GPIO pins will not be configured &#8211; but the relay board is getting 5V and 3V3 feeds.<br>This causes a little bleed on current &#8211; so we can fix this by pulling the GPIO pins we are using High (3.3V) &#8211; you&#8217;ll see this on the little leds on the relay board &#8211; they will be very slightly lit.<br><\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><code><br>cat - &gt; \/usr\/local\/bin\/relayreset.py<br>#!\/usr\/bin\/env python<\/code><\/p><p>import RPi.GPIO as GPIO<br>import time<\/p><p>GPIO.setmode(GPIO.BCM) # GPIO Numbers instead of board numbers<br>GPIO.setwarnings(False)<\/p><p>GPIO_RELAY1 = 17<br>GPIO_RELAY2 = 18<br>GPIO_RELAY3 = 27<br>GPIO_RELAY4 = 22<\/p><p><code>GPIO.setup(GPIO_RELAY1, GPIO.OUT)<br>GPIO.output(GPIO_RELAY1, GPIO.HIGH)<br>GPIO.setup(GPIO_RELAY2, GPIO.OUT)<br>GPIO.output(GPIO_RELAY2, GPIO.HIGH)<br>GPIO.setup(GPIO_RELAY3, GPIO.OUT)<br>GPIO.output(GPIO_RELAY3, GPIO.HIGH)<br>GPIO.setup(GPIO_RELAY4, GPIO.OUT)<br>GPIO.output(GPIO_RELAY4, GPIO.HIGH)<br>time.sleep(1)<br>GPIO.cleanup()<br><\/code><br><code>chmod a+x \/usr\/local\/bin\/relayreset.py<\/code><\/p><\/blockquote>\n\n\n\n<p>HomeAssistant Install:&nbsp;https:\/\/www.home-assistant.io\/docs\/installation\/raspberry-pi\/<\/p>\n\n\n\n<p><code>sudo apt-get install python3 python3-venv python3-pip&nbsp;python3-dev<br>sudo useradd -rm homeassistant -G dialout,gpio<br>cd \/srv<br>sudo mkdir homeassistant<br>sudo chown homeassistant:homeassistant homeassistant<br><\/code><\/p>\n\n\n\n<p><code>sudo -u homeassistant -H -s<br>cd \/srv\/homeassistant<br>python3 -m venv .<br>source bin\/activate<\/code><\/p>\n\n\n\n<p><code>python3 -m pip install wheel<br>pip3 install homeassistant<br><\/code><\/p>\n\n\n\n<p>And run HomeAssistant:<br><code>hass<\/code><\/p>\n\n\n\n<p>Or Install hass as a service:<br><code>cat - &gt; \/etc\/systemd\/system\/home-assistant@homeassistant.service<br>[Unit]<br>Description=Home Assistant<br>After=network-online.target<br>[Service]<br>Type=simple<br>User=%i<br>ExecStart=\/srv\/homeassistant\/bin\/hass -c \"\/home\/homeassistant\/.homeassistant\"<br>[Install]<br>WantedBy=multi-user.target<br>CTRL-D<br><\/code><\/p>\n\n\n\n<p>If you prefer systemV style init scripts:<br><code><br>TODO<br><\/code><\/p>\n\n\n\n<p>Make it run at startup:<br><code>sudo systemctl --system daemon-reload<br>sudo systemctl enable home-assistant@homeassistant<\/code><\/p>\n\n\n\n<p>Start the hass service:<br><code>sudo systemctl start home-assistant@homeassistant<\/code><\/p>\n\n\n\n<p>View the homeassistant logs:<br><code>sudo journalctl -f -u home-assistant@homeassistant<\/code><\/p>\n\n\n\n<p>Visit the hass web interface:<br>https:\/\/yourpi:8123<\/p>\n\n\n\n<p>Updating HomeAssistant<br><code>sudo -u homeassistant -H -s<br>source \/srv\/homeassistant\/bin\/activate<br>pip3 install --upgrade homeassistant<\/code><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>I used a Google Calendar as a scheduler.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>TODO: More config on homeassistant.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you haven&#8217;t seen part 1, the hardware build, you can find that at https:\/\/blog.pgregg.com\/blog\/2018\/11\/building-a-raspberry-pi-based-central-heating-controller\/ Software installation (Incomplete: I really need to figure out how to use wordpress properly) Raspian Lite python3-dev When the Pi boots up, the GPIO pins will not be configured &#8211; but the relay board is getting 5V and 3V3 feeds.This &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.pgregg.com\/blog\/2021\/09\/raspberry-pi-central-heating-controller-part-2-software\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Raspberry Pi Central Heating Controller, part 2 &#8211; Software&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-921","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pbQOUu-eR","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/blog.pgregg.com\/blog\/wp-json\/wp\/v2\/posts\/921","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.pgregg.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.pgregg.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.pgregg.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.pgregg.com\/blog\/wp-json\/wp\/v2\/comments?post=921"}],"version-history":[{"count":8,"href":"https:\/\/blog.pgregg.com\/blog\/wp-json\/wp\/v2\/posts\/921\/revisions"}],"predecessor-version":[{"id":954,"href":"https:\/\/blog.pgregg.com\/blog\/wp-json\/wp\/v2\/posts\/921\/revisions\/954"}],"wp:attachment":[{"href":"https:\/\/blog.pgregg.com\/blog\/wp-json\/wp\/v2\/media?parent=921"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.pgregg.com\/blog\/wp-json\/wp\/v2\/categories?post=921"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.pgregg.com\/blog\/wp-json\/wp\/v2\/tags?post=921"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}