OpenHAB doesn't seem to read from my MQTT server

Hi all, I hope someone can give me some help with an MQTT issue.

I’m looking at moving from SmartThings to a private solution, so am using MQTT at the moment to bridge from one system to another.

I have configured the MQTT broker and SmartApplication in SmartThings to sync the status of a few controls, I’m focusing on two of them right now, basic switches.

I’ve setup a sitemap in BasicUI that has the two switches bound to the MQTT items. I expect that when I turn or off a light in ST, that the message should cause the appropriate swicth in OH to mirror the action. It doesn’t seem to happen, and when I turn on or off the switch in OH, I don’t see anything on the broker screen.

OpenHAB2 and Mosquitto are running on my NAS (192.168.0.201), the MQTT Broker is currently running on my office desktop (192.168.0.15). Should I have MQTT talking to Mosquitto directly? or should it talk to the MQTT broker?

When I change one of my sample switches in SmartThings, I see the broker get three messages, one from SmartThings, one from MQTT, and a duplicate from SmartThings.

I have restarted the OH service recently to see if there were any startup errors and there didn’t seem to be anything urgent (multiple interfaces found, and it ignores what should be the main one, but can talk with other devices, so I’m not worried).

Also, I’ve been using MQTT.fx to monitor the topics, and only see one message coming in when I press the button in SmartThings.

Here we go with the files, if I forgot anything important let me know.

mqtt.cfg

mosquitto.url=tcp://192.168.0.201:1883 
mosquitto.clientId=OpenHAB2_Client

mqtt-eventbus.cfg

<nothing in here>

mqtt.items (I don’t know how wrapping will work, this is two lines)

Switch NigelOffice (lights) {mqtt="<[mosquitto:smartthings/NigelOffice/switch:state:defalt:default],>[mosquitto:smartthings/NigelOffice/switch:command:*:default],autoupdate=false"} 
Switch masterbed (lights) {mqtt="<[mosquitto:smartthings/Bedroom switch/switch:state:default:default],>[mosquitto:smartthings/Bedroom switch/switch:command:*:default],autoupdate=false"}

default.sitemap

sitemap default label="My first sitemap"
{
	Frame label="MQTT" {
		Switch item=masterbed label="Master Bedroom Lights"	
		Switch item=NigelOffice label="Nigel Office"
	} 
}

Here’s the log from my MQTT broker showing what happens when I turn on my Office Light

info: Incoming message from SmartThings: smartthings/NigelOffice/switch = off
info: Incoming message from MQTT: smartthings/NigelOffice/switch = off
info: Skipping duplicate message from: smartthings/NigelOffice/switch = off

And finally, here’s the openhab.log file for the recent restart

2018-04-30 16:39:24.183 [INFO ] [er.internal.HomeBuilderDashboardTile] - Started Home Builder at /homebuilder
2018-04-30 16:39:25.728 [WARN ] [g.eclipse.smarthome.core.net.NetUtil] - Found multiple local interfaces - ignoring 192.168.0.201
2018-04-30 16:39:25.796 [WARN ] [g.eclipse.smarthome.core.net.NetUtil] - Found multiple local interfaces - ignoring 192.168.0.201
2018-04-30 16:39:25.914 [INFO ] [.dashboard.internal.DashboardService] - Started dashboard at http://172.20.2.2:8090
2018-04-30 16:39:25.918 [INFO ] [.dashboard.internal.DashboardService] - Started dashboard at https://172.20.2.2:8444
2018-04-30 16:39:35.599 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'mqtt.items'
2018-04-30 16:39:35.750 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'plex.items'
2018-04-30 16:39:38.810 [INFO ] [thome.model.lsp.internal.ModelServer] - Started Language Server Protocol (LSP) service on port 5007
2018-04-30 16:39:39.868 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'default.sitemap'
2018-04-30 16:39:43.489 [INFO ] [basic.internal.servlet.WebAppServlet] - Started Basic UI at /basicui/app
2018-04-30 16:39:43.730 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /paperui
2018-04-30 16:39:44.208 [INFO ] [panel.internal.HABPanelDashboardTile] - Started HABPanel at /habpanel
2018-04-30 16:39:44.979 [INFO ] [ui.habmin.internal.servlet.HABminApp] - Started HABmin servlet at /habmin
2018-04-30 16:39:45.408 [INFO ] [.internal.PlexGenericBindingProvider] - Plex item ShieldPower bound to client 1e7ad18b9f2c88b5-com-plexapp-android property power
2018-04-30 16:39:45.428 [INFO ] [.internal.PlexGenericBindingProvider] - Plex item ShieldStatus bound to client 1e7ad18b9f2c88b5-com-plexapp-android property state
2018-04-30 16:39:45.433 [INFO ] [.internal.PlexGenericBindingProvider] - Plex item ShieldTitle bound to client 1e7ad18b9f2c88b5-com-plexapp-android property title
2018-04-30 16:39:45.437 [INFO ] [.internal.PlexGenericBindingProvider] - Plex item ShieldType bound to client 1e7ad18b9f2c88b5-com-plexapp-android property type
2018-04-30 16:39:45.442 [INFO ] [.internal.PlexGenericBindingProvider] - Plex item ShieldCover bound to client 1e7ad18b9f2c88b5-com-plexapp-android property playback/cover
2018-04-30 16:39:45.453 [INFO ] [.internal.PlexGenericBindingProvider] - Plex item ShieldProgress bound to client 1e7ad18b9f2c88b5-com-plexapp-android property playback/progress
2018-04-30 16:39:45.461 [INFO ] [.internal.PlexGenericBindingProvider] - Plex item ShieldEndTime bound to client 1e7ad18b9f2c88b5-com-plexapp-android property playback/endTime
2018-04-30 16:39:45.465 [INFO ] [.internal.PlexGenericBindingProvider] - Plex item ShieldTVVolume bound to client 1e7ad18b9f2c88b5-com-plexapp-android property playback/volume
2018-04-30 16:39:45.469 [INFO ] [.internal.PlexGenericBindingProvider] - Plex item ShieldTVPause bound to client 1e7ad18b9f2c88b5-com-plexapp-android property playback/pause
2018-04-30 16:39:45.476 [INFO ] [.internal.PlexGenericBindingProvider] - Plex item ShieldTVPlay bound to client 1e7ad18b9f2c88b5-com-plexapp-android property playback/play
2018-04-30 16:39:45.483 [INFO ] [.internal.PlexGenericBindingProvider] - Plex item ShieldTVPlayPause bound to client 1e7ad18b9f2c88b5-com-plexapp-android property playback/playpause
2018-04-30 16:39:45.486 [INFO ] [.internal.PlexGenericBindingProvider] - Plex item ShieldTVStop bound to client 1e7ad18b9f2c88b5-com-plexapp-android property playback/stop
2018-04-30 16:39:49.091 [INFO ] [b.core.service.AbstractActiveService] - Plex Refresh Service has been started
2018-04-30 16:39:50.018 [INFO ] [.binding.plex.internal.PlexConnector] - Plex websocket connected to 192-168-0-201.626cfd8fa5d94ba7b1dd38fb9288bdbf.plex.direct:32400

I don’t see anything in the logs I am worried about (but I might not know enough).

Thanks for any help with this, I spent all of yesterday afternoon and evening bashing my head against this, and fixed about a dozen things to get to this point.

I’m going to try editing this post later, but I realized I used the wrong term a couple of times.

The MQTT Bridge is running on my desktop, and that’s where I see three messages when I click on the button in ST.

And that should read “Should I have OH talking to Mosquitto directly? or should it talk to the MQTT bridge?”

I can’t see anything in your log about MQTT, did you install the binding?
Your seem confused about some terminology.
mosquitto IS the broker
So if mosquitto is running on you NAS (Same as your instance of OH) then your mqtt.cfg looks correct, so you should have some mqtt info in your logfile. It looks like the binding is not installed.

Do you have an mqtt debugging tool like mqtt-fx or mqttspy installed on your desktop to monitor the messages? Does ST publishes the right messages on the right topics?

Okay, ,you’re good. Somehow the binding did disappear. I had that happen a few times yesterday, where items I added disappeared later (Habmin was a good one for it).

I do have mqtt-fx installed, and I’m seeing tghe messages I would expect to see, smartthings/NigelOffice/switch with the content of on or off.

I’ve restarted Openhab, and cleared up an error it reported with the autoupate (I just removed that from both items).

Here’s the current startup, now it mentions mosquitto in the log, but I still get no activity

2018-04-30 17:57:45.928 [INFO ] [er.internal.HomeBuilderDashboardTile] - Started Home Builder at /homebuilder
2018-04-30 17:57:48.194 [WARN ] [g.eclipse.smarthome.core.net.NetUtil] - Found multiple local interfaces - ignoring 192.168.0.201
2018-04-30 17:57:48.261 [WARN ] [g.eclipse.smarthome.core.net.NetUtil] - Found multiple local interfaces - ignoring 192.168.0.201
2018-04-30 17:57:48.412 [INFO ] [.dashboard.internal.DashboardService] - Started dashboard at http://172.20.2.2:8090
2018-04-30 17:57:48.418 [INFO ] [.dashboard.internal.DashboardService] - Started dashboard at https://172.20.2.2:8444
2018-04-30 17:57:57.504 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'mqtt.items'
2018-04-30 17:57:57.617 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'plex.items'
2018-04-30 17:58:01.039 [INFO ] [thome.model.lsp.internal.ModelServer] - Started Language Server Protocol (LSP) service on port 5007
2018-04-30 17:58:02.333 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'default.sitemap'
2018-04-30 17:58:05.959 [INFO ] [basic.internal.servlet.WebAppServlet] - Started Basic UI at /basicui/app
2018-04-30 17:58:06.061 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /paperui
2018-04-30 17:58:06.222 [INFO ] [panel.internal.HABPanelDashboardTile] - Started HABPanel at /habpanel
2018-04-30 17:58:06.857 [INFO ] [penhab.io.transport.mqtt.MqttService] - MQTT Service initialization completed.
2018-04-30 17:58:06.863 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection 'mosquitto'
2018-04-30 17:58:07.251 [INFO ] [ui.habmin.internal.servlet.HABminApp] - Started HABmin servlet at /habmin
2018-04-30 17:58:11.899 [INFO ] [b.core.service.AbstractActiveService] - Plex Refresh Service has been started
2018-04-30 17:58:11.920 [INFO ] [.internal.PlexGenericBindingProvider] - Plex item ShieldPower bound to client 1e7ad18b9f2c88b5-com-plexapp-android property power
2018-04-30 17:58:11.997 [INFO ] [.internal.PlexGenericBindingProvider] - Plex item ShieldStatus bound to client 1e7ad18b9f2c88b5-com-plexapp-android property state
2018-04-30 17:58:12.051 [INFO ] [.internal.PlexGenericBindingProvider] - Plex item ShieldTitle bound to client 1e7ad18b9f2c88b5-com-plexapp-android property title
2018-04-30 17:58:12.061 [INFO ] [.internal.PlexGenericBindingProvider] - Plex item ShieldType bound to client 1e7ad18b9f2c88b5-com-plexapp-android property type
2018-04-30 17:58:12.074 [INFO ] [.internal.PlexGenericBindingProvider] - Plex item ShieldCover bound to client 1e7ad18b9f2c88b5-com-plexapp-android property playback/cover
2018-04-30 17:58:12.084 [INFO ] [.internal.PlexGenericBindingProvider] - Plex item ShieldProgress bound to client 1e7ad18b9f2c88b5-com-plexapp-android property playback/progress
2018-04-30 17:58:12.137 [INFO ] [.internal.PlexGenericBindingProvider] - Plex item ShieldEndTime bound to client 1e7ad18b9f2c88b5-com-plexapp-android property playback/endTime
2018-04-30 17:58:12.146 [INFO ] [.internal.PlexGenericBindingProvider] - Plex item ShieldTVVolume bound to client 1e7ad18b9f2c88b5-com-plexapp-android property playback/volume
2018-04-30 17:58:12.156 [INFO ] [.internal.PlexGenericBindingProvider] - Plex item ShieldTVPause bound to client 1e7ad18b9f2c88b5-com-plexapp-android property playback/pause
2018-04-30 17:58:12.197 [INFO ] [.internal.PlexGenericBindingProvider] - Plex item ShieldTVPlay bound to client 1e7ad18b9f2c88b5-com-plexapp-android property playback/play
2018-04-30 17:58:12.204 [INFO ] [.internal.PlexGenericBindingProvider] - Plex item ShieldTVPlayPause bound to client 1e7ad18b9f2c88b5-com-plexapp-android property playback/playpause
2018-04-30 17:58:12.210 [INFO ] [.internal.PlexGenericBindingProvider] - Plex item ShieldTVStop bound to client 1e7ad18b9f2c88b5-com-plexapp-android property playback/stop

Okay, I have made it further. Thanks for helping so far.

It turns out that I wasn’t paying full attention, SmartYhings and OH weren’t sending the same messages. ST was sending, and OH was sending ON.

I remembered that I had maps yesterday to translate ON/OFF to on.off, so added them back in, and now OH updates to reflect ST.

Switch NigelOffice (lights) {mqtt="<[mosquitto:smartthings/NigelOffice/switch:state:MAP(onoff_to_UPPER.map)],>[mosquitto:smartthings/NigelOffice/switch:command:*:MAP(ONOFF_to_lower.map)]"} 
Switch masterbed (lights) {mqtt="<[mosquitto:smartthings/Bedroom switch/switch:state:MAP(onoff_to_UPPER.map)],>[mosquitto:smartthings/Bedroom switch/switch:command:*:MAP(ONOFF_to_lower.map)]"}

Unfortunately, the message flow is only way right now. But I think I remember seeing something about that, so I’m off to do (more) research.