1.安装 Docker 和 Docker Compose
opkg update
opkg install docker-compose
2.创建 Home Assistant 的配置文件目录和数据目录。
mkdir -p /opt/hassio/config
mkdir -p /opt/hassio/data
3.创建 docker-compose.yml 文件
在/opt/hassio/config创建 docker-compose.yml 文件
version: '3'
services:
homeassistant:
container_name: homeassistant
image: homeassistant/home-assistant:stable
volumes:
- /opt/hassio/config:/config
- /etc/localtime:/etc/localtime:ro
network_mode: host
restart: always
environment:
- TZ=Asia/Shanghai
~~depends_on:
- mqtt
- zigbee2mqtt
mqtt:
container_name: mqtt
image: eclipse-mosquitto:2
restart: always
network_mode: host
volumes:
- ./mosquitto:/mosquitto
environment:
- TZ=Asia/Shanghai
zigbee2mqtt:
container_name: zigbee2mqtt
image: koenkk/zigbee2mqtt:latest~~
3.使用 Docker Compose 安装 Home Assistant Supervised,会启动 Home Assistant 容器,并在后台运行
cd /opt/hassio/config
docker-compose up -d
可能需要在新建/opt/tmp/GetImageBlob2039585392
N1 OpenWRT安装HA和Node-RED
docker run -it -p 1880:1880 --name mynodered nodered/node-red
docker run --name home-assistant --net=host -v /opt/home-assistant-config:/config -e “TZ=Asia/Shanghai” -d homeassistant/home-assistant
docker run -d --name “hassOS” -v /opt/homeassistant:/config -p 8123:8123 --restart=always homeassistant/aarch64-hassio-supervisor
N1 OpenWRT安装zigbee2mqtt
Node-RED安装好Mosquitto broker这个插件并启动,然后点Add-on store页面右上角… -> Repositories -> 添加 https://github.com/lovelylain/hassio-zigbee2mqtt 82 这个仓库,等待刷新后安装zigbee2mqtt插件;安装后按需修改zigbee2mqtt Configuration中mqtt的用户名密码(可以直接填HA的用户名和密码)和serial port参数,改好后启动。
hassio安装小米插件,点击「集成」,点击右下角的「浏览并添加存储库」,搜索xiaomi。,输入米家app用户名与密码,导入你要连接的硬件设备
node-red中的homeassistant控件
将events:all或者events:state拖拽进环境,双击配置。Server为homeassistant服务端配置,包含http://192.168.1.15:8123、Access token(在HA个人账户里的长期令牌)等信息;Entity ID填写需要采集的实体ID名称。