Changed from OFFLINE (BRIDGE_OFFLINE) to OFFLINE (COMMUNICATION_ERROR): java.lang.Exception: No MQTT client

Hi,
I’m having trouble with MQTT Binding 2.x. I already read, I think, all the similar topics realed to this problem but i didn’t found a solution. So this is the problem:

  • I wan’t to connect to a remote MQTT broker out of my network, in this case the Adafruit broker using the platform https://io.adafruit.com
  • The bridge is connecting to the broker without errors
  • The MQTT thing used for the connection to the channels doesn’t work, I tried alternative scripts following the instructions of the topics found int the community but nothing has changed. I also tried with the Paper UI, all the channels topics are correct.

This is the Adafruit documentation that I followed https://io.adafruit.com/api/docs/#adafruit-io.

This is my script (*** means private informations):

Bridge mqtt:broker:adafruit "MQTT Broker Adafruit" [ host="io.adafruit.com", secure=true, username="***", password="***" ]

Thing mqtt:topic:office_sensors "MQTT Office Sensors" (mqtt:broker:adafruit) {
        Channels:
        Type number : meeting_room_temperature [ stateTopic="***/feeds/meeting-room-temperature" ]
}

And this is the error:

[INFO ] [ome.event.ThingStatusInfoChangedEvent] - ‘mqtt:topic:office_sensors’ changed from OFFLINE (BRIDGE_OFFLINE) to OFFLINE (COMMUNICATION_ERROR): java.lang.Exception: No MQTT client

Any idea how to solve it?

Since no one is replying I will try to assist.
Did you try to sub/pub manually?
I use the mosquitto_sub/pub
Example:

mosquitto_pub --host 'dat_adafruid_host?' --username "That_Username_you_defined?" --pw 'YourAPIkey_IGues?' --id 'openhabBOY' --topic 'test/dev/value' --message '500'

edit:
I know many users prefer textual config but did you try to set it up via paperUI?

Which version of the MQTT binding are you using? 2.4, 2.5 M1, snapshot? There were many bugs in the 2.4 version so I’d recommend running at least the M1 version.

I’m using 2.4, I tried to update openhab but there weren’t updates. I think that time I chose stable release.

Sorry Birdie, the reply wasn’t send.
Yeah, I tried to do that test and the result was positive, everything works.
I already tried with Paper UI, following the instructions also on github where this problem is described more accurately.
I’m switching from MQTT binding 1.x, with that version the channels and the broker worked. I want to use the new version for fun.

If you are on the release repo then yes, 2.4 is the latest. You would need to change to the testing repo to get the milestone releases.

If you are using openHABian you can do this with openhabian-config. If not see openHAB on Linux | openHAB.

Thanks! I’ll try to update and see what changes.

With openHAB 2.5 M1 MQTT 2.x seems to work, but not smoothly as 1.x version. To get the Bridge for the broker online I had to modify the file a first time, getting some errors, then a second time bringing it back as the original. So my code had to work the first time.
Anyway, only for info, these are the errors:

20:50:46.552 [INFO ] [ransport.mqtt.internal.ClientCallback] - MQTT connection to ‘io.adafruit.com’ was lost
org.eclipse.paho.client.mqttv3.MqttException: Connection lost
at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:181) [269:org.eclipse.paho.client.mqttv3:1.2.0]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]
Caused by: java.io.EOFException
at java.io.DataInputStream.readByte(DataInputStream.java:267) ~[?:?]
at org.eclipse.paho.client.mqttv3.internal.wire.MqttInputStream.readMqttWireMessage(MqttInputStream.java:92) ~[?:?]
at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:133) ~[?:?]
… 7 more

20:50:46.572 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - ‘mqtt:broker:adafruit’ changed from OFFLINE to OFFLINE (COMMUNICATION_ERROR): Connection lost

Do you know when the 2.5 release is planned? I’m waiting for several fixes, and I also have the same MQTT problem…

Last estimates were the end of the year. But if you are looking to upgrade, there really is no reason not to upgrade to 2.5 M4 unless you use Hue emulation. The milestone releases are just about as stable as the releases.

Thanks for your opinion, so I will try with 2.5 M4
BR