编程开源技术交流,分享技术与知识

网站首页 > 开源技术 正文

win子系统ubuntu图文安装homeassistant过程

wxchong 2024-06-21 14:12:34 开源技术 13 ℃ 0 评论

安装过程基于python3.9.2,ubuntu系统

详细视频过程进入:

win子系统ubuntu安装homeassistant

更换pip源

 pip3 install -i https://pypi.mirrors.ustc.edu.cn/simple/ pip -U   



pip3 config set global.index-url https://pypi.mirrors.ustc.edu.cn/simple/



sudo apt update  


#安装依赖,如果已经安装可以忽略

sudo apt-get install python3 python3-dev python3-venv python3-pip libffi-dev libssl-dev libjpeg-dev python3-idna 


添加Home Assistant账号及安装目录

Home Assistant不能使用root运行,新建账户,把GPIO的权限赋予,方便以后连接其它传感器。

#创建homeassistant用户

sudo useradd -rm homeassistant -G dialout        

#切换目录,创建目录

cd /opt && sudo mkdir homeassistant  



#设置文件所有者和文件关联组的命令

chown homeassistant:homeassistant homeassistant 


创建python虚拟环境

 #切换目录

cd /opt/homeassistant   



#在当前目录创建虚拟环境

sudo python3 -m venv .    



安装homeassistant,下载比较大,建议在wifi下进行

#安装wheel

python3 -m pip install wheel   



#进入到homeassistant目录下

cd /opt/homeassistant

#安装homeassistant

source /opt/homeassistant/bin/activate 

sodu pip3 install homeassistant  


Home Assistant运行

首次多给些时间让Home Assistant自动配置一下, 根据你网络的情况大概10-30分钟吧。 然后就可以使用你的浏览器打开ip地址的8123端口了,第一次启动需要下载环境,配置国内源

#配置国内源

sudo mkdir /root/.pip  



touch /root/.pip/pip.conf



sudo vi /root/.pip/pip.conf



#将下面代码写入pip.conf文件,可以在finder中进行

[global]

index-url = https://pypi.mirrors.ustc.edu.cn/simple/

[install]

trusted-host= pypi.mirrors.ustc.edu.cn



#进入虚拟环境

source /opt/homeassistant/bin/activate   



#启动Home Assistant

hass


等了好久,貌似运行不成功,经过几个小时的查资料,问题依然出现,当我快要放弃时,我重启了一下子系统,重新运行,就像这样。。。。

错误提示没有了,只剩下警告,经验告诉我们,警告不影响运行 :D

现在打开浏览器,输入:127.0.0.1:8123

出现了,估计安装成功了,但是正不正常还要看以后。。。。

输入信息,完成登陆:

等一下,出现了错误提示,刷新网站,重新登陆后,出现这个网页,点下一步。


点完成。


进来了,现在应该能用了,不得不说装home assistant是真的很难,太不友好了

下次记录一下安装一些插件的教程,再见了

下面是一些备忘:

//进入虚拟环境
source /opt/homeassistant/bin/activate  

//更新homeassistant
pip3 install --upgrade homeassistant  

//Home Assistant日志log
tail -f -n 55 /root/.homeassistant/home-assistant.log

//Home Assistant配置文件
nano /root/.homeassistant/configuration.yaml  

//结束虚拟环境
deactivate  

更多参考资料可以访问Home Assistant官网: https://www.home-assistant.io/






Tags:

本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论:

最近发表
标签列表