forked from boer0327/Home-Automation
-
Notifications
You must be signed in to change notification settings - Fork 12
MQTT
Mattias Martikainen edited this page Feb 5, 2018
·
8 revisions
Using the image toke/mosquitto from Docker Hub
Create the following directories and files
sudo mkdir /Docker/mqtt/config/
sudo mkdir /Docker/mqtt/logs/
sudo mkdir /Docker/mqtt/data/
sudo mkdir /Docker/mqtt/config/mosquitto.passwd
sudo mkdir /Docker/mqtt/config/mosquitto.conf
Add the following to /Docker/mqtt/config/mosquitto.conf
persistence true
persistence_location /mqtt/data/
log_dest file /mqtt/log/mosquitto.log
log_dest stdout
allow_anonymous false
password_file /mqtt/config/mosquitto.passwd
Create the container
docker create --name mqtt --restart=always -p 1883:1883 -e PGID=1000 -e PUID=1000 -v /Docker/mqtt/config:/mqtt/config -v /Docker/mqtt/log:/mqtt/log -v /Docker/mqtt/data/:/mqtt/data/ toke/mosquitto
Start the container
docker start mqtt
Login to the container
docker exec -it mqtt bash
Use the mosquitto_passwd utility to create a user for the mqtt broker
mosquitto_passwd -c /mqtt/config/mosquitto.passwd mqtt
enter the password twice then leave the container
exit
restart it and test that it require password to login
docker restart mqtt
To try it without password, should give you a connection refused
mosquitto_sub -h 192.168.1.5 -v -t '#'
Try with password
mosquitto_sub -h 192.168.1.5 -u mqtt -P PASSWORD -v -t '#'
Command to publish something
mosquitto_pub -h 127.0.0.1 -u mqtt -P PASSWORD -t "homeassistant/cover/1/config" -m "20"
- Snapshot Function
- Creating a VM and installing Ubuntu
- Install VMware Tools on Ubuntu
- Upgrade Ubuntu
- Adding USB with persistant names
- Changing Locale
- Extending a VM disk Ubuntu
- Ubuntu Check Filesystem for errors
- SMB/CIFS share
- Rar2fs
- Installing Docker on Ubuntu 18.04
- Basic Commands
- Home Assistant on Docker
- Portainer
- Plex
- PLEX Trakt.tv sync
- Plexpy
- Sickrage
- MQTT
- MySQL
- phpMyAdmin
- Wordpress
- Docker Monitoring with Prometheus and Grafana dashboard
- Octoprint
- Deconz
- Sparsnäs Docker
- FIND3 server
- FIND trackers ESP8266
- Ubiquiti UniFi
- Hass.io NUT UPS
- VPN, rTorrent, Autodl-irssi
- Glances