Skip to main content

Zigbee2MQTT Setup with SLZB-06 and Home Assistant Integration

Zigbee2MQTT Setup with SLZB-06 and Home Assistant Integration

ÜberblickOverview

DieseThis Anleitungguide beschreibtdescribes diethe komplettecomplete Installationinstallation vonof Zigbee2MQTT aufon einema Proxmox CT mitwith SLZB-06 Coordinatorcoordinator undand Integrationintegration ininto Home Assistant übervia MQTT.

Hardware

  • SLZB-06 Zigbee Coordinator (PoE-versorgt)PoE powered)
  • Proxmox CT (Ubuntu 22.04/24.04) fürfor Zigbee2MQTT
  • Home Assistant (separaterseparate Server/server/VM)

System-ArchitekturSystem Architecture

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

1. Create Proxmox CT erstellen

Container-Konfiguration:Container Configuration:

  • Template: Ubuntu 22.04 oderor 24.04
  • CPU: 1 Core
  • RAM: 512MB (max 1GB)
  • Storage: 8GB
  • Netzwerk:Network: Bridge zuto LAN
  • Privileged: NeinNo (unprivileged)
  • Start at boot: JaYes

2. Configure SLZB-06 konfigurieren

Web-InterfaceAccess aufrufen:Web Interface:

http://<SLZB06_IP>

WichtigeImportant EinstellungenSettings prüfen:to Check:

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

3. Zigbee2MQTT Installation

Prepare System vorbereiten

# SystemUpdate aktualisierensystem
apt update && apt upgrade -y
# Install Node.js 20 installieren
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get install -y nodejs git
# Install pnpm installieren
sudo npm install -g pnpm
# VersionCheck prüfenversion
node --version  # SollteShould be v20+
sein

Install Zigbee2MQTT installieren

# VerzeichnisCreate erstellendirectory
sudo mkdir /opt/zigbee2mqtt
sudo chown $USER:$USER /opt/zigbee2mqtt
# RepositoryClone klonenrepository
cd /opt/zigbee2mqtt
git clone https://github.com/Koenkk/zigbee2mqtt.git .
# DependenciesInstall installierendependencies
npm install

KonfigurationCreate erstellenConfiguration

nano /opt/zigbee2mqtt/data/configuration.yaml

Konfigurationsdatei:Configuration File:

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

Install Mosquitto installieren

sudo apt update
sudo apt install mosquitto mosquitto-clients

Configure Mosquitto konfigurieren

# KonfigurationsdateiCreate erstellenconfiguration file
sudo nano /etc/mosquitto/mosquitto.conf

Mosquitto Konfiguration:Configuration:

persistence true
persistence_location /var/lib/mosquitto/

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

include_dir /etc/mosquitto/conf.d

# WICHTIG:IMPORTANT: ExterneAllow Verbindungenexternal erlaubenconnections (fürfor HA)
listener 1883 0.0.0.0

# ACHTUNG:WARNING: NurFor fürtesting Test!only! ProduktivUse mitpassword Passwortin verwendenproduction
allow_anonymous true

Log-VerzeichnisCreate erstellenLog Directory

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

Enable Services aktivieren

# Enable and start Mosquitto aktivieren und starten
sudo systemctl enable mosquitto
sudo systemctl start mosquitto
# Firewall-PortOpen öffnenfirewall port
sudo ufw allow 1883/tcp

5. Setup Zigbee2MQTT alsas Service

Create Service einrichten

Service-Datei erstellenFile

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

Service-Konfiguration:Service Configuration:

[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

Enable Service aktivieren

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

6. Home Assistant Integration

MQTT Integration übervia UI

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

configuration.yaml bleibtremains unverändertunchanged

# 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 undand Troubleshooting

Check Services prüfen

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

VerbindungTest testenConnection

# Test MQTT Broker testenbroker
mosquitto_pub -h localhost -t "test/topic" -m "hello"
mosquitto_sub -h localhost -t "test/topic" -v
# ExterneTest Verbindungexternal testenconnection (vonfrom HA-Server)HA server)
telnet <CT_IP> 1883

Access Frontend aufrufen

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

8. Zigbee-GeräteAdd hinzufügenZigbee Devices

  1. FrontendOpen öffnen:Frontend: http://<CT_IP>:8080
  2. Enable Permit Join aktivieren (Buttonbutton imin Frontend)frontend)
  3. GerätPut Device in Pairing-ModusPairing versetzenMode (meistusually hold button 5-10s Knopf gedrückt halten)10s)
  4. WartenWait bisuntil Gerätdevice erscheintappears (30-60 Sekunden)seconds)
  5. Disable Permit Join deaktivieren (Sicherheit)security)

9. IP-AdressenIP undAddresses and Ports (Beispiel)Example)

KomponenteComponent IP/URL Port ZweckPurpose
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-Example IPs:

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

10. WichtigeImportant KonfigurationsdateienConfiguration Files

DateiFile ZweckPurpose
/opt/zigbee2mqtt/data/configuration.yaml Zigbee2MQTT Hauptkonfigurationmain configuration
/etc/mosquitto/mosquitto.conf MQTT Brokerbroker Konfigurationconfiguration
/etc/systemd/system/zigbee2mqtt.service Systemd Serviceservice