{"id":606,"date":"2019-06-05T10:20:44","date_gmt":"2019-06-05T02:20:44","guid":{"rendered":"https:\/\/www.sumju.net\/?p=606"},"modified":"2019-12-20T10:47:51","modified_gmt":"2019-12-20T02:47:51","slug":"%e6%a0%91%e8%8e%93%e6%b4%be-%e6%96%90%e8%ae%afn1-armbian-%e5%ae%89%e8%a3%85home-assistant","status":"publish","type":"post","link":"https:\/\/sumju.net\/?p=606","title":{"rendered":"\u6811\u8393\u6d3e\/\u6590\u8bafN1\/Armbian\/\u5b89\u88c5Home Assistant"},"content":{"rendered":"<p>\u89c6\u9891\u6559\u7a0b\u5982\u4e0b\uff1a<br \/>\n<a href=\"https:\/\/youtu.be\/CeiW-G1ghPc\" rel=\"noopener noreferrer\" target=\"_blank\">https:\/\/youtu.be\/CeiW-G1ghPc<\/a><\/p>\n<p><a href=\"https:\/\/www.youtube.com\/channel\/UCf8MbF6J9xWf1m9guutozlw?sub_confirmation=1\">\u66f4\u591a\u89c6\u9891\u6559\u7a0b\u8bf7\u70b9\u8fd9\u91cc<\/a><\/p>\n<p>1.\u6811\u8393\u6d3e\u66f4\u6362\u56fd\u5185apt\u6e90(\u53ef\u9009\uff0c\u4e2d\u56fd\u5927\u9646\u5fc5\u987b)<\/p>\n<p><code>sudo su<\/code><br \/>\n<code>echo 'deb http:\/\/mirrors.tuna.tsinghua.edu.cn\/raspbian\/raspbian\/ stretch main contrib non-free rpi' &gt; \/etc\/apt\/sources.list<\/code><br \/>\n<code>echo 'deb-src http:\/\/mirrors.tuna.tsinghua.edu.cn\/raspbian\/raspbian\/ stretch main contrib non-free rpi' &gt;&gt; \/etc\/apt\/sources.list<\/code><br \/>\n<code>echo 'deb http:\/\/mirror.tuna.tsinghua.edu.cn\/raspberrypi\/ stretch main ui' &gt; \/etc\/apt\/sources.list.d\/raspi.list<\/code><br \/>\n<code>echo 'deb-src http:\/\/mirror.tuna.tsinghua.edu.cn\/raspberrypi\/ stretch main ui' &gt;&gt; \/etc\/apt\/sources.list.d\/raspi.list<\/code><br \/>\n<code>apt-get update<\/code><br \/>\n<code>exit<\/code><\/p>\n<p>\u6590\u8bafN1 ArmBian\u6362apt\u6e90(\u53ef\u9009\uff0c\u4e2d\u56fd\u5927\u9646\u5fc5\u987b)<br \/>\n<code>sudo su<\/code><br \/>\n<code>echo 'deb http:\/\/mirrors.ustc.edu.cn\/debian stretch main contrib non-free' &gt; \/etc\/apt\/sources.list<\/code><br \/>\n<code>echo 'deb http:\/\/mirrors.ustc.edu.cn\/debian stretch-updates main contrib non-free' &gt; \/etc\/apt\/sources.list<\/code><br \/>\n<code>echo 'deb http:\/\/mirrors.ustc.edu.cn\/debian stretch-backports main contrib non-free' &gt; \/etc\/apt\/sources.list<\/code><br \/>\n<code>echo 'deb http:\/\/mirrors.ustc.edu.cn\/debian-security\/ stretch\/updates main contrib non-free' &gt; \/etc\/apt\/sources.list<\/code><br \/>\n<code>apt-get update<\/code><br \/>\n<code>exit<\/code><\/p>\n<p>2.\u5b89\u88c5\u4f9dPython3\u8fd0\u884c\u73af\u5883<br \/>\n<code>sudo apt-get -y install python3-pip build-essential libssl-dev libffi-dev python-dev openssl libssl-dev python3-cffi python3-setuptools python3-cryptography python3-bcrypt python-cryptography python-bcrypt python3-dev<\/code><\/p>\n<p>3.\u4fee\u6539\u963f\u91cc\u4e91pip\u6e90(\u53ef\u9009\uff0c\u4e2d\u56fd\u5927\u9646\u5fc5\u987b)<br \/>\n<code>sudo su<\/code><br \/>\n<code>mv \/etc\/pip.conf \/etc\/pip.conf.bak<\/code><br \/>\n<code>echo '[global]' &gt; \/etc\/pip.conf<\/code><br \/>\n<code>echo 'timeout = 6000' &gt;&gt; \/etc\/pip.conf<\/code><br \/>\n<code>echo 'index-url = https:\/\/mirrors.aliyun.com\/pypi\/simple\/' &gt;&gt; \/etc\/pip.conf<\/code><br \/>\n<code>echo 'trusted-host = mirrors.aliyun.com' &gt;&gt; \/etc\/pip.conf<\/code><br \/>\n<code>exit<\/code><\/p>\n<p>4.\u5b89\u88c5python\u4f9d\u8d56\u5305<br \/>\n<code>pip3 install requests<\/code><br \/>\n<code>pip3 install sqlalchemy<\/code><br \/>\n<code>pip3 install distro<\/code><br \/>\n<code>pip3 install hass-nabucasa<\/code><br \/>\n<code>pip3 install xmltodict<\/code><br \/>\n<code>pip3 install mutagen<\/code><br \/>\n<code>pip3 install netdisco<\/code><br \/>\n<code>pip3 install pynacl<\/code><br \/>\n<code>pip3 install pyotp<\/code><br \/>\n<code>pip3 install pyqrcode<\/code><br \/>\n<code>pip3 install aiohttp<\/code><br \/>\n<code>pip3 install aiohttp_cors<\/code><br \/>\n<code>pip3 install cryptography<\/code><br \/>\n<code>pip3 install gtts-token<\/code><br \/>\n<code>pip3 install hass-nabucasa<\/code><br \/>\n<code>sudo pip3 install pycryptodome<\/code><br \/>\n<code>sudo pip3 install --upgrade pip<\/code><\/p>\n<p>5.\u5b89\u88c5Home Assistant<br \/>\n<code>sudo pip3 install homeassistant<\/code><\/p>\n<p>6.\u624b\u52a8\u542f\u52a8\u6d4b\u8bd5\u4e00\u4e0b\u662f\u5426\u6b63\u5e38,\u542f\u52a8\u8fc7\u7a0b\u4e2d\u4f1a\u81ea\u52a8\u5b89\u88c5\u4e00\u4e9b\u4f9d\u8d56\u5305\uff0c\u8010\u5fc3\u7b49\u5f85\u3002<br \/>\n<code>hass<\/code><\/p>\n<p>7.\u521b\u5efa\u7cfb\u7edf\u670d\u52a1<\/p>\n<p><code>sudo chown -R $USER \/tmp<\/code><br \/>\n<code>echo $USER &gt; \/tmp\/user.txt<\/code><br \/>\n<code>sudo su<\/code><br \/>\n<code>USER1=`cat \/tmp\/user.txt`<\/code><br \/>\n<code>echo '[Unit]' &gt; \/etc\/systemd\/system\/hass.service<\/code><br \/>\n<code>echo 'Description=Home Assistant Service' &gt;&gt; \/etc\/systemd\/system\/hass.service<\/code><br \/>\n<code>echo 'After=network.target' &gt;&gt; \/etc\/systemd\/system\/hass.service<\/code><br \/>\n<code>echo 'Wants=network.target' &gt;&gt; \/etc\/systemd\/system\/hass.service<\/code><br \/>\n<code>echo '[Service]' &gt;&gt; \/etc\/systemd\/system\/hass.service<\/code><br \/>\n<code>echo  'User='$USER1 &gt;&gt; \/etc\/systemd\/system\/hass.service<\/code><br \/>\n<code>echo 'Type=simple' &gt;&gt; \/etc\/systemd\/system\/hass.service<\/code><br \/>\n<code>echo 'ExecStartPre=\/bin\/sleep 3' &gt;&gt; \/etc\/systemd\/system\/hass.service<\/code><br \/>\n<code>echo 'ExecStart=\/usr\/local\/bin\/hass' &gt;&gt; \/etc\/systemd\/system\/hass.service<\/code><br \/>\n<code>echo 'Restart=always' &gt;&gt; \/etc\/systemd\/system\/hass.service<\/code><br \/>\n<code>echo '[Install]' &gt;&gt; \/etc\/systemd\/system\/hass.service<\/code><br \/>\n<code>echo 'WantedBy=multi-user.target' &gt;&gt; \/etc\/systemd\/system\/hass.service<\/code><br \/>\n<code>exit<\/code><\/p>\n<p>8.\u6dfb\u52a0\u5f00\u673a\u542f\u52a8\u5e76\u542f\u52a8Home Assistant<\/p>\n<p><code>sudo systemctl enable hass<\/code><br \/>\n<code>sudo systemctl start hass<\/code><\/p>\n<p>\u6253\u5f00Home Assistant \u754c\u9762<\/p>\n<p>http:\/\/xxx.xxx.xxx.xxx:8123<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u89c6\u9891\u6559\u7a0b\u5982\u4e0b\uff1a https:\/\/youtu.be\/CeiW-G1ghPc \u66f4\u591a\u89c6\u9891\u6559\u7a0b\u8bf7\u70b9\u8fd9\u91cc 1.&hellip; <a href=\"https:\/\/sumju.net\/?p=606\" class=\"more-link read-more\" rel=\"bookmark\">\u7ee7\u7eed\u9605\u8bfb <span class=\"screen-reader-text\">\u6811\u8393\u6d3e\/\u6590\u8bafN1\/Armbian\/\u5b89\u88c5Home Assistant<\/span><i class=\"fa fa-arrow-right\"><\/i><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[35,14,16],"tags":[50,37,38,49,36],"class_list":{"0":"post-606","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-home-assistant","7":"category-linux","8":"category-raspberry-pi","9":"tag-armbian","10":"tag-home-assistant","11":"tag-smarthome","12":"tag-n1","13":"tag-36","14":"h-entry","16":"h-as-article"},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/sumju.net\/index.php?rest_route=\/wp\/v2\/posts\/606","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sumju.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sumju.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sumju.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/sumju.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=606"}],"version-history":[{"count":79,"href":"https:\/\/sumju.net\/index.php?rest_route=\/wp\/v2\/posts\/606\/revisions"}],"predecessor-version":[{"id":1462,"href":"https:\/\/sumju.net\/index.php?rest_route=\/wp\/v2\/posts\/606\/revisions\/1462"}],"wp:attachment":[{"href":"https:\/\/sumju.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=606"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sumju.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=606"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sumju.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=606"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}