Skip to main content

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.

Comments

Popular posts from this blog

Using ESPEasy with Home Assistant via MQTT

Preface: I've just started playing around with Home Assistant on a Raspberry Pi and exploring the world of MQTT to control devices on the network. Learning curve is a bit steep but worth the effort as MQTT is very fast. The hardware and software tools I'm using are as follows: 2 x Sonoff relay units 2 x NodeMCU Boards ESPEasy firmware (must be version 121 or above as that contains the MQTT 'retain' flag option. Home Assistant software on Raspberry Pi2 MQTT Test Software: PC: MQTT.fx Android: MQTT Dashboard

My Notepad++ tricks when editing YAML files in Home Assistant

To comment out a whole section in one go: Highlight the text you want to comment out and use CTRL + Q. If you do this at the start of a line, it will only comment that line. CTRL + Q is toggle mode (comment on/off). CTRL + K will allow you to add multiple comments one after the other.

How to check what entities are filling up your Home Assistant database

If you use the Home Assistant MariaDB add-on, this tip will show you how to query the database so see what Home Assistant entity states are triggering the most, filling up your database. What were going to do: Install the phMyAdmin add-on for MariaDB. Query the MariaDB database. See what entity state changes have the most action. Paste the code below into the SQL query box:  select entity_id,count( * ) from states group by entity_id order by count ( * ) desc; And if you're using the internal home-assistant_v2.db instead, you can use the SQLite Web add-on to achieve the same thing.