WTH- why can't I setup 2 (or even more) MQTT brokers?

I have one mqtt broker local, but I would like to use another (on the internet) as well for external sensors that cannot directly connect to my home assistant instance…

Or use another mqtt broker for testing purposes…

You can bridge multiple MQTT brokers now and only allow certain things thru…
I have 2 brokers on my HA now, and thinking about connecting a 3rd that is from a second HA instance…

1 Like

Mostly Chris on YouTube was just talking about multiple brokers in HA.

1 Like

I use the MQTT Bridge functionality to bring in data from an external broker, and I wrote about it:

https://dashdrum.com/blog/2022/06/worldwide-mqtt-without-exposing-a-local-broker-to-the-public-internet/

As for the reason it is not supported, that basically comes down the mqtt integration adding services to enable sending messages. Those services were designed with the idea that there only be one connected mqtt broker, so they don’t provide any method of specifying which broker to use if there was more than one, so you would get an arbitrary broker. Changing that would be an annoying breaking change, especially since there is no current unique identifier applicable.

Basically, mqtt integration would need to create an entity-less “service” type device for each config entry, and the service calls would need to be updated to accept that device Id. But device ids are not yaml friend, being opaque non-memorable strings that only really work well in the UI.

Since bridging based approaches are possible, nobody has yet done the work to make those changes to the integration, especially since many users that only need a single broker would not appreciate the breaking change.

1 Like

Sorry, search didn’t show topic and I created Please support two or more brokers for mqtt integration let’s continue here. Last message was written a long time ago, perhaps when switching from yaml to config flow everything changed. I think that it is possible to make an automatic migration, finally remove the mqtt configs from yaml. And after that generate unique identifiers.

Bump. Interested in this for security - my HA and MQTT broker are running in containers on the same machine, and as I add zwave-js-ui and zigbee2mqtt as their own containers I’d like to use a second MQTT broker that can only be accessed via other containers on the machine, no reason to send unlock commands to my front door across a broker open to my LAN.

Mosquito has built in features to be able to prevent unauthorized clients from subscribing to certain topics. Between authorization and securing your topics (basically, lockdown the zigbee2mqtt topic (or whatever you use)), you can easily prevent access to your devices.

I just use Node Red to transefer data from one source to more than one MQTT server, it’s easy.
image