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

Posted arrive

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了树莓派虚拟环境手动安装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) [email protected]:/srv/homeassistant $ python3 -m pip install wheel
(homeassistant) [email protected]:/srv/homeassistant $pip3 install homeassistant
(homeassistant) [email protected]:/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]

 
































以上是关于树莓派虚拟环境手动安装HA的主要内容,如果未能解决你的问题,请参考以下文章

树莓派搭建python环境

树莓派-opencv虚拟环境搭建(翻译)

树莓派-opencv虚拟环境搭建(翻译)

树莓派中设置Python虚拟开发环境

树莓派.安装Samba环境

RaspberryPi4B树莓派4B,ThonnyIDE配置python解释器为虚拟环境