码迷,mamicode.com
首页 > 其他好文 > 详细

树莓派虚拟环境手动安装HA

时间:2019-01-25 15:59:39      阅读:238      评论:0      收藏:0      [点我收藏+]

标签:div   style   doc   sim   dir   pytho   net   bsp   multi   

树莓派手动安装


https://www.home-assistant.io/docs/installation/raspberry-pi/

sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install python3 python3-venv python3-pip

 

sudo useradd -rm homeassistant -G dialout,gpio

 

cd /srv
sudo mkdir homeassistant
sudo chown homeassistant:homeassistant homeassistant




sudo -u homeassistant -H -s
cd /srv/homeassistant
python3 -m venv .
source bin/activate

 

(homeassistant) homeassistant@raspberrypi:/srv/homeassistant $ python3 -m pip install wheel
(homeassistant) homeassistant@raspberrypi:/srv/homeassistant $pip3 install homeassistant
(homeassistant) homeassistant@raspberrypi:/srv/homeassistant $hass

 



更新HA到最新版本

sudo -u homeassistant -H -s
cd /srv/homeassistant
source bin/activate
pip3 install --upgrade homeassistant

如果更新pip使用

pip install --upgrade pip

 



设置自动启动

sudo nano -w /etc/systemd/system/homeassistant@homeassistant.service
[Unit]
Description=Home Assistant
After=network-online.target

[Service]
Type=simple
User=%i
ExecStart=/srv/homeassistant/bin/hass -c "/home/homeassistant/.homeassistant"

[Install]
WantedBy=multi-user.target

 




sudo systemctl --system daemon-reload
sudo systemctl enable homeassistant@homeassistant.service
sudo systemctl disable homeassistant@homeassistant.service

 

sudo systemctl start homeassistant@homeassistant.service

 

sudo journalctl -f -u homeassistant@homeassistant.service

 










树莓派虚拟环境手动安装HA

标签:div   style   doc   sim   dir   pytho   net   bsp   multi   

原文地址:https://www.cnblogs.com/arrive/p/10319857.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!