Thanks Vincent for extending your help! also Thanks @Dim your patience -( I am new to this environment )
@vzorglub
Before I goahead with your suggestion of reinstalling mqtt broker, please help me clarify few doubts
Why the order/sequence of line ( in mqtt.cfg file) is different in mqtt.cfg file and the output which is getting from openhab console. ( plz ref below)
also, plz ref below the openhab log file , it says - Error starting broker connection. is that the reason why you want me to reinstall mqtt broker? if yes , please let me know do i need to uninstall & install both mosquitto and mosquitto-clients or only mosquitto ?? (BTW i use this source to download mqtt package : http://repo.mosquitto.org/debian/mosquitto-stretch.list) ?
2018-06-01 00:18:42.709 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection '<broker>'
2018-06-01 00:18:43.010 [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) [223:org.openhab.i$
at org.eclipse.paho.client.mqttv3.internal.ClientComms$ConnectBG.run(ClientComms.java:650) [223:org.openhab.io$
at java.lang.Thread.run(Thread.java:745) [?:?]
Caused by: java.net.ConnectException: 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) ~[?:?]
Sencondly , when I run
pi@raspberrypi:~ $ dpkg -l | grep openhab
ii openhab2 2.3.0~RC2-1 all openhab2
ll openhab2
it looks like there are two instances of openhab2. ( is my understanding correct??) if yes, do I need to uninstall openhab as well and do a fresh installation.??
2018-06-01 01:31:05.886 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection 'broker'
2018-06-01 01:31:06.175 [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) [225:org.openhab.io.transport.mqtt:1.12.0$
at org.eclipse.paho.client.mqttv3.internal.ClientComms$ConnectBG.run(ClientComms.java:650) [225:org.openhab.io.transport.mqtt:1.12.0.$
at java.lang.Thread.run(Thread.java:745) [?:?]
Caused by: java.net.ConnectException: 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
1527339623: mosquitto version 1.5 starting
1527339623: Config loaded from /etc/mosquitto/mosquitto.conf.
1527339623: Opening ipv4 listen socket on port 1883.
1527339623: Opening ipv6 listen socket on port 1883.
1527339623: Opening ipv4 listen socket on port 1883.
1527339623: Error: Address already in use
```
Ok, so your broker is refusing the connection from openHAB
The main reason for that are incorrect usernames and password settings.
Show me your mosquitto.conf file
It should be located in /etc/mosquitto
Answers to your questions above:
It doesn’t matter. OH is pulling the info from your mqtt.cfg and parsing it in the /var/lib/openhab2/config/org/openhab/mqtt.config automatically. DO NOT TOUCH /var/lib/openhab2/config/org/openhab/mqtt.config. Your are a beginner, let OH handle these things for you.
Your understanding is incorrect. Your console output is showing the main process and the subprocess
Let’s go back to basic. Follow me exactly. Don’t try to improvise
I am not putting your security at risk because you are doing it all in your LAN
When it works, we will add the username and password back in use
Let’s go…
Change the allow_anonymous to true
and comment out the password_file line
mosquitto.conf
port 1883
persistence false
log_dest file /var/log/mosquitto/mosquitto.log
log_type information
connection_message true
log_timestamp true
allow_anonymous true
#password_file /etc/mosquitto/pwfile
it seems that mosquitto is not running (it doesn’t seem to be an auth issue)
it is strange but if you don’t put anything (port, listener, etc) in the config file for networking… it works (it uses the defaults)
(I saw this recently on my rPi3 after I upgraded mosquitto to v1.5)
2018-06-01 08:57:55.755 [INFO ] [thome.model.lsp.internal.ModelServer] - Started Language Server Protocol (LSP) service on port 5007
2018-06-01 08:57:56.953 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'MyHome.things'
2018-06-01 08:57:58.897 [INFO ] [basic.internal.servlet.WebAppServlet] - Started Basic UI at /basicui/app
2018-06-01 08:57:59.058 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /paperui
2018-06-01 08:57:59.136 [INFO ] [panel.internal.HABPanelDashboardTile] - Started HABPanel at /habpanel
2018-06-01 08:57:59.544 [INFO ] [penhab.io.transport.mqtt.MqttService] - MQTT Service initialization completed.
2018-06-01 08:57:59.551 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection 'broker'
2018-06-01 08:57:59.826 [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) [225:org.openhab.io.transport.mqtt:1.12.0.RC2]
at org.eclipse.paho.client.mqttv3.internal.ClientComms$ConnectBG.run(ClientComms.java:650) [225:org.openhab.io.transport.mqtt:1.12.0.RC2]
at java.lang.Thread.run(Thread.java:745) [?:?]
Caused by: java.net.ConnectException: 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) ~[?:?]
if you don’t fix your mosquitto.conf… you will spend all week here
comment out all networking options from the file and check if mosquitto is running
then, OH2 will connect (your mqtt.cfg is finally correct)
Just another input for your guys while I am trying to install Mosquitto again… I had MQTT.fx runnning on another PC and till yesterday it was connecting properly with MQTT broker… In fact I was able to publish and subscribe messages…