OH3 (New install) - MQTT binding failed to connect

Ok so I finally decided to move to OH3 and I did a clean install on my Raspberry Pi, however I cannot for the life of me get the MQTT binding to connect to the broker.

I have reinstalled multiple times now, and used the option to install mosquitto from the openhabian-config - with no password set i might add. Next I added the MQTT bridge and choose the MQTT Broker (NOT the system one) and entered the IP of the Pi. And it just will not connect.

UID: mqtt:broker:0b6a72dd62
label: MQTT Broker
thingTypeUID: mqtt:broker
  lwtQos: 0
  publickeypin: true
  keepAlive: 60
  qos: 0
  reconnectTime: 60000
  secure: false
  certificatepin: true
  lwtRetain: true
  enableDiscovery: true

I have verified that the service is in fact running on the Pi. What am I overlooking?

Using these same properties can you connect to the broker using some other MQTT client like mosquitto_sub or MQTTExplorer? You’ll want to do so from the same machine OH is running on to detect whether this is a networking problem.

You might need to set the logging for the binding to TRACE logging and see if there is any more information in the logs about why it’s failing to connect (timed out, connection refused, etc.).

Do you use unencrypted login at port 1883?
The problem encounters because of the default setting of mosquitto v2.0+. At default settings, nobody (devices & openhab) was able to connect to the mqtt server after i reinstalled openhabian.

Try to add these two lines (first line is really needed):
sudo nano /etc/mosquitto/conf.d/default.conf

listener 1883
allow_anonymous true

Afterwards restart mosquitto.

Thanks - I will try that :wink:

I didn’t make any changes, I just installed mosquitto from the config without any password set.

Odd. I didn’t have this problem, but I’ve always set a username and password for Mosquitto. I wonder if that makes a difference.

Note what @Giga522 said. Mosquitto has changed. It no longer supports by default a username/passwordless unencrypted connection by default. You actually have to change it’s config to enable that now.


Ahh i learned something new today - and i got it to work!

Thanks a lot!

Uhm I’m a little unsure how to add the lines? I have SSH’ed into the Pi using

sudo nano /etc/mosquitto/conf.d/default.conf

But then what do I do from there?