MQTT bridge vs broker

I have SmartThings hub v2 and plan to move to hass.io and wondering if it’s possible to have both

SmartThings MQQT bridge
and
Mosquitto MQTT broker

I need to control Zigbee, Z-wave and Sonoff devices.

Now I’m using Mosquitto mqtt broker app from Synology, and I think this is causing an issue with connecting devices from SmartThings to HA.

You can set mosquitto to act as a bridge and receive and or sent messages to/from another MQTT broker.
When I moved from cloudmqtt to my own mosquitto, I did this while I transitioned all my devices over one by one.
Check this post:

If you need both in and out messaging, replace topic # in with topic # both

The MQTT clients are things like devices and controllers e.g. HA. These all usually connect to one broker (mosquito) that acts as a central switchboard for all the device change status messages. Additionally the broker can also act as a database for the device state information.

ST is a bit awkward as a client because it is predominantly a cloud based system and it can’t connect directly to a MQTT broker on your local network. Instead it has to connect via an intermediary local bridge which then talks to your local MQTT server (mosquito).

You can have many systems talking to one broker and they all update correctly and in synch, or you could even have several brokers interconnected.

Because of the inbuilt way that your controllers use topics you will find that the topics need some overall mapping between clients. I run NodeRED (and mosquito within that) and I use NodeRED logic to implement this mapping, sometimes duplicating messages between different topics so that all my controllers can see and control everything.

This provides a central way of topic management but If you are only using HA and ST with Sonoff you might get away with some tweaking of the JS code in the bridge. What you need to be careful with are race conditions where you get loops of updates propagating endlessly between your controllers.

MQTT is incredibly useful to integrate different controllers. My whole system is based around MQTT. I have lots of controllers and devices updating 3 different local MQTT brokers, and one public , and I use NodeRED to copy messages between these brokers. I personally do not directly interconnect MQTT brokers

This is a useful topic too… if you use two MQTT brokers.

Thank you All for prompt and detailed answers.
It sounds much more complicated than I thought, especially for me, newbie in HA.

Do you recommend maybe xiaomi gateway plus something for z-wave ?
or maybe it’s no make sense to move to hassio and I should configure everything on my current Home Assistant docker hosted in Synology ?

P.S. I will try go through all provided solutions again, as for now I think that I know nothing :wink:

As another HA / MQTT / ZWave newb I find this area of HA incredibly confusing. I have set up a broker and configured pub/sub on my primary HA and my secondary HA and some things automatically propagate but others do not. I get an entry for a smartplug entity but no corresponding switch. Lightbulbs don’t propagate at all. Other sensors show up inside the history but are not displaying in the Overview. Sometimes a switch will randomly show up in the master but if I click it, usually nothing happens but sometimes 30 seconds later the switch changes state.

Using a monitoring client it appears that all the expected events are flowing through the broker but somehow many things get missed by the master. I’m using a docker based separate Mosquitto broker with mounted volume for state. Both raspberry pi HA have that broker configured.

Sorry for venting, I’m not complaining, honestly :slight_smile: the learning curve is pretty extreme for MQTT and the propagation of Z-Wave devcies from slave to master does not “Just Work” in my experience despite the various blog entries and guides indicating that it is easy.