knowledge/technology/applications/web/zigbee2mqtt.md

112 lines
38 KiB
Markdown
Raw Normal View History

2023-12-04 10:02:23 +00:00
---
obj: application
2023-12-04 10:28:33 +00:00
repo: https://github.com/Koenkk/zigbee2mqtt
website: https://www.zigbee2mqtt.io
2023-12-04 10:02:23 +00:00
---
# zigbee2mqtt
2023-12-18 23:21:12 +00:00
Zigbee to [MQTT](../../internet/MQTT.md) bridge, get rid of your proprietary Zigbee bridges.
See [this](https://www.zigbee2mqtt.io/supported-devices/) for a list of supported devices.
![Screenshot][Screenshot]
## Setup
In order to run zigbee2mqtt you need a [MQTT](../../internet/MQTT.md) server and a zigbee adapter for talking to the zigbee devices.
## Configuration
zigbee2mqtt is configured with `configuration.yml`
Adapter configuration:
```yml
# Required: serial settings
serial:
# Required: location of the adapter (e.g. CC2531).
# USB adapters - use format "port: /dev/ttyACM0"
# To autodetect the USB port, set 'port: null'.
# Ethernet adapters - use format "port: tcp://192.168.1.12:6638"
port: /dev/ttyACM0
# Optional: disable LED of the adapter if supported (default: false)
disable_led: false
# Optional: adapter type, not needed unless you are experiencing problems (default: shown below, options: zstack, deconz, ezsp)
adapter: null
# Optional: Baud rate speed for serial port, this can be anything firmware support but default is 115200 for Z-Stack and EZSP, 38400 for Deconz, however note that some EZSP firmware need 57600.
baudrate: 115200
# Optional: RTS / CTS Hardware Flow Control for serial port (default: false)
rtscts: false
```
MQTT:
```yml
# Required: MQTT settings
mqtt:
# Required: MQTT server URL (use mqtts:// for SSL/TLS connection)
server: 'mqtt://localhost:1883'
# Optional: MQTT base topic for Zigbee2MQTT MQTT messages (default: zigbee2mqtt)
base_topic: zigbee2mqtt
# Optional: absolute path to SSL/TLS certificate of CA used to sign server and client certificates (default: nothing)
ca: '/etc/ssl/mqtt-ca.crt'
# Optional: absolute paths to SSL/TLS key and certificate for client-authentication (default: nothing)
key: '/etc/ssl/mqtt-client.key'
cert: '/etc/ssl/mqtt-client.crt'
# Optional: MQTT server authentication user (default: nothing)
user: my_user
# Optional: MQTT server authentication password (default: nothing)
password: my_password
# Optional: MQTT client ID (default: nothing)
client_id: 'MY_CLIENT_ID'
# Optional: disable self-signed SSL certificates (default: true)
reject_unauthorized: true
# Optional: Include device information to mqtt messages (default: false)
include_device_information: true
# Optional: MQTT keepalive in seconds (default: 60)
keepalive: 60
# Optional: MQTT protocol version (default: 4), set this to 5 if you
# use the 'retention' device specific configuration
version: 4
# Optional: Disable retain for all send messages. ONLY enable if you MQTT broker doesn't
# support retained message (e.g. AWS IoT core, Azure IoT Hub, Google Cloud IoT core, IBM Watson IoT Platform).
# Enabling will break the Home Assistant integration. (default: false)
force_disable_retain: false
```
Frontend:
```yml
frontend:
# Optional, default 8080
port: 8080
# Optional, empty by default to listen on both IPv4 and IPv6. Opens a unix socket when given a path instead of an address (e.g. '/run/zigbee2mqtt/zigbee2mqtt.sock')
host: 0.0.0.0
# Optional, enables authentication, disabled by default
auth_token: your-secret-token
# Optional, url on which the frontend can be reached, currently only used for the Home Assistant device configuration page
url: 'https://zigbee2mqtt.myhouse.org'
# Optional, certificate file path for exposing HTTPS. The sibling property 'ssl_key' must be set for HTTPS to be activated
ssl_cert: /config/etc/letsencrypt/live/mydomain.com/fullchain.pem
# Optional, private key file path for exposing HTTPS. The sibling property 'ssl_cert' must be set for HTTPS to be activated
ssl_key: /config/etc/letsencrypt/live/mydomain.com/privkey.pem
```
To enable integration with [Home Assistant](Home%20Assistant.md), add this to config:
```yml
homeassistant: true
```
## Docker Compose
```yml
version: '3'
services:
zigbee2mqtt:
restart: unless-stopped
image: koenkk/zigbee2mqtt
volumes:
- ./zigbee2mqtt-data:/app/data
- /run/udev:/run/udev:ro
ports:
- 8080:8080
environment:
- TZ=Europe/Berlin
devices:
- /dev/ttyUSB0:/dev/ttyUSB0
```
[Screenshot]: data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUEAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAA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