I had MQTT running flawless in my previous setup and now after reinstalling everything it keeps losing the connecion to the broker. So I removed everything:
uninstalled binding (is it correct that there isn’t any 2.x version?)
I installed the binding by adding “mqtt1” on the binding line in /etc/openhab2/services/addon.cfg.
Configuration is persisted in /etc/openhab2/services/mqtt.cfg
OH2 then creates config in /var/lib/openhab2/config/org/openhab/mqtt.config by itself.
BTW: You reinstalled the broker but is the service really running ? Or maybe the service is running but only bound to the local interface (127.0.0.1) ? I spent hours looking after “errors” like that …
I noticed indeed that the mosquitto service was not running properly: Active: active (exited)
I reinstalled the service via the openhabian-config menu and saw 2 errors:
$ sed -i /password_file/d /etc/mosquitto/mosquitto.conf
sed: can't read /etc/mosquitto/mosquitto.conf: No such file or directory
$ sed -i /allow_anonymous/d /etc/mosquitto/mosquitto.conf
sed: can't read /etc/mosquitto/mosquitto.conf: No such file or directory
So I created this file:
sudo touch /etc/mosquitto/mosquitto.conf
Afterwards I did a reinstall of mosquitto (again via openhiab-config) and the error were gone + service is running properly.
I’ve tested it via mosquitto_sub and mqtt.fx (for windows): everything looks fine
All actions which are wirkong with mqtt are working again. thanks!
Hey guys , Did you find a solution for this problem .
I have the same issue and struggle too get the service running.
Have tried different settings in .cfg file and config, even installed on a different machine and get the same error.
Can you guys help me out and give me some hints where to look.
2018-02-17 11:50:37.435 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'globalcache.things’
2018-02-17 11:50:40.517 [INFO ] [.dashboard.internal.DashboardService] - Started dashboard at http://192.168.1.150:8080
2018-02-17 11:50:40.963 [INFO ] [.dashboard.internal.DashboardService] - Started dashboard at https://192.168.1.150:8443
2018-02-17 11:50:41.128 [INFO ] [basic.internal.servlet.WebAppServlet] - Started Basic UI at /basicui/app
2018-02-17 11:50:41.159 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /paperui
2018-02-17 11:50:41.415 [INFO ] [panel.internal.HABPanelDashboardTile] - Started HABPanel at /habpanel
2018-02-17 11:50:41.906 [INFO ] [e.internal.GlobalCacheHandlerFactory] - GlobalCache binding v2.1.0
2018-02-17 11:50:42.249 [INFO ] [b.core.service.AbstractActiveService] - Modbus Polling Service has been started
2018-02-17 11:50:42.277 [INFO ] [penhab.io.transport.mqtt.MqttService] - MQTT Service initialization completed.
2018-02-17 11:50:42.278 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection 'broker’
2018-02-17 11:50:44.745 [ERROR] [penhab.io.transport.mqtt.MqttService] - Error starting broker connection
Unable to connect to server (32103) - java.net.ConnectException: Connection refused: connect
at org.eclipse.paho.client.mqttv3.internal.TCPNetworkModule.start(TCPNetworkModule.java:79)[200:org.openhab.io.transport.mqtt:1.10.0]
at org.eclipse.paho.client.mqttv3.internal.ClientComms$ConnectBG.run(ClientComms.java:650)[200:org.openhab.io.transport.mqtt:1.10.0]
at java.lang.Thread.run(Unknown Source)[:1.8.0_151]
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)[:1.8.0_151]
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)[:1.8.0_151]
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)[:1.8.0_151]
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)[:1.8.0_151]
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)[:1.8.0_151]
at java.net.PlainSocketImpl.connect(Unknown Source)[:1.8.0_151]
at java.net.SocksSocketImpl.connect(Unknown Source)[:1.8.0_151]
at java.net.Socket.connect(Unknown Source)[:1.8.0_151]
at org.eclipse.paho.client.mqttv3.internal.TCPNetworkModule.start(TCPNetworkModule.java:70)[200:org.openhab.io.transport.mqtt:1.10.0]
… 2 more