- https://www.home-assistant.io
- https://hub.docker.com/r/homeassistant/home-assistant
- https://mosquitto.org/
- https://hub.docker.com/_/eclipse-mosquitto
- https://www.zigbee2mqtt.io/
- https://github.com/Koenkk/zigbee2mqtt
mkdir -p $HOME/docker/hass
cd $HOME/docker/hass
git clone https://github.com/slochewie/hass.git
docker-compose pull
docker-compose up -d
Edit Zigbee2MQTT's configuration.yml to your needs
nano $HOME/docker/hass/zigbee2mqtt/data/configuration.yml
Edit Mosquitto's mosquito.conf to your needs. By default the existing file should work as is with no authentication needed. This is fine for initial usage making sure it works, but authentication should be added.
nano $HOME/docker/hass/mosquitto/config/mosquitto.conf
The Mosquitto container runs the mosquitto server under UID 1883 and GID 1883. I've tried changing this in the docker-compose file with no luck. My workaround to avoid read/write errors is to chown the mosquitto directory with 1883:1883
sudo chown -R 1883:1883 $HOME/docker/hass/mosquitto/config/mosquitto
Restart Mosquitto and Zigbee2MQTT
docker-compose restart mosquitto zigbee2mqtt
docker-compose pull
docker-compose up -d
docker-compose pull homeassistant
docker-compose up -d homeassistant
docker-compose pull mosquitto
docker-compose up -d mosquitto
docker-compose pull zigbee2mqtt
docker-compose up -d zigbee2mqtt
docker-compose restart homeassistant
docker-compose restart mosquitto
docker-compose restart zigbee2mqtt
The mosquitto.conf in this repo has user authentication disabled and allows anonymous connections. Perform the following steps to setup user authentication and disable anonymous connections to Mosquitto.
Change to an user of your liking. This user and password will also be used in Home Assistant when adding MQTT support. I typically use hass_mqtt as the user but it's entirely up to you.
docker-compose exec mosquitto mosquitto_passwd -c /mosquitto/config/password_file <user>
You'll be prompted for a password twice. Enter it twice.
Now edit the mosquitto conf file.
sudo nano ./mosquitto/config/mosquitto.config
Find the line
allow_anonymous true
Change it to
allow_anonymous false
Find the line
#password_file
Change it to
password_file /mosquitto/config/password_file
Restart Mosquitto
docker-compose restart zigbee2mqtt
The Zigbee2MQTT configuration file in this repo is not configured for authentication either. To cnange it follow the steps below.
sudo nano $HOME/docker/hass/zigbee2mqtt/data/configuration.yaml
Change
# Zigbee2MQTT configuration file
homeassistant: true
permit_join: true
mqtt:
base_topic: zigbee2mqtt
server: <LAN ip address of server>
# user: <user>
# password: <password>
to
# Zigbee2MQTT configuration file
homeassistant: true
permit_join: true
mqtt:
base_topic: zigbee2mqtt
server: <LAN ip address of Mosquitto server>
user: <mosquitto_user>
password: <mosquitto_password>
Restart Zigbee2MQTT
docker-compose restart zigbee2mqtt
Login to Home Assistant
Go to Settings -> Devices & Services -> Add Integration
Search for MQTT and add it.
Input the MQTT Server's IP Addreess, user name, and password.
Home Assistant http://server-ip:8123
Zigbee2MQTT http://server-ip:8989
This README works out of the box with the SONOFF Zigbee 3.0 USB Dongle Plus-P or SONOFF Zigbee 3.0 USB Dongle Plus-E only requiring minor changes. I have not tested it with other Zigbee controllers but it should work as a fairly accurate guideline.
Aaron Wilson https://niteowl.dev