This helped me as well. the two config files were not allowing the MQTT to work. Thank you.
I can not get the mqtt binding to work:
2017-09-10 18:53:38.387 [INFO ] [penhab.io.transport.mqtt.MqttService] - MQTT Service initialization completed.
2017-09-10 18:53:38.409 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection 'mosquitto'
2017-09-10 18:53:38.569 [INFO ] [ulation.internal.HueEmulationServlet] - Started Hue Emulation service at /api
2017-09-10 18:53:38.671 [ERROR] [penhab.io.transport.mqtt.MqttService] - Error starting broker connection
Unable to connect to server (32103) - java.net.ConnectException: Connection refused (Connection refused)
at org.eclipse.paho.client.mqttv3.internal.TCPNetworkModule.start(TCPNetworkModule.java:75)[221:org.openhab.io.transport.mqtt:1.9.0]
at org.eclipse.paho.client.mqttv3.internal.ClientComms$ConnectBG.run(ClientComms.java:538)[221:org.openhab.io.transport.mqtt:1.9.0]
at java.lang.Thread.run(Thread.java:745)[:1.8.0_121]
Caused by: java.net.ConnectException: Connection refused (Connection refused)
at java.net.PlainSocketImpl.socketConnect(Native Method)[:1.8.0_121]
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)[:1.8.0_121]
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)[:1.8.0_121]
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)[:1.8.0_121]
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)[:1.8.0_121]
at java.net.Socket.connect(Socket.java:589)[:1.8.0_121]
at org.eclipse.paho.client.mqttv3.internal.TCPNetworkModule.start(TCPNetworkModule.java:66)[221:org.openhab.io.transport.mqtt:1.9.0]
... 2 more
when I use the karaf console as suggested here this is what is listed out:
openhab> config:edit org.openhab.mqtt
openhab> config:property-list
mosquitto.async = false
mosquitto.pwd = xxxxxxx
mosquitto.qos = 1
mosquitto.retain = true
mosquitto.url = tcp://localhost:8883
mosquitto.user = openhabian
service.pid = org.openhab.mqtt
openhab>
I did have two mqtt files, so I did:
config:delete org.openhab.mqtt2
bundle:restart 220
any ideas what the problem might be?
@rlkoshak Did all that in that tutorial already, the broker is running:
,
Does this mean that the credentials are wrong, or that it can not find localhost and that i need to use IP address instead?
Sidenote: What I really miss in the paperUI, is a button to test the config(You press it and it try to connect to the API of that binding, only works for 2+ bindingsā¦)
I think the problem is what is stored in the database, and that this is not matching up with what is stored in the .cfg fileā¦ But from what I get when running
openhab> config:edit org.openhab.mqtt
openhab> config:property-list
How can I easily restart the binding, because it does not seems to try to reconnect itself(according to the frontail logs)?
I you did a lot of tinkering with mqtt you may be affected by a bug that the wrong config is stored deep down in openHAB. Perform the steps provided here and see what happens:
I for one am definitely bookmarking this conversation already. Tnx
Itās not a bug unfortunately that cfg files canāt āremoveā entries of the OSGi cache / config admin. It is seen as a feature. I wasnāt really satisfied with the situation for the new upcoming OH2 Mqtt, so we will have a solution for config files soon that also work for OH1.mqtt by adding a specific first line to the config.
Cheers, David
Sorry for using the wrong term, but for an end user it is a major impact and has caused many, many threads and a lot of writing in this forum to get the users going again ā¦
Really? So having PaperUI add-ons removed from your install when they are not present in addons.cfg is considered OK but doing the same thing in any other services/*.cfg is not.
It is inconsistencies like these that drives the users crazy. I may not like the behavior one way or the other, but when everything works consistently at least I as a user can predict how it will work.
Grrrr. I know this isnāt your doing. I wish I knew about the discussion that took place when it was decided to be a āfeatureā.
If you look closely at it, it currently is actually consistent. If you remove the bindings=
line from your addons.cfg, nothing will happen either, the configuration is kept.
There has never been a discussion that this is a feature. It actually is a bug that came in as a side effect of moving to Karaf two years ago, which meant that we are not starting the OSGi version with the ācleanā option anymore - and therefore, old configurations are not removed upon startup, but kept.
As David says, we looked into how we can address this and a pull request is already created to solve it.
Thanks for the clarification. I misunderstood Davidās comment. Sounds good!
this post was a great help, just one comment
the correct format is :
ssh -p 8101 openhab@localhost
and not :
ssh openhab@localhost -p 8101
At least when using debian, both versions are valid.
Sorry guys - comming with the same problem solved above. But I fail since several days.
I got the same message in my log:" ReasonCode 32109 : Cause : null"
As proposed I deleted file /var/lib/openhab2/config/org/openhab/mqtt.config.
The result is always the same and file /var/lib/openhab2/config/org/openhab/mqtt.config look like this:
.clientId=āopenHABā
.pwd=āmosquittoā
.url=ātcp://127.0.0.1:1883ā
.user="user"
mosquitto.async="false"
mosquitto.clientId="openHAB"
mosquitto.pwd="the correct password"
mosquitto.retain="true"
mosquitto.url="tcp://localhost:1883"
mosquitto.user="user"
service.pid=āorg.openhab.mqttā
-
I donāt know where the . entries come from (not in mqtt.cfg)
-
and log message is:
19:23:59.938 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting connection helper to periodically try restore connection to broker ''
19:24:09.944 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection ''
19:24:09.972 [ERROR] [t.mqtt.internal.MqttBrokerConnection] - MQTT connection to broker was lost
Verbindung wurde getrennt (32109) - java.io.EOFException
at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:146)[234:org.openhab.io.transport.mqtt:1.10.0]
at java.lang.Thread.run(Thread.java:745)[:1.8.0_65]
Caused by: java.io.EOFException
at java.io.DataInputStream.readByte(DataInputStream.java:267)[:1.8.0_65]
at org.eclipse.paho.client.mqttv3.internal.wire.MqttInputStream.readMqttWireMessage(MqttInputStream.java:65)[234:org.openhab.io.transport.mqtt:1.10.0]
at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:107)[234:org.openhab.io.transport.mqtt:1.10.0]
ā¦ 1 more
19:24:09.978 [ERROR] [t.mqtt.internal.MqttBrokerConnection] - MQTT connection to āmosquittoā was lost: Verbindung wurde getrennt : ReasonCode 32109 : Cause : null
19:24:09.980 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting connection helper to periodically try restore connection to broker 'mosquittoā
19:24:19.982 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection 'mosquittoā
19:24:20.012 [ERROR] [t.mqtt.internal.MqttBrokerConnection] - MQTT connection to broker was lost
Verbindung wurde getrennt (32109) - java.io.EOFException
at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:146)[234:org.openhab.io.transport.mqtt:1.10.0]
at java.lang.Thread.run(Thread.java:745)[:1.8.0_65]
Caused by: java.io.EOFException
at java.io.DataInputStream.readByte(DataInputStream.java:267)[:1.8.0_65]
at org.eclipse.paho.client.mqttv3.internal.wire.MqttInputStream.readMqttWireMessage(MqttInputStream.java:65)[234:org.openhab.io.transport.mqtt:1.10.0]
at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:107)[234:org.openhab.io.transport.mqtt:1.10.0]
ā¦ 1 more
19:24:20.015 [ERROR] [t.mqtt.internal.MqttBrokerConnection] - MQTT connection to āā was lost: Verbindung wurde getrennt : ReasonCode 32109 : Cause : null
I would be grateful for any idea.
uuuppps.
some information got lost by copy and past. Try to put it into Preformatted text
<broker>
.clientId=āopenHABā
<broker>
.pwd=āmosquittoā
<broker>
.url=ātcp://127.0.0.1:1883ā
<broker>
.user="user"
mosquitto.async="false"
mosquitto.clientId="openHAB"
mosquitto.pwd="mosquitto"
mosquitto.retain="true"
mosquitto.url="tcp://localhost:1883"
mosquitto.user="user"
service.pid=āorg.openhab.mqttā
19:24:20.015 [ERROR] [t.mqtt.internal.MqttBrokerConnection] - MQTT connection to ā<broker>
ā was lost:
try:
Thanks. Stopping OH2 service first was the key. Thank you very much.