Cannot start MQTT Broker

Hi everybody,

I’ve got an issue with my MQTT-binding I simply cannot fix :frowning:

I’m running OH2 on openHABian and I installed the MQTT binding via Paper UI. Basically I want to get my Sonoff S20 with Tasmota up and running (which works if I just use it’s UI) and integrate it into my OH-sitemap.

My mqtt.cfg file looks like this:

broker.url=tcp://localhost:1883
broker.user=openhabian
broker.pwd=secret

The error I get when the system starts is:

2018-04-28 21:02:34.950 [INFO ] [penhab.io.transport.mqtt.MqttService] - MQTT Service initialization completed.
2018-04-28 21:02:34.960 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection ‘broker’
2018-04-28 21:02:35.237 [ERROR] [penhab.io.transport.mqtt.MqttService] - Error starting broker connection
org.eclipse.paho.client.mqttv3.MqttException: Unable to connect to server
at org.eclipse.paho.client.mqttv3.internal.TCPNetworkModule.start(TCPNetworkModule.java:79) [222:org.openhab.io.transport.mqtt:1.11.0]
at org.eclipse.paho.client.mqttv3.internal.ClientComms$ConnectBG.run(ClientComms.java:650) [222:org.openhab.io.transport.mqtt:1.11.0]
at java.lang.Thread.run(Thread.java:748) [?:?]
Caused by: java.net.ConnectException: Connection refused (Connection refused)
at java.net.PlainSocketImpl.socketConnect(Native Method) ~[?:?]
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[?:?]
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[?:?]
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[?:?]
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[?:?]
at java.net.Socket.connect(Socket.java:589) ~[?:?]
at org.eclipse.paho.client.mqttv3.internal.TCPNetworkModule.start(TCPNetworkModule.java:70) ~[?:?]
… 2 more

I’ve tried googling but nothing worked for me.

Can anybody explain to me what is happening and how I can try to resolve my issue?

Thanks in advance!

Maybe I am off-target here, but from what you are writing, I am not sure if you did install mosquitto or another MQTT broker? If not, you will need to do so.

Hey there,

I’m talking about the MQTT-binding on my OH2.

afaik I’m able to start a broker on my machine (PRI3), which doesn’t work in my case.

You need an mqtt broker!! As you have defined you IP as localhost, you can install mosquitto on the same machine as openHAB. mosquitto is very lightweight and won’t ipair your machine. If it doesn’t work for you, just remove it!

The MQTT Binding tries to connect TO a MQTT broker, which is not part of OH!
If such broker isn’t started the binding can’t connect, hence the observed errors!

In case not seen, this post may help: