At wits end with MQTT configuration

I had a configuration with MQTT that worked. So let’s just get that out of the way. Then one day it stopped working, and now I am trying to get the configuration working again.

For starters I did a clean install of OpenHab 2.1, the one from the Internet download page. I also downloaded the addons, including the legacy ones and before I started OpenHab, I put them in the addons directory.

Then I activated the MQTT plugin from the paper ui.

Within the created mqtt.conf file I add the following lines: (Please NOTE that I added spaces so that the URL does not look like a link as I am a new user and can only post a certain number of links.)

vensac.url=tcp://192.168.1.82:1883
vensac.clientId=openhab

On the Raspberry Pi when openhab is started there is no message that the MQTT layer has been activated. It is as follows:

23:31:29.592 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'Menzingen.items'
23:32:01.333 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'Menzingen.sitemap'
23:32:12.577 [INFO ] [.dashboard.internal.DashboardService] - Started dashboard at http: // 192.168.1.82:8080
23:32:12.581 [INFO ] [.dashboard.internal.DashboardService] - Started dashboard at https: // 192.168.1.82:8443
23:32:14.064 [INFO ] [basic.internal.servlet.WebAppServlet] - Started Basic UI at /basicui/app
23:32:14.527 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /paperui
23:32:14.931 [INFO ] [panel.internal.HABPanelDashboardTile] - Started HABPanel at /habpanel

As you can see nothing wrt to MQTT.

If I run the exact same mqtt.cfg file on a Linux x86 machine I get the following output.

openhab> log:display
01:20:29.288 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'Menzingen.items'
01:20:34.380 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'Menzingen.sitemap'
01:20:36.493 [INFO ] [.dashboard.internal.DashboardService] - Started dashboard at http: // 192.168.1.28:8080
01:20:36.495 [INFO ] [.dashboard.internal.DashboardService] - Started dashboard at https:  //  192.168.1.28:8443
01:20:37.325 [INFO ] [basic.internal.servlet.WebAppServlet] - Started Basic UI at /basicui/app
01:20:37.547 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /paperui
01:20:37.723 [INFO ] [panel.internal.HABPanelDashboardTile] - Started HABPanel at /habpanel
01:20:37.978 [INFO ] [penhab.io.transport.mqtt.MqttService] - MQTT Service initialization completed.
01:20:37.980 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection 'vensac'

Notice how the MQTT service has been initialized. I know the PI reads the configuration file because I put garbage into the file and get messages.

Next I have the following items file:

    Switch toilet "Switch Toilet" (all) {mqtt=">[vensac:/switch/menzingen/toilet:command:on:default],>[vensac:/switch/menzingen/toilet:command:off:default]"}
    Switch shower "Switch Shower" (all) {mqtt=">[vensac:/switch/menzingen/shower:command:off:default],>[vensac:/switch/menzingen/shower:command:on:default]"}
    Switch guest  "Switch Guest"  (all) {mqtt=">[vensac:/switch/menzingen/guest:command:off:default],>[vensac:/switch/menzingen/guest:command:on:default]"}
    Switch kitchen "Switch Kitchen" (all) {mqtt=">[vensac:/switch/menzingen/kitchen:command:off:default],>[vensac:/switch/menzingen/kitchen:command:on:default]"}

If I am on either machine when I press the button I get the following output:

1:20:55.795 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'toilet' received command ON
01:20:55.875 [INFO ] [marthome.event.ItemStateChangedEvent] - toilet changed from NULL to ON
01:21:03.854 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'guest' received command ON
01:21:03.865 [INFO ] [marthome.event.ItemStateChangedEvent] - guest changed from NULL to ON
01:21:06.524 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'guest' received command OFF
01:21:06.533 [INFO ] [marthome.event.ItemStateChangedEvent] - guest changed from ON to OFF
01:21:07.638 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'toilet' received command OFF
01:21:07.651 [INFO ] [marthome.event.ItemStateChangedEvent] - toilet changed from ON to OFF
01:40:27.577 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'toilet' received command ON
01:40:27.607 [INFO ] [marthome.event.ItemStateChangedEvent] - toilet changed from OFF to ON

As you can see the events are being triggered. However, MQTT is seeing no messages. I am using the mosquitto server and have the client app subscribed to all messages. For kicks I went to yet another machine and threw out mock messages to see if MQTT was working. It was working.

What gives? Why is the MQTT binding not working? It was working four months ago without problems.

Hey Christian,

That sounds weird. You shouldn’t need to put anything into that folder. Everything (except pre-release builds) can be installed via Paper UI.

Normally that is an obvious sign for the binding not being installed. As your setup overall sounds a bit weird it might be complicated to help. Could you please state your base system, installation method, etc.?

My recommendation would be to make a quick reinstall with openHABian. Takes a few minutes of your time, then you’ll have a working openHAB instance on your fingertips, then you can follow this simple guide: