Mqtt System broker protocol error - mosquitto

Hi,

I’m trying to get OH3’s system broker to connect to my mosquitto broker.

OH3 is running under docker, I have the mqtt binding up and running and can retrieve values from a sensor just fine. I am trying to get the system broker to connect as well.
(FWIW I am not sure whether I understood the system broker conceptually, the forum is a tad confusing with OH2 embedded (moquette broker) and these are my first couple of days with OH) .

I have configured the a system broker:

  • tesport3
  • brokerhost: dockerhost.lan
  • secure connection: no
  • Client ID:testport3

This results in a MQTT Broker thing

But with status ERROR:COMM
the log shows:

2020-12-30 16:17:57.498 [INFO ] [.transport.mqtt.MqttBrokerConnection] - Starting MQTT broker connection to 'dockerhost.lan' with clientid testport3
2020-12-30 16:18:57.500 [INFO ] [.reconnect.PeriodicReconnectStrategy] - Try to restore connection to 'dockerhost.lan'. Next attempt in 60000ms

the mosquitto logs show:

1609341597: New connection from 172.17.0.1 on port 1883.
1609341597: Client <unknown> disconnected due to protocol error.

just to show there is no connectivity issue the ‘MQTT broker’ connects just fine:

1609337190: New connection from 172.17.0.1 on port 1883.
1609337190: New client connected from 172.17.0.1 as 180775bc-0208-493e-a6ba-9e243deacea0 (p2, c1, k60).

What is different with the system broker?
Has anybody managed to connect it a mosquitto broker?
(and maybe: does what I am trying to do even make sense? - I was hoping to see events, logs, status updates from OH on mosquitto)

thanks!

This broker has been mentioned a few times in the forum since OH3, but we haven’t had an answer about what it does.

My personal opinion is that it existed in OH2 to connect/bridge to the internal broker (Moquette). This broker was removed in OH3, but the system broker bridge wasn’t, for some reason. So my hunch is that this system broker doesn’t do anything (and sometimes causes unpredictable behaviour).

But that’s just a guess.

1 Like

If so, that would be a bug,

I connected with the system broker first but I used basic auth.

You only need one bridge per Broker just use the working one.

Only setup another bridge if connecting to another broker eg one in the cloud

alright, I did manage to get a working connection but without much joy: the internal system broker doesn’t publish internal events. (it may not be a broker at all, just another client as @denominator indicated)

I believe the root cause of this little exploration is due to a combination of some unfortunate UI design and/or messy config handling: the settings->mqtt system broker UI allows to change settings and save them - but they are ignored by OH unless you also change the connection name (IIRC) … which then creates a new thing, and so on.

So unless you change the connection name you end up with two bits of UI that are out of sync.
(it also doesn’t help that even if you change the connection the old connection can still be retrying and filling up the logs)

1 Like

Whew! I was having all the same problems. After hours of banging my head against a brick wall, I came across this step-by-step tutorial that seems to have solved most of my issues… well, mostly.

I’m still seeing two connections from OH3 to my Mosquitto broker… but that’s a lot better than what I was getting earlier, with one always recycling every few minutes.