How to setup zigbee2mqtt with home assistant!

preview_player
Показать описание
Learn to setup zigbee2mqtt with home assistant and automate your entire home!

### Setup Home Assistant Docker
---
services:
homeassistant:
container_name: homeassistant
ports:
- "8123:8123"
environment:
- PUID=1000
- PGID=1000
- TZ=America/Toronto
volumes:
- ./config:/config
restart: unless-stopped
networks:
- frontend
restart: unless-stopped

networks:
frontend:
driver: bridge

### Setup MQTT Server Docker
---
services:
mqtt:
image: eclipse-mosquitto
container_name: mqtt
ports:
- "1883:1883"
- "9001:9001"
volumes:
- ./config:/mosquitto/config:rw
- ./data:/mosquitto/data:rw
- ./log:/mosquitto/log:rw
restart: unless-stopped
networks:
- homeassistant_frontend

networks:
homeassistant_frontend:
external: true

allow_anonymous true
listener 1883
listener 9001
protocol websockets
persistence true
persistence_location /mosquitto/data/

### MQTT password generation

# login interactively into the mqtt container
docker exec -it mqtt sh

# Create new password file and add user and it will prompt for password
mosquitto_passwd -c /mosquitto/config/pwfile mqttuser

### Setup zigbee2mqtt docker compose
---
services:
zigbee2mqtt:
image: koenkk/zigbee2mqtt
container_name: zigbee2mqtt
restart: unless-stopped
devices:
- /dev/serial/by-id/usb-ITEAD_SONOFF_Zigbee_3.0_USB_Dongle_Plus_V2_20230220201732-if00:/dev/ttyACM0
ports:
- "8080:8123"
volumes:
- ./data:/app/data
- /run/udev:/run/udev:ro
environment:
- TZ=America/Toronto
networks:
- homeassistant_frontend

networks:
homeassistant_frontend:
external: true

homeassistant: true
frontend:
port: 8123
mqtt:
base_topic: zigbee2mqtt
server: mqtt://mqtt:1883
user: mqttuser
password: Rq2SWqyIytfr6X
permit_join: false
serial:
port: /dev/ttyACM0
availability:
active:
timeout: 10
advanced:
channel: 26
homeassistant_legacy_entity_attributes: false
legacy_api: false
legacy_availability_payload: false
device_options:
legacy: false

VIDEOS TO WATCH NEXT :

0:00 - Hardware overview
0:41 - Home Assistant setup
2:45 - MQTT server setup
5:32 - zigbee2mqtt server setup
10:33 - Pluging everything together
11:14 - Pairing the smartplug
12:15 - Testing the smartplug

#homeassistant #homeautomation #zigbee #smarthome #smarthouse #docker #devops #linux
Рекомендации по теме
Комментарии
Автор

Saw this scrolling and came to check out the comments. Surprised there isn't more. For anyone who follows this later, the day before this was posted the zigbee2mqtt team posted an update that made a few major changes (version 2.0.0). You should be set if you add an adapter entry to your serial config settings. It's currently a massive, dramatic flame war. If you're setting it up this way though you should be able to read a change log.

aaronjohnson
Автор

He is back, ladies and gentlemen the man the myth the legend is back.

riquelmen-bb
Автор

Amazing video brother! Thanks a lot for the share!

axelkyle
Автор

For Zigbee2MQTT, you are defining the port of the frontend to 8123 inside the container, and then we can see int the config of the compose file of the same service that you map it back to the port 8080 on the host machine (which is the default port of zigbee2mqtt's frontend).
You can remove both of these lines, as it's counterproductive and can lead to confusion. Indeed, the port 8123 is the port of the frontend of HomeAssistant, and none of these two services needs to access the port of the frontend of the other one.

Other than that, good video, thanks

kirianguiller
Автор

Hello :) Well, Im' having a problem when trying to run the docker compose of the zigbee2mqtt container. I have pretty much the same dongle (except mine is not on ACM0 but in USB0) and when running the docker compose I got this error.
Error response from daemon: error gathering device information while adding custom device no such file or directory

When I'm listing the pluged device (ls -l /dev/serial/by-id/) I got the correct answer :
lrwxrwxrwx. 1 root root 13 9 janv. 10:53 -> ../../ttyUSB0

What Am i doing wrong ?
Here is my docker-compose.yml file content :
---
services:
zigbee2mqtt:
image: koenkk/zigbee2mqtt
container_name: zigbee2mqtt
restart: unless-stopped
devices:
-
ports:
- "8080:8123"
volumes:
- ./data:/app/data
- /run/udev:/run/udev:ro
environment:
- TZ=Etc/UTC
networks:
- home_assistant_frontend

networks:
home_assistant_frontend:
external: true

great video anyway :)

antoningagelin