Problems getting MQTT to work on latest Openhabian

Hi!

I’ve been offline for 6 months and I’m not starting to launch a new Openhab2 setup for my new home.
Lots of things have changed, I’ve noticed. However I can’t get the mqtt binding to work.

I have the mosquitto broker installed on 10.0.1.11
I have openhab on 10.0.1.22
I have a publisher on 10.0.1.20

I look in the logs on the broker and when I start openhab no client is connecting.
I can manually using mosquitto_pub publish stuff to the broker from the openhab instance, so there is no firewall issue.

I have the following mqtt.cfg:

mosquitto.url=tcp://10.0.1.11:1883
mosquitto.clientId=openhab
mosquitto.qos=0
mosquitto.retain=false
mosquitto.async=true

and mqtt-eventbus:

broker=mosquitto

It says in the mqtt-eventbus broker name should be in openhab.cfg (but that feels outdated?)

In karaf:

openhab> feature:list | grep MQ
esh-tp-paho                                 │ 0.9.0.SNAPSHOT   │          │ Uninstalled │ distro-2.2.0-SNAPSHOT   │ MQTT v3 Client
openhab-transport-mqtt                      │ 2.2.0.SNAPSHOT   │          │ Uninstalled │ distro-2.2.0-SNAPSHOT   │ MQTT Transport
openhab-action-mqtt                         │ 1.11.0.SNAPSHOT  │ x        │ Started     │ addons-2.2.0-SNAPSHOT   │ MQTT Action
openhab-binding-mqtt1                       │ 1.11.0.SNAPSHOT  │ x        │ Started     │ addons-2.2.0-SNAPSHOT   │ MQTT Binding
openhab-binding-mqttitude1                  │ 1.11.0.SNAPSHOT  │          │ Uninstalled │ addons-2.2.0-SNAPSHOT   │ OwnTracks (formerly MQTTitude) Binding
openhab-persistence-mqtt                    │ 1.11.0.SNAPSHOT  │          │ Uninstalled │ addons-2.2.0-SNAPSHOT   │ MQTT Persistence

Feels like I’m missing something very basic, and it’s like openhab is not using my config files?
Nothing in the logs about mqtt either.

re-install this

1 Like

Now it works. Thanks for the help!

I do get an exception


2017-08-24 21:13:14.235 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection 'broker'
2017-08-24 21:13:14.622 [ERROR] [t.mqtt.internal.MqttBrokerConnection] - MQTT connection to broker was lost
org.eclipse.paho.client.mqttv3.MqttException: Connection lost
	at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:146) [206:org.openhab.io.transport.mqtt:1.11.0.201708100110]
	at java.lang.Thread.run(Thread.java:745) [?:?]
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:65) ~[?:?]
	at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:107) ~[?:?]
	... 1 more

The broker named “broker” was put there by misstake. I removed it from the config but it still tries to start it.
Any idea how to remove it?

I’ll answer my own question…
Removed the: rm /var/lib/openhab2/config/org/openhab/mqtt.config

1 Like