在國內安裝 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/)。