Docker部署Home Assistant提示找不到configuration.yaml求助
问题
我是Home Assistant新手,但有Docker使用经验,在Intel NUC上部署Docker版Home Assistant,准备搭配Zigbee恒温阀使用。目前遇到两个问题:
- 看不到集成
- 使用官方配置检查命令时提示找不到configuration.yaml,但进入容器后能看到该文件存在于/config目录,且UI端配置检查无异常。
配置检查命令报错
$ sudo docker exec homeassistant python -m homeassistant --script check_config --files Testing configuration at /root/.homeassistant yaml files (used / not used) Failed config General Errors: - File configuration.yaml not found. Successful config (partial)
容器内查看文件结果
$ sudo docker exec -it homeassistant bash bash-5.1# pwd /config bash-5.1# ls -la | grep configuration.yaml -rwxrwxrwx 1 1000 1000 418 Nov 11 18:42 configuration.yaml
compose.yaml配置
version: '3' services: homeassistant: container_name: homeassistant image: "ghcr.io/home-assistant/home-assistant:stable" volumes: - /home/mali/project/homeassistant/config:/config - /etc/localtime:/etc/localtime:ro restart: unless-stopped privileged: true network_mode: host #Mosquitto mosquitto: container_name: mqtt image: eclipse-mosquitto ports: - 1883:1883 # This port is for Webhooks - 9001:9001 volumes: - /home/mali/project/homeassistant/mosquitto/config:/mosquitto/config - /home/mali/project/homeassistant/mosquitto/data:/mosquitto/data - /home/mali/project/homeassistant/mosquitto/log:/mosquitto/log #Zigbee2MQTT zigbee2mqtt: container_name: zigbee2mqtt depends_on: - mosquitto image: koenkk/zigbee2mqtt volumes: - /home/mali/project/homeassistant/zigbee2mqtt/data:/app/data - /run/udev:/run/udev:ro ports: # Frontend port - 8080:8080 devices: - /dev/ttyUSB0:/dev/ttyUSB0 restart: always privileged: true
configuration.yaml配置
# Loads default set of integrations. Do not remove. default_config: # Load frontend themes from the themes folder frontend: themes: !include_dir_merge_named themes # Text to speech tts: - platform: google_translate automation: !include automations.yaml script: !include scripts.yaml scene: !include scenes.yaml no_ip: domain: {redacted}.no-ip.org username: email@gmail.com password: {redacted}
解决方法
1. 配置检查命令的问题根源
check_config脚本默认会去/root/.homeassistant目录查找配置文件,但你的Home Assistant容器通过挂载卷把配置目录设为了/config,所以脚本找不到目标文件。
2. 正确的配置检查命令
执行命令时需要通过--config参数指定配置目录为/config:
sudo docker exec homeassistant python -m homeassistant --script check_config --files --config /config
3. 关于"看不到集成"的说明
UI端配置检查无异常,说明HA本身能正常读取/config下的配置。看不到集成可能是以下原因:
- Zigbee相关集成需要先完成Zigbee2MQTT的配置,确保MQTT服务正常运行,再在HA中添加MQTT集成,之后才能发现Zigbee设备
- 确认
default_config:条目是否保留,这个条目会加载默认的集成发现功能,误删会导致无法自动发现集成
内容的提问来源于stack exchange,提问作者Lucas03
相关产品推荐
相关产品推荐

