Skip to main content

Zigbee2MQTT Setup mit SLZB-06 und Home Assistant Integration

Überblick

Diese Anleitung beschreibt die komplette Installation von Zigbee2MQTT auf einem Proxmox CT mit SLZB-06 Coordinator und Integration in Home Assistant über MQTT.

Hardware

  • SLZB-06 Zigbee Coordinator (PoE-versorgt)
  • Proxmox CT (Ubuntu 22.04/24.04) für Zigbee2MQTT
  • Home Assistant (separater Server/VM)

System-Architektur

SLZB-06 (<SLZB06_IP>:6638) 
    ↓ TCP
Zigbee2MQTT (Proxmox CT: <CT_IP>)
    ↓ MQTT (localhost:1883)
Mosquitto Broker (gleicher CT)
    ↓ MQTT (<CT_IP>:1883)  
Home Assistant (anderer Server)

1. Proxmox CT erstellen

Container-Konfiguration:

  • Template: Ubuntu 22.04 oder 24.04
  • CPU: 1 Core
  • RAM: 512MB (max 1GB)
  • Storage: 8GB
  • Netzwerk: Bridge zu LAN
  • Privileged: Nein (unprivileged)
  • Start at boot: Ja

2. SLZB-06 konfigurieren

Web-Interface aufrufen:

http://<SLZB06_IP>

Wichtige Einstellungen prüfen:

  • Zigbee Mode: Coordinator
  • TCP Port: 6638 (aktiviert)
  • Adapter: zstack
  • Baudrate: 115200

3. Zigbee2MQTT Installation

System vorbereiten

# System aktualisieren
apt update && apt upgrade -y
# Node.js 20 installieren
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get install -y nodejs git
# pnpm installieren
sudo npm install -g pnpm
# Version prüfen
node --version  # Sollte v20+ sein

Zigbee2MQTT installieren

# Verzeichnis erstellen
sudo mkdir /opt/zigbee2mqtt
sudo chown $USER:$USER /opt/zigbee2mqtt
# Repository klonen
cd /opt/zigbee2mqtt
git clone https://github.com/Koenkk/zigbee2mqtt.git .
# Dependencies installieren
npm install

Konfiguration erstellen

nano /opt/zigbee2mqtt/data/configuration.yaml

Konfigurationsdatei:

homeassistant: true
permit_join: true
mqtt:
  base_topic: zigbee2mqtt
  server: 'mqtt://localhost'
serial:
  port: tcp://<SLZB06_IP>:6638
  adapter: zstack
frontend:
  port: 8080
  host: 0.0.0.0
advanced:
  log_level: info
  pan_id: 6754
  channel: 11

4. MQTT Broker (Mosquitto) Installation

Mosquitto installieren

sudo apt update
sudo apt install mosquitto mosquitto-clients

Mosquitto konfigurieren

# Konfigurationsdatei erstellen
sudo nano /etc/mosquitto/mosquitto.conf

Mosquitto Konfiguration:

persistence true
persistence_location /var/lib/mosquitto/

log_dest file /var/log/mosquitto/mosquitto.log

include_dir /etc/mosquitto/conf.d

# WICHTIG: Externe Verbindungen erlauben (für HA)
listener 1883 0.0.0.0

# ACHTUNG: Nur für Test! Produktiv mit Passwort verwenden
allow_anonymous true

Log-Verzeichnis erstellen

sudo mkdir -p /var/log/mosquitto
sudo chown mosquitto:mosquitto /var/log/mosquitto

Services aktivieren

# Mosquitto aktivieren und starten
sudo systemctl enable mosquitto
sudo systemctl start mosquitto
# Firewall-Port öffnen
sudo ufw allow 1883/tcp

5. Zigbee2MQTT als Service einrichten

Service-Datei erstellen

sudo nano /etc/systemd/system/zigbee2mqtt.service

Service-Konfiguration:

[Unit]
Description=zigbee2mqtt
After=network.target

[Service]
ExecStart=/usr/bin/node index.js
WorkingDirectory=/opt/zigbee2mqtt
StandardOutput=inherit
StandardError=inherit
Restart=always
User=<username>
Environment=NODE_ENV=production

[Install]
WantedBy=multi-user.target

Service aktivieren

sudo systemctl daemon-reload
sudo systemctl enable zigbee2mqtt
sudo systemctl start zigbee2mqtt

6. Home Assistant Integration

MQTT Integration über UI

  1. Home Assistant → SettingsDevices & Services
  2. Add IntegrationMQTT
  3. Konfiguration:
    • Broker: <CT_IP>
    • Port: 1883
    • Username: (leer - nur für Test!)
    • Password: (leer - nur für Test!)
    • Enable discovery:

configuration.yaml bleibt unverändert

# Loads default set of integrations. Do not remove.
default_config:

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

http:
  use_x_forwarded_for: true
  trusted_proxies:
    - 172.26.0.0/16
    - 172.18.0.0/16
    - 172.17.0.0/16
    - 127.0.0.1
    - ::1

7. Testing und Troubleshooting

Services prüfen

# Zigbee2MQTT Status
sudo systemctl status zigbee2mqtt
sudo journalctl -f -u zigbee2mqtt
# Mosquitto Status
sudo systemctl status mosquitto
sudo journalctl -f -u mosquitto

Verbindung testen

# MQTT Broker testen
mosquitto_pub -h localhost -t "test/topic" -m "hello"
mosquitto_sub -h localhost -t "test/topic" -v
# Externe Verbindung testen (von HA-Server)
telnet <CT_IP> 1883

Frontend aufrufen

# Zigbee2MQTT Frontend
http://<CT_IP>:8080

8. Zigbee-Geräte hinzufügen

  1. Frontend öffnen: http://<CT_IP>:8080
  2. Permit Join aktivieren (Button im Frontend)
  3. Gerät in Pairing-Modus versetzen (meist 5-10s Knopf gedrückt halten)
  4. Warten bis Gerät erscheint (30-60 Sekunden)
  5. Permit Join deaktivieren (Sicherheit)

9. IP-Adressen und Ports (Beispiel)

Komponente IP/URL Port Zweck
SLZB-06 <SLZB06_IP> 6638 Zigbee Coordinator
Zigbee2MQTT CT <CT_IP> 8080 Frontend
Mosquitto <CT_IP> 1883 MQTT Broker
Home Assistant <HA_IP> - MQTT Client

Beispiel-IPs:

  • CT_IP: z.B. 192.168.1.100
  • SLZB06_IP: z.B. 192.168.1.50
  • HA_IP: z.B. 192.168.1.200

10. Wichtige Konfigurationsdateien

Datei Zweck
/opt/zigbee2mqtt/data/configuration.yaml Zigbee2MQTT Hauptkonfiguration
/etc/mosquitto/mosquitto.conf MQTT Broker Konfiguration
/etc/systemd/system/zigbee2mqtt.service Systemd Service