New user, MQTT woes

New user of a few days. I’m running Openhab 2.4.1-1 on a raspberry pi 3. I’ve started with the demo configuration, added the Hue binding and had a play around until I got a working sitemap. So far so good.

On another Raspberry Pi, I have a MQTT to C-Bus interface running. That’s been up and running for over a year with no issues. Control is mainly handled by node-red. I can subscribe and publish to it by MQTTLens. All seems ok on that end.

I’ve followed the instructions here which apparently broadly ok, even though it’s for the previous version of the MQTT binding.

I’ve added the MQTT broker, added and configured a broker thing. IP address matches the C-Bus raspberry pi.
I don’t get a mqtt.cfg file created, is that correct for 2.4? I’ve manually created one with the following:-


Log reports:-

2019-04-12 19:41:36.687 [INFO ] [.transport.mqtt.MqttBrokerConnection] - Starting MQTT broker connection to '' with clientid paho85664309100 and file store '/var/lib/openhab2/mqtt/'

2019-04-12 19:41:36.753 [hingStatusInfoChangedEvent] - 'mqtt:broker:379ee71a' changed from OFFLINE to ONLINE

I’ve added the switch in step 5 and tested from a publish in MQTTLens, but don’t get any results in the log.

I’ve run through the troubleshooting a few times (hence creating the mqtt.cfg file), but I don’t seem to be getting anywhere.

Hi @vworp,

Welcome to the openHAB community!

For a new user, the confusion is quite understandable, but you were looking at the wrong documentation. That is for the old binding and as of OH 2.4, a completely revised binding is included.
The mqtt.cfg file is indeed obsolute, that’s why it was missing. Everything is now defined via bridge and thing configurations.

The documentation for the new binding can be found here and there are several threads dealing with it as well.
Since many new users, and even some long-time users, have struggled with the new binding, perhaps we can help you get going if you specifiy your relevant configuration and what you want to accomplish.

1 Like

OK. I’ve deleted my mqtt.cfg, and uninstalled the MQTT binding and started from scratch.
Referencing this this time:-
I’ve added the Embedded MQTT Broker and MQTT binding.
Added a MQTT broker thing, configured it to use the IP address of my other raspberry pi, where my MQTT - C-Bus interface is.

Logs are showing:-

'mqtt:broker:c33e232b' changed from OFFLINE to ONLINE

Broker shows ONLINE in paper UI.

So the next thing I think I need to do is add a Generic MQTT Thing, select the bridge I’ve just configured, then add at least one channel.
I’ve added a text channel and an On/Off Switch.
My state topic is


and my command topic is


When I trigger the light (from it’s switch) I can see the MQTT message in MQTTLens, shouldn’t I also see this in the OpenHab log? I’m not seeing anything there.

If you use an external MQTT broker, there is no need for the embedded broker.

Can you share your thing and item configuration?
And just to be sure: did you check events.log and not openhab.log?

External to Openhab or external to the pi? I should have mosquitto running on both Pis.

Yes, using event.log from the frontail viewer.

Is there a way of outputting my thing and item configurations as text, rather than pasting in multiple screenshots from paperui?

One mosquitto on one pi is enough. :grin:

I’ve uninstalled the embedded MQTT broker and rebooted the pi. Deleted any MQTT things I had and started from scratch.
Added a MQTT broker thing and configured it with a broker hostname of, which is the remote C-Bus>MQTT raspberry pi.
This thing shows up as online, if I change the IP address it shows up as offline. I’m taking that as a good sign.

Added a generic MQTT text thing with a state topic


and command topic


(this topic is the light above my head, for ease of testing)
This thing shows up as


Confirm, you did the setup purely via PaperUI and selected the (online) broker thing as the mqtt bridge for the generic mqtt thing?
I see no reason for the generic mqtt thing to be offline.

Yes, purely through paper UI.
My initial foray a few days ago followed an old versions setup which involved creating mqtt.cfg. That’s since been deleted and uninstalled/reinstalled

If it’s any help, I’m quite happy to go for the nuclear option of a fresh install of openhabian. Realistically I’m not going to lose anything that I can’t reconfigure within a couple of hours.

If you used files for the setup, a restart of openhab would be necessary, why don’t try that anyway?
Additionally, what does PaperUI tell why the Generic mqtt thing is offline?

The generic MQTT thing is saying bridge offline.
The MQTT broker has changed to OFFLINE - COMMUNICATION_ERROR Timeout. I’ve not seen the broker do that before.

That sounds as if your broker thing lost the connection to the broker, I’d try to restart the mqtt broker.

sudo systemctl restart mosquitto

has done nothing for me, I’ve still gt an OFFLINE - COMMUNICATION_ERROR Timeout alarm.

If I do a full reinstall of openhabian, should I not install mosquito this time and use the embedded MQTT broker?

Did I missundstand you? I understood your broker is not on the machine running openHAB,
If your broker is running, I would not change it.

Mosquito is running on both pi. On the openhabian pi as I installed it with openhab, on the c-bus pi as I think it was installed with raspbian.
I can’t find any reference to mosquito in the installation and configuration instructions for the c-bus MQTT interface, so I don’t think it’s in use on that end.

This is still correct!

You could use sudo systemctl status mosquitto on the other system in order check if it is running.
Using sudo systemctl stop mosquitto and sudo systemctl disable mosquitto would prevent it from being restarted after a reboot.

So, which MQTT broker did you connect the Generic MQTT thing to? As from the above, it was the remote one. This broker is the one that is needed to run, the other should be stopped.

The remote pi, not the openhabian pi.
Trying to stop to stop the openhabian mosquitto is giving me an access denied error.

I think I’m going to start from scratch. Leave mosquitto off a fresh install and start with MQTT.

I’m sorry, but I missed the sudo in front of the commands (not needed for status be the others!

It’s alright, I assume sudo was a given :slight_smile: