国内安装 HACS 推荐使用 HACS 极速版或代理加速,支持多种安装方式。
在国内安装 HACS(Home Assistant Community Store)时,由于网络环境限制,推荐使用 HACS 极速版或通过代理加速。以下是几种常用的安装方法:
方法一:一键命令安装(推荐)
在 Home Assistant 的终端(Terminal & SSH 插件或宿主机 SSH)中执行:
wget -O - https://get.hacs.vip | bash -
# 或
curl -fsSL get.hacs.vip | bash
适用于 haos/hassio/supervised 版本。如果是 core/docker 版本,需先进入 HA 配置目录再执行。安装完成后重启 Home Assistant。https://github.com/hacs-china
这里我是使用 docker 版本的 HomeAssistant 进行安装,效果如下
/config # wget -O - https://get.hacs.vip | bash -
Connecting to get.hacs.vip (198.23.254.39:443)
writing to stdout
- 100% |********************************************************************| 6882 0:00:00 ETA
written to stdout
INFO: Archive URL: https://ghrp2.hacs.vip/hacs-china/integration/releases/latest/download/hacs.zip
INFO: Trying to find the correct directory...
INFO: Found Home Assistant configuration directory at '/config'
INFO: Creating custom_components directory...
INFO: Changing to the custom_components directory...
INFO: Downloading...
Connecting to ghrp2.hacs.vip (93.90.73.5:443)
saving to '/config/custom_components/latest.zip'
latest.zip 100% |********************************************************************| 17.9M 0:00:00 ETA
'/config/custom_components/latest.zip' saved
INFO: Unpacking...
INFO: Copying new files...
INFO: Removing temp files...
INFO: Installation complete.
INFO: 安装成功!
INFO: Remember to restart Home Assistant before you configure it.
INFO: 请重启 Home Assistant
重启容器之后添加集成,搜索 HACS 即可添加
安装完成后的效果
方法二:加载项安装器
- 添加加载项仓库:https://gitee.com/hacs-china/addons
- 在加载项商店找到 “HACS 极速版安装器” 并安装。
- 启动加载项,观察日志,重启 HA。https://github.com/hacs-china
方法三:手动安装
- 下载 HACS 极速版安装包(可在 hacs-china (https://github.com/hacs-china) 或相关网站获取)。
- 通过 samba/ftp/ssh 进入 HA 配置目录(如 /config)。
- 在 custom_components 下新建 hacs 文件夹,将解压文件复制进去。
- 重启 HA,添加 HACS 集成。http://hasshome.net/h-nd-75.html
方法四:Docker 安装
如果你用 Docker,可以直接用加速镜像:
docker run -d \
--name homeassistant \
--privileged \
--restart=unless-stopped \
-e TZ=Asia/Shanghai \
-v /PATH_TO_YOUR_CONFIG:/config \
-v /run/dbus:/run/dbus:ro \
--network=host \
hacn/hacn:stable
或用 Compose 方式,详见 hacs-china 仓库 (https://github.com/hacs-china)。https://github.com/hacs-china
代理加速
HACS 极速版支持自定义 Github API 代理地址,常用免费代理有:
• https://ghapi.hacs.vip
• https://ghapi-cf.hacs.vip/api
• https://hacs-china.chrome7.com/api
如遇到集成列表加载慢或失败,可在 HACS 选项中设置代理。https://github.com/hacs-china
注意事项
・首次授权 HACS 仍需科学上网,建议提前准备好代理。
・HACS 极速版与官方版共用配置,随时可切换。
・详细教程和常见问题可参考 hacs-china 官方文档 (https://github.com/hacs-china) 或 HACS 与 (国内) 安装准备 (https://www.hachina.io/)。