Problems getting MQTT to work on latest Openhabian


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
I have openhab on
I have a publisher on

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:


and mqtt-eventbus:


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 []
	at [?:?]
Caused by:
	at ~[?:?]
	at org.eclipse.paho.client.mqttv3.internal.wire.MqttInputStream.readMqttWireMessage( ~[?:?]
	at ~[?:?]
	... 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