Zigbee2MQTT + Homeassistant + Mosquitto in docker-compose.yml#
Everything should run with network_mode: host
.
State of this document: Notes while doing stuff.
Security: Non-existant. Everything’s public in my LAN. All this stuff is experimental.
docker-compose.yml
:
# https://www.home-assistant.io/installation/linux#docker-compose
services:
homeassistant:
container_name: homeassistant
# https://github.com/home-assistant/core/pkgs/container/home-assistant/versions?filters%5Bversion_type%5D=tagged
image: "ghcr.io/home-assistant/home-assistant:2024.7.2"
volumes:
- ./config:/config
- /etc/localtime:/etc/localtime:ro
restart: unless-stopped
privileged: true
network_mode: host # 8123
mosquitto:
container_name: mosquitto
image: eclipse-mosquitto
restart: unless-stopped
environment:
- TZ=Europe/Berlin
volumes:
- ./mosquitto/config:/mosquitto/config
- ./mosquitto/data:/mosquitto/data
- ./mosquitto/log:/mosquitto/log
network_mode: host # 1883
zigbee2mqtt:
container_name: zigbee2mqtt
image: koenkk/zigbee2mqtt
restart: unless-stopped
environment:
- TZ=Europe/Brussels
# - DEBUG=zigbee-herdsman
volumes:
- ./zigbee2mqtt:/app/data
- /run/udev:/run/udev:ro
devices:
- /dev/ttyACM0
network_mode: host # 8099
https://www.zigbee2mqtt.io/guide/installation/02_docker.html#docker-compose
https://sequr.be/blog/2022/10/home-assistant-container-part-10-zigbee2mqtt/
Mosquitto#
https://raw.githubusercontent.com/eclipse/mosquitto/master/mosquitto.conf
https://sequr.be/blog/2022/09/home-assistant-container-part-4-mosquitto-docker-container/
direkt
network_mode: host
mosquitto/config/mosquitto.conf
:
# could be `listener 1883 127.0.0.1`
listener 1883
socket_domain ipv4
persistence true
persistence_location /mosquitto/data/
allow_anonymous true
Danach in HASS: Add Integration > MQTT > MQTT
127.0.0.1
1883
Zigbee2MQTT#
https://sequr.be/blog/2022/10/home-assistant-container-part-10-zigbee2mqtt/
https://raw.githubusercontent.com/Koenkk/zigbee2mqtt/master/data/configuration.yaml
zigbee2mqtt/configuration.yaml
:
# https://sequr.be/blog/2022/10/home-assistant-container-part-10-zigbee2mqtt/
serial:
port: /dev/ttyACM0
# port: /dev/ttyACM1
mqtt:
base_topic: zigbee2mqtt
server: mqtt://localhost:1883
client_id: zigbee
# You can enable pairing temporarily in HASS
# https://www.zigbee2mqtt.io/guide/configuration/zigbee-network.html#permit-join
permit_join: false
frontend:
port: 8099
url: 'https://z2m.dortn.de'
# Extract config to separate files
devices: devices.yaml
groups: groups.yaml
homeassistant: true
advanced:
pan_id: 0x0000
ext_pan_id: [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
network_key: [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
channel: 15
Troubleshooting#
Conbee 2 at device /dev/ttyACM0
. Sometimes switches to /dev/ttyACM1
.
Removed udev access for HASS. Works for now, but is not stable.
Maybe USB autosuspend?
Mission should be to have a stable path to the device, but docker-compose mount + symlink to /dev/serial/by-id/usb-dresden_elektronik_ingenieurtechnik_GmbH_ConBee_II_DE2659626-if00
did not work.