MQTT Broker installeren op de Rapsberry Pi

http://www.sigmdel.ca/michel/ha/ha_add_mqtt_en.html

Since the Raspberry Pi hosting the home automation software will always be on, it makes sense that it should host the MQTT broker. One of the best known Open source MQTT broker is Mosquitto which is what I installed following the instructions found on that site.

To use the Mosquitto Debian repository at Mosquitto.org, you must import the repository package signing key and then make the repository available to apt:

pi@rpi2b:~ $ wget http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key
pi@rpi2b:~ $ sudo apt-key add mosquitto-repo.gpg.key
pi@rpi2b:~ $ cd /etc/apt/sources.list.d/
pi@rpi2b:/etc/apt/sources.list.d $
sudo wget http://repo.mosquitto.org/debian/mosquitto-jessie.list

The package can now be installed and, to clean up, the Mosquitto repository key can be erased.

pi@rpi2b:/etc/apt/sources.list.d $ cd $home
pi@rpi2b:~ $ sudo apt-get udpate
pi@rpi2b:~ $ sudo apt-get install mosquitto
pi@rpi2b:~ $ rm mosquitto-repo.gpg.key

The broker is now installed.

There is no requirement that the broker be on the same computer as the Domoticz server. The broker could be installed on any computer on the network including a router. If it happens to be running OpenWrt then it should be very easy to integrate the broker as Mosquitto provides a binary.

Playing with MQTT

There is not much that can be done with just the MQTT broker alone. We will add some mosquito clients. You can follow Elliot Williams excellent instructions which have been my guide to MQTT. Instead of installing Mosquitto clients on the Rasberry Pi as suggested by Elliot, I installed them on my Ubuntu desktop using the Software Center. It can be done with Synaptic or even with apt-get in a terminal window. The keyboard combination that opens a terminal in Ubuntu is Alt + Ctrl + T.

michel@hp:~ $ sudo apt-get install mosquitto-clients