Not able to publish to MQTT

Hey guys,

I have installed the mqtt binding through paper UI and have been trying to publish some data to an MQTT broker with no luck. For starters, I have this in my mqtt.cfg file:

# URL to the MQTT broker, e.g. tcp://localhost:1883 or ssl://localhost:8883
#mybroker.url=tcp://37.187.106.16:1883

My item is defined as such:

Switch Stove { mqtt=">[mybroker:awarehome:command:ON:3],>[mybroker:awarehome:command:OFF:2]" }

Relevant snippet from openhab.log:

2017-07-20 22:59:02.282 [DEBUG] [org.openhab.binding.mqtt            ] - BundleEvent STARTING - org.openhab.binding.mqtt
2017-07-20 22:59:02.310 [DEBUG] [.binding.mqtt.internal.MqttActivator] - MQTT binding has been started.
2017-07-20 22:59:02.314 [DEBUG] [org.openhab.binding.mqtt            ] - ServiceEvent REGISTERED - {org.openhab.model.item.binding.BindingConfigReader, org.openhab.binding.mqtt.MqttBindingProvider}={component.name=org.openhab.binding.mqtt.genericbindingprovider, component.id=209, service.id=328, service.bundleid=214, service.scope=bundle} - org.openhab.binding.mqtt
2017-07-20 22:59:02.495 [DEBUG] [binding.mqtt.internal.MqttItemConfig] - Loaded MQTT config for item 'Stove' : 0 subscribers, 2 publishers
2017-07-20 22:59:02.505 [DEBUG] [ng.mqtt.internal.MqttEventBusBinding] - MQTT: Activating event bus binding.
2017-07-20 22:59:02.506 [DEBUG] [org.openhab.binding.mqtt            ] - ServiceEvent REGISTERED - {org.osgi.service.event.EventHandler, org.osgi.service.cm.ManagedService}={event.topics=openhab/*, service.pid=org.openhab.mqtt-eventbus, component.name=org.openhab.binding.mqtt.eventbus, component.id=210, service.id=330, service.bundleid=214, service.scope=bundle} - org.openhab.binding.mqtt
2017-07-20 22:59:02.509 [DEBUG] [org.openhab.binding.mqtt            ] - ServiceEvent REGISTERED - {org.osgi.service.event.EventHandler}={event.topics=openhab/*, component.name=org.openhab.binding.mqtt.MqttItemBinding, component.id=211, service.id=331, service.bundleid=214, service.scope=bundle} - org.openhab.binding.mqtt
2017-07-20 22:59:02.513 [DEBUG] [org.openhab.binding.mqtt            ] - BundleEvent STARTED - org.openhab.binding.mqtt

I have deleted mqtt-eventbus.cfg from conf/services because I saw somewhere that it wasn’t necessary.

Any ideas on what could be wrong?

Thanks in advance.

Try to remove the “#” in your mqtt.cfg file.

# URL to the MQTT broker, e.g. tcp://localhost:1883 or ssl://localhost:8883
mybroker.url=tcp://37.187.106.16:1883
2 Likes

Wow, removed the ‘#’ and now it works like a charm. Thank you so much! :grinning: