What is the preferred MQTT setup?

Since four months I am now using Home Assistant Supervised, natively installed under Debian on an small PC with an AMD E350 APU and an 80GB SSD.
I am mainly using ESPHome with ESP8266 devices up to now, and like it a lot.

It is running fine up to now, but still without using the MQTT protocol.
I am thinking of adding MQTT now, with a local MQTT Broker, and I understand that there are several possibilities to install the MQTT Broker:

  1. As integration in Home Assistant itself
  2. Running directly under the Debian host OS on the same device
  3. On a separate device, like a Raspberry-Pi
  4. ??

So my question is what would be the preferred setup of MQTT?
And does the choice have influence on my setup being officially supported or not?

Currently I have the idea that it would be best to install the MQTT Broker on a separate device, so that it will still collect messages when the Home Assistant server is restarted. Is this indeed the case? Or does this not make much difference?

On the other hand, the MQTT Broker being a database application, will probably constantly write a lot of data to the storage. So is the storage device of importance: a SSD or flash memory like an SD-card?

If a separate device indeed is the best choice, would it then be possible to add the MQTT Broker to one of my existing Pi-hole devices running on a Raspberry-Pi, or is this not preferred?
Would it run acceptable on a Raspberry-Pi Zero W with only WiFi?

And a last question: up to now I could configure everything in Home Assistant without using MQTT, so are there any arguments to not using MQTT at all if you can do it without?

If your MQTT and HASS are totally reliant upon one another, then running it on a separate Raspberry Pi doesn’t make sense as you don’t gain anything.

MQTT is pretty stable and doesn’t change often and just runs, so personally I’d just run it on the Debian host and keep things simple.

However, if you plan to run lots of other stuff on your host, it might be worth considering moving to docker and have HASS, MQTT and everything else running as docker containers.

You are already running docker so just install eclipse mosquitto in another docker container.

Easy updates, maintenance, etc.

As you are using supervised just use the addon.

The integration is not a broker. It is how Home Assistant communicates with the broker. The broker is the Mosquitto addon Nick mentioned above.

What is the advantage of mosquitto in docker ? It is not that apt-get update && apt-get upgrade -y is difficult.

Yes but then it wouldn’t be supported. For it to be a supported supervised install you cannot have extra debian packages.

OK I cheated and installed ssh from debian.

Really? :rofl:

I have Mosquitto, Samba, Portainer and a few other packages installed through apt and none of the HA supervised installations here turned to “Unsupported”.


  • No additional software, outside of the Home Assistant ecosystem, is installed.

Thank you all for these answers :slightly_smiling_face:

Reading through them I think I can best install the MQTT Broker locally on the Home Assistant system.
However, there seems to be no consensus about these two options to install the broker:

  1. directly under the Debian host OS
  2. as an addon in Home Assistant

A disadvantage of option 1 seems to be that it officially is not supported by Home Assistant.

Do I understand it correctly that an advantage of option 1 is that the MQTT Broker will still collect messages from IoT devices even when Home Assistant is temporally off-line?
And if so, how long can this be? I can imagine that for a lot IoT devices it is not so important if some messages would be missed, but for some devices it might be essential that all message arrive, like for security system appliances.
Is the QoS level important in this case, and is setting the QoS level to 1 or 2 enough to ensure that the messages always arrive, even when HA is temporally unavailable?

In either case mqtt will continue to work when HA is not running.

Sorry Nick, but I still don’t understand it.
Are you saying that the MQTT Broker will continue to work when it is installed as addon in HA, even when HA is off-line?
Or do you mean that the MQTT protocol will ensure that the messages will be kept by the MQTT clients until the Broker comes back online?

The first.

Well, that really surprises me.
I assumed that, when I restart HA, all components of HA, including the addons like the MQTT Broker, would also be restarted.
So to restart all components I would have to do a reboot of the host itself?

To be clear: when I am restarting HA, I am using this interface:


And when I would reboot the Host I would use this interface:


In supervised the addons are in docker containers. If you do the server restart you restart the ha core. If you want to restart mqtt, restart the addon.

I don’t ever reboot. Why would I? (Except when the underlying debian is updated)

Well, this is very interesting, and it is clear that I still need to learn a lot about HA :wink:
I have for instance also installed ESPHome as an addon in HA, and I am regularly restarting HA when I am making a change to the configuration. And I always assumed that ESPHome would also be restarted in that case, but I now know that ESPHome is already running continuously for weeks in my system because I never rebooted the host, and I was not aware of the possibility of restarting the addons itself…
So thanks for your info Nick :slightly_smiling_face: :+1:

You don’t need to restart anything other than the esp device when you install a new esphome firmware.

Yes, that I knew and did. I meant changes to the HA configuration itself. In that case I often need to restart HA itself.

Less and less these days, but yes.