知乎专栏 |
https://github.com/hacs
https://github.com/hassio-addons/repository
配置 DNS
homeassistant:/config# cat /etc/resolv.conf search local.hass.io nameserver 8.8.8.8
进入容器安装 hacs
docker exec -it homeassistant bash wget -O - https://get.hacs.xyz | bash -
homeassistant:/config# cat /etc/resolv.conf search local.hass.io nameserver 8.8.8.8 homeassistant:/config# wget -O - https://get.hacs.xyz | bash - Connecting to get.hacs.xyz ([2606:4700:3031::ac43:8f2c]:443) Connecting to raw.githubusercontent.com ([2606:50c0:8001::154]:443) writing to stdout INFO: Trying to find the correct directory... - 100% |*************************| 3988 0:00:00 ETA written to stdout INFO: Found Home Assistant configuration directory at '/config' INFO: Changing to the custom_components directory... INFO: Downloading HACS Connecting to github.com (20.205.243.166:443) Connecting to github.com (20.205.243.166:443) Connecting to objects.githubusercontent.com (185.199.108.133:443) saving to 'hacs.zip' hacs.zip 100% |*************************| 3889k 0:00:00 ETA 'hacs.zip' saved INFO: Creating HACS directory... INFO: Unpacking HACS... INFO: Verifying versions INFO: Current version is 2023.6.2, minimum version is 2022.11.0 INFO: Removing HACS zip file... INFO: Installation complete. INFO: Remember to restart Home Assistant before you configure it
如果无法下载,请添加 hosts 文件
docker exec -i homeassistant bash -c "echo 199.232.96.133 raw.githubusercontent.com >> /etc/hosts" docker exec -i homeassistant bash -c "echo 140.82.114.4 github.com >> /etc/hosts"
手工安装,下载 hacs.zip 文件,然后复制到 homeassistant 机器上
unzip hacs.zip scp -r hacs root@homeassistant.local:/tmp/
将宿主主机的 hacs 目录复制到 homeassistant 容器中的 /config/custom_components/ 目录下
root@homeassistant:~# docker cp /tmp/hacs homeassistant:/config/custom_components/ Successfully copied 11.6MB to homeassistant:/config/custom_components/
root@homeassistant:~# docker exec -it homeassistant bash homeassistant:/config# ls custom_components/ hacs
/usr/share/hassio/homeassistant/custom_components
scp -r hass-node-red-1.4.0 root@homeassistant.local:/usr/share/hassio/homeassistant/custom_components/