Small tip for the MQTT Broker (Mosquitto) installation on Raspberry Pi

For all newcomers I would like to give you some tips on questions about Rhasspy which I have dealt with myself some time ago. Maybe it is helpful for one or the other. The many professionals here can ignore it for sure :wink:

Because of the very fast development of Rhasspy and the simplicity I preferred the Docker installation. In order to be able to keep everything else compact and resource-saving I have not installed the MQTT Broker Mosquitto as a Docker container but installed directly under Raspbian Buster.

Installation instructions for Mosquitto:

sudo apt update 
sudo apt install -y mosquitto mosquitto-clients

To start Mosquitto automatically after system startup, activate it as system service with the following command:

sudo systemctl enable mosquitto.service

So far, everything’s normal. What caused me problems was the default configuration “localhost” in the Rhasspy MQTT settings. Actually localhost is correct because the IP 127.0.0.1 points to the Raspberry Pi on the now Rhasspy in the Docker container and also the MQTT Broker are converging. But Docker even if it is not a real virtualization environment abstracts the IP system from the host. So localhost from Rhasspy is only valid in this container and there is no communication between Rhasspy and the Mosquitto MQTT Broker established.

This can be remedied by entering the IP address of the Raspberry Pi instead of localhost in the Rhasspy MQTT setting.

If you do not know the address, you can query it in the console with the following command.

ifconfig

The IP can be found as an example mine under eth0: (192.168.1.35) or if you connect the Raspberry Pi via WLan under wlan0: In the screenshot you can also see the above mentioned IP abstraction from Docker which installs its own network interfaces.

After these steps the Rhasspy / Hermes communication to the broker and back works perfectly for me.

6 Likes

Thanks for your tips: just discoverded this the hard way last night when I try to play with Rhasspy on my hass.io installation :slight_smile:

Try a lot of settings (with or without “http://”, localhost, 127.0.0.1 etc.) before setup the IP of my raspberry inside this host field.

Suddenly, I remember myself “hey dude! you’re in a Docker container!”

Other option: use the internal Docker interface (is it possible ? not try this option)

Should be

sudo apt install -y mosquitto mosquitto-clients

:wink:

1 Like

Of course you’re absolutely right! Thank you for the spelling mistake correction. :smiley: