Step 4: Installation Zigbee2Mqtt and Mosquitto Broker
First, we will install the Mosquitto Broker using Docker Compose.
After booting up, place the following file in the config folder:
Find your container ID using the following command:
docker container ls
Now, locate your container ID, which should appear on the left side and resemble '174097ca60c6'. Use the command provided below, but replace 'changeYourContainerId' with your actual container ID.
docker exec -it changeYourContainerId bash
Once you're inside the container, create a file named 'password.txt' in the same location as the 'mosquitto.conf' file. Alternatively, you can first create a file inside the 'conf' folder and add a new line in the format: 'changeUsername:changeYourSuperSecretPassword'."
After completing the previous step, use the following command to encrypt the password:
mosquitto_passwd -U password.txt
If you open the file again, you should notice that its contents have changed.
There are several methods for installing Zigbee2MQTT. The Zigbee2MQTT website provides an excellent installation guide. If you're interested in setting it up with Docker Compose, please let me know.
homeassistant: true
permit_join: false
mqtt:
base_topic: homeassistant
server: mqtt:yourMosquittoIpAddress:1883
user: yourMosquittoUsername
password: yourMosquittoPassword
keepalive: 60
reject_unauthorized: true
version: 4
serial:
adapter: deconz
port: /dev/ttyACM0
frontend:
port: 8080
Now, we should be ready to add our first smart device through the GUI.
Click 'Permit Join (All)' to pair with your smart device.
On your smart device, you typically need to press a button for at least 5 seconds to initiate pairing. After successful pairing, you should find the new device listed in the devices tab or on the start page.
This page is very useful for finding all the devices that are supported.