Created
October 25, 2017 12:07
-
-
Save willwhui/16024c999dac2ad5d78d05fb516a4c74 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
在树莓派3B+raspbian上安装home-assistant |
如何再次运行:
这里解释了基于虚拟环境运行home assistant的基本概念:
https://home-assistant.io/docs/installation/virtualenv/
将hass安装在虚拟环境中有助于保持hass不受其他python组件的影响。
提到如何再次运行:
sudo -u homeassistant -H /srv/homeassistant/bin/hass
如何进入虚拟环境并升级:
sudo su -s /bin/bash homeassistant
source /srv/homeassistant/bin/activate
pip3 install --upgrade homeassistant
以及如何开机启动hass
https://home-assistant.io/docs/autostart/
这里面提到了如何将hass作成系统服务并自启动,以及重启、查看日志的方法。
# 按照官方教程做好之后的常用命令
# 查看状态
sudo systemctl status home-assistant@homeassistant
# 启动
sudo systemctl start home-assistant@homeassistant
# 重启(或在前端界面调用homeassitant本身提供的服务命令)
sudo systemctl restart home-assistant@homeassistant
# 查看日志(实时,可用管道grep)
sudo journalctl -f -u home-assistant@homeassistant
无法运行上述命令
2018年5月6日,按照官方教程安装完毕之后,无法顺利执行上述命令。
原因是/etc/systemd/system/[email protected]文件没有成功创建,可能是我没有完全按照教程执行最后一步运行hass导致的。
参照https://community.home-assistant.io/t/unit-home-assistant-homeassistant-service-not-found/28507
手动创建此文件即可:
What I did:
cd /etc/systemd/system
sudo nano [email protected]
input this:
[Unit]
Description=Home Assistant
After=network.target
[Service]
Type=simple
User=%i
ExecStart=/srv/homeassistant/bin/hass -c "/home/homeassistant/.homeassistant"
[Install]
WantedBy=multi-user.target
saved it
did a daemon reload
sudo systemctl --system daemon-reload
then I could use this again:
sudo systemctl start home-assistant@homeassistant
增加samba服务
vi处理多文件比较麻烦,所以开启samba服务,以便在ubuntu上编辑
参见:https://gist.github.com/willwhui/acc6a0ab8fc2f78040f1f822d62a5363#gistcomment-2240240
将配置文件加入github.com作为备份
将本地目录加入github.com,参见:Adding an existing project to GitHub using the command line
记得用.ignore文件将特殊的文件排除在外免得每次都看到混淆视听以及产生误操作。
homeassistant用户使用bash shell
默认使用的shell不好用,运行
sudo vi /etc/passwd
在最后一句
homeassistant:x:999:996::/home/homeassistant:
末尾追加"/bin/bash",成为
homeassistant:x:999:996::/home/homeassistant:/bin/bash
即可
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
安装步骤
https://home-assistant.io/docs/installation/raspberry-pi/
找到上述网页的路径:
主页(hass.io)->Getting started( https://home-assistant.io/getting-started/ )->
For alternative installation methods, please take a look at the installation documentation ->
点击树莓派图标( https://home-assistant.io/docs/installation/raspberry-pi/ )
就到了。
注:如果在安装过程中,某命令行运行遇到了失败,重新运行它,多试几次。并且把翻墙工具的跳过ip段等设置关闭。
注:在执行
pip3 install homeassistant
这一步时如果遇到失败,可能是因为树莓派upgrade后需要重启一次。hass的架构说明
在这里,值得一看:https://home-assistant.io/developers/