Help with setting up MQTT (Mosquitto, Hassio)?

I am a noob to home assistant, but am trying to set up MQTT to eventually control ESP8266 boards. I have Hassio installed on a RPi Zero.

I followed the instructions here from Home Assistant’s website and everything seemed to go smoothly. I am now trying to test the set up using this guide. I’m a little confused with how to do some of these steps though.

  1. How do I call the “mosquito_pub” command? Hassio’s command line seems super bare bones and I’m not entirely sure I understand how to use it (I have experience with RPi command line usage though – just not the Hassio commands)

  2. If I use the JSON commands, do I need to set up the MQTT broker to be looking for a certain topic/payload? If so, where do I do that?

  3. The testing instructions say that a message should appear on the bus when done correctly. Where is the “bus”? Is this under events, logbook, or somewhere else on the GUI or will this pop up on my RPi?

Hopefully these are simple questions, I just want to make sure I understand everthing! Thanks for the help

From the SSH add-on?

JSON commands?

You don’t set the broker to listen on topics. The broker passes every message sent through it. Your switch/sensor or whatever you set up in home assistant needs to know what topic it is.

MQTT is the bus. It’s a message bus. You subscribe to the topic and it should show your published payload.

None of those. You can view in a terminal session, or use a client to connect to your broker and monitor.

The first point is what I am having the most issues with. After I SSH into Hassio, most commands are not recognized on the command line, including “moquitto_pub”. When I try to use that command, I get “mosquitto_pub: command not found”

Are you using the ssh add-on or ssh into the host?

I thought they added mosquitto client to the ssh add-on but I could be wrong.

Personally you should use something like MQTTLens, and publish and subscribe that way. It’s much easier

Wow! That guide has changed alot and become so more complicated then when I did it. All I did was install the Hass.IO mosquito add-on input my username and password as below and added these lines of code to my configuration.yaml.

Mosquito add-on config: here
Hass configuration.yaml lines: here