Docker安装HomeAssistant

Docker安装不支持附件组件

直接从docker官方直接拉取镜像,可能会遇到网络问题

1
homeassistant/home-assistant

可以从镜像地址下载

1
ghcr.io/home-assistant/home-assistant:stable

Docker安装可兼容多平台,但是此方法安装HA无权访问附加组件

如图,在飞牛OS上安装

https://cdn.ziyourufeng.eu.org/51hhh/img_bed/main/img/2025/01_06/image_3b73082d3e6976149db3b8d0b0e77e20.png

1
2
3
4
5
6
7
8
docker run -d \
--name homeassistant \
--privileged \
--restart=unless-stopped \
-e TZ=Asia/Shanghai \
-v /data/homeassistant:/config \
--network=host \
homeassistant/home-assistant

-v /data/homeassistant:/config这一项需要根据自己实际情况修改,即把自己物理机某文件夹挂载到容器内,我是建了个文件夹/data/homeassistant来存放HA的文件

端口8123映射到本地8123

创建一个homeasststant的文件夹,将创建的homeasststant 文件路径,载到容器的 /config 路径

https://cdn.ziyourufeng.eu.org/51hhh/img_bed/main/img/2025/01_07/image_590cac76150ce6bc8eb19445d3863fb7.png

添加环境变量 TZ,将时区设置为 Asia/Shanghai

网络设置成host

https://cdn.ziyourufeng.eu.org/51hhh/img_bed/main/img/2025/01_07/image_546059ff67f8a60f94b8dae55bad6937.png

访问http://ip:8123即可

在 homeasststant 目录下创建一个名为 custom_components 的文件夹

https://cdn.ziyourufeng.eu.org/51hhh/img_bed/main/img/2025/01_07/image_077119a4dd4a8de0bc048bd7b4b489c3.png

下载HACS 文件上传并解压到该目录中

1
2
## 下载地址
https://github.com/hacs/integration/releases/tag/2.0.1

https://cdn.ziyourufeng.eu.org/51hhh/img_bed/main/img/2025/01_07/image_a5f34dea07bc3c26653c8b9d9b1c8376.png

重启 Home Assistant.

https://cdn.ziyourufeng.eu.org/51hhh/img_bed/main/img/2025/01_07/image_81faaee2c3944615f90e1c2b877155b6.png

https://cdn.ziyourufeng.eu.org/51hhh/img_bed/main/img/2025/01_07/image_6c7c7f7aff0960a6196e6b6145b27ecb.png

点击 设置-设备与服务

https://cdn.ziyourufeng.eu.org/51hhh/img_bed/main/img/2025/01_07/image_40431f886ece627b9e08b68c4fd35255.png

https://cdn.ziyourufeng.eu.org/51hhh/img_bed/main/img/2025/01_07/image_533bfae96458c9327796bfb0fc7483f3.png

https://cdn.ziyourufeng.eu.org/51hhh/img_bed/main/img/2025/01_07/image_00b1811e3c914d095888a37a0aeabfed.png

全选,提交

https://cdn.ziyourufeng.eu.org/51hhh/img_bed/main/img/2025/01_07/image_048d849d90cd2f4178f342d9f1549082.png

如果点提交之后弹出如下对话框,请直接重启nas设备即可正常往下设置

https://cdn.ziyourufeng.eu.org/51hhh/img_bed/main/img/2025/01_07/image_adb47d5ce5b219de9653b08697365f92.png

加载一会,弹窗对话框,点击第一个链接去验证github账号

https://cdn.ziyourufeng.eu.org/51hhh/img_bed/main/img/2025/01_07/image_becdfac8f6cdb8e0e38a00feb038fe2e.png

同意授权即可

https://cdn.ziyourufeng.eu.org/51hhh/img_bed/main/img/2025/01_07/image_f451721c8ddddadeb45275cc82e2cff7.png