Home Assistant 安装HACS
|对于Home Assistant来说,HACS挺重要的,不过对于HACS的安装,首先你要知道的是你的安装方式:Haos、Supervisor、Ha Docker、Home Assistant core等几种,其次还要确认你的Home Assistant Core.
关键点1.你需要下载与ha 安装方式 相应的匹配的版本,而不是随便下载一个。即安装时你要下载正确的hacs版本进行安装,否则会造成安装失败。
关键点2.它们安装hacs的方式是各不相同的。
2.以上都正确,但安装时你可能遇到了网络问题,造成安装失败
本文包含一下内容
1.解决网络问题
2.下载正确的hacs版本
3.添加集成hacs
HACS 是 Home Assistant 上的一个第三方Integration集成。
全名:Home Assistant Community Store
网站:https://hacs.xyz/
实际物理目录
path:/home/homeassistant/.homeassistant/custom_components/hacs (for ha core)
path:/homeassistant/custom_components/hacs (for haos)
安装HACS失败经常遇到的问题
1.正在连接 http://raw.githubusercontent.com 失败:拒绝连接
2.下载了不正确的HACS版本
3.在集成中添加HACS集成的时候无法访问gitbub
hacs could not authenticate with github try again later.
reason:意思就是无法连接github
Detail Step by Step
HA Core
Step 1. Installation Type
这是本人的Installation Type
Home Assistant Core
http://192.168.2.50:58123/config/repairs
System information
Version core-2023.6.3
Installation Type Home Assistant Core
Development false
Supervisor false
Docker false
User homeassistant20230504
Virtual Environment true
Python Version 3.11.3
Operating System Family Linux
Operating System Version 4.19.66-v7+
CPU Architecture armv7l
Timezone Asia/Shanghai
Configuration Directory /home/homeassistant20230504/.homeassistant
step 2.根据Installation Type确认不同的下载脚本
goto:https://hacs.xyz/docs/setup/download
HassOS
Installation Type
Home Assistant OS
http://192.168.2.50:8123/config/repairs
系统信息
版本 core-2024.4.3
安装类型 Home Assistant OS
开发版 false
Supervisor true
Docker true
用户 root
虚拟环境 false
Python 版本 3.12.2
操作系统系列 Linux
操作系统版本 6.6.25-haos
CPU 架构 x86_64
时区 Asia/Shanghai
配置目录 /config
1.解决网络问题
修改ha的dns服务
ha dns options –servers dns://ip //ip就是常用的dns,比如8.8.8.8或114.114.114.114
for example
ha dns options –servers dns://8.8.8.8
ping一下,看能否正常访问github

2.下载正确的hacs版本
install hacs via ssh
goto:https://hacs.xyz/docs/setup/download
choice:OS/Supervised
you will get:
wget -O - https://get.hacs.xyz | bash -
3.安装集成hacs
Or
Manually install hacs via Samba / FTPS
way x:手动安装记录 run ok 20231125 added
copy 已下载好的hacs 到 customs目录
重新启动ha
添加hacs集成
打开浏览器认证
\\192.168.2.115\config\custom_components\hacs
Hassos hacs 运行遇到的问题
1.没法更新HACS插件,一直转圈圈
2.1安装了HACS,但还是不能下载插件,一直转圈,ping github也可以ping的通。
2.2集成也能搜索,但是点击后,跳出的对话框只有选项,没有文字,勾选后提交,一直转圈
2.3 添加集成的时候还是会报Could not authenticate with GitHub, try again later.
3.HACS 无法使用Github进行身份验证,请稍后再试。
原因
3.HACS授权github目前无法走国内镜像,因此需要直连github,出现此错误是因为你的HA无法连接github。建议换个时间或者dddd再试。
极速版仅加速下载,授权github账号仍然需要你的HA能正常访问其接口,报此错误是因为无法访问github接口导致的。
Ha Supervisor
Home Assistant Supervisor
Host Operating System Home Assistant OS 5.13
Update Channel stable
Supervisor Version supervisor-2021.05.4
Docker Version 19.03.15
Disk Total 93.8 GB
Disk Used 7.7 GB
Healthy true
Supported true
Board ova
Supervisor API ok
Version API ok
Installed Add-ons Terminal & SSH (9.1.3), Log Viewer (0.11.0), Samba share (9.5.0), Z-Wave JS (0.1.24), File editor (5.3.1), AppDaemon 4 (0.6.1), Visual Studio Code (3.4.1), Check Home Assistant configuration (3.7.1)
or
Ha Docker
How to Install HACS on Home Assistant in 2023
确认 Home Assistant 版本
在 Home Assistant 里,点击「配置」,下滑找到「信息」,找到「安装类型」。
如果「安装类型」显示:Home Assistant Container。那么你可以跟着这篇教程往下走。
如果「安装类型」没有显示:Home Assistant Container ,而是显示其它的类型,如Home Assistant OS/Home Assistant Core/Home Assistant Supervised,请前往官方文档查阅其安装方法
Installation Type Home Assistant Container
http://192.168.2.50:8123/config/repairs
Version core-2024.1.5
Installation Type Home Assistant Container
Development false
Supervisor false
Docker true
User root
Virtual Environment false
Python Version 3.11.6
Operating System Family Linux
Operating System Version 6.1.0-rpi8-rpi-v8
CPU Architecture aarch64
Timezone Asia/Shanghai
Configuration Directory /config
1.解决网络问题
在home assistant 的docker容器中写入正确的IP
docker exec -i homeassistant bash -c “echo 199.232.96.133 http://raw.githubusercontent.com >> /etc/hosts”
2.下载正确的hacs版本
两种安装方法
我们可以选择「在主机操作系统上运行安装程序」和「在容器内运行安装程序」,这次我选择的是后者。
Home Assistant Container 安装 HACS
3.安装集成hacs
将文件全部放在/docker/homeassistant/config/custom_components/hacs
Ha core 安装 HACS日志记录
1.解决网络问题
系统
raspberrypi P3b+
debian 11
home assistant core
将IP加入/etc/hosts
sudo vi /etc/hosts
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters127.0.1.1 raspberrypi
185.199.108.133 raw.githubusercontent.com
140.82.114.4 github.com
save it
2.下载正确的hacs版本
sudo -i
cd /home/homeassistant/.homeassistant/custom_components
mkdir hacs
cd custom_components/hacs
#注意:HA套件版内核老了,测试hacs v1.20.0运行OK
wget https://ghproxy.com/https://github.com/hacs/integration/releases/download/1.20.0/hacs.zip
7z x hacs.zip
3.安装集成hacs
这里会遇到2个问题
无法连接到github
用github账号授权给hacs登录
小结-建议手动安装-适用所有系统
上面的几种方式,后台都是一个同一个原理。下载hacs.zip 后,解压,copy到配置目录custom_components下,然后重启ha,添加hacs集成。只不过与其他普通集成的区别是这个集成需要github授权。
那么,可以直接人工安装,如下:
copy 已下载好的hacs 到 custom_components目录
way x:手动安装记录 run ok 20231125 added
step 1.直接下载hacs.zip
step 2.unzip it
step 3.找到 custom_components目录
step 4.copy 已下载好的hacs 到 custom_components目录
重新启动ha
添加hacs集成
打开浏览器认证
\\192.168.2.115\config\custom_components\hacs