Tuesday, 29 November 2016

Enabling the integrated Mosquitto broker on the HASSbian image

The Home Assistant image HASSbian has the Mosquitto MQTT broker integrated into the image but it is not enabled by default. To get it working and persistent on reboot, perform the following:
  1. sudo systemctl enable mosquitto
  2. sudo systemctl start mosquitto
  3. sudo reboot
To test, once your system is back up, type sudo systemctl status mosquitto.service and you should get back the following:

pi@raspberrypi:~ $ sudo systemctl status mosquitto.service
● mosquitto.service - LSB: mosquitto MQTT v3.1 message broker
   Loaded: loaded (/etc/init.d/mosquitto)
   Active: active (running) since Tue 2016-11-29 12:54:25 NZDT; 6min ago
  Process: 390 ExecStart=/etc/init.d/mosquitto start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/mosquitto.service
           └─399 /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
Nov 29 12:54:24 raspberrypi mosquitto[390]: Starting network daemon:: mosquitto.
Nov 29 12:54:25 raspberrypi systemd[1]: Started LSB: mosquitto MQTT v3.1 message broker.

Note that by default, the HASSbian version of Mosquitto does not have a username and password set for MQTT unlike the all-in-one installer.

To add a password, follow the instructions on Ben’s video below at the 1:53s mark.

No comments:

Post a Comment