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

树莓派手动安装


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/[email protected]
[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 [email protected]
sudo systemctl disable [email protected]

 

sudo systemctl start [email protected]

 

sudo journalctl -f -u [email protected]

 










转载于:https://www.cnblogs.com/arrive/p/10319857.html

你可能感兴趣的:(树莓派虚拟环境手动安装HA)