OH2 MQTT binding not sending messages

Hi,
I’m trying to configure OH2 to send all messages on the event bus to a local Mosquitto MQTT broker. However, there’s no MQTT messages arriving at the broker. I’m using MQTT-Spy to check what’s arriving at the broker.
My Configuration files are

/etc/openhab2/services/mqtt.cfg

mosquitto.url=tcp://localhost:1883
mosquitto.clientId=openhab
mosquitto.retain=true
mosquitto.async=false

/etc/openhab2/services/mqtt-eventbus.cfg

broker=mosquitto
commandPublishTopic=/openHAB/out/${item}/command
stateSubscribeTopic=/openHAB/in/${item}/state

The MQTT configuration seems to have been loaded correctly according to the log file, below the output of cat /var/log/openhab2/openhab.log | grep MQTT

2017-06-08 18:48:55.265 [DEBUG] [.binding.mqtt.internal.MqttActivator] - MQTT binding has been stopped.
2017-06-08 18:49:41.396 [DEBUG] [.binding.mqtt.internal.MqttActivator] - MQTT binding has been started.
2017-06-08 18:49:41.728 [DEBUG] [ng.mqtt.internal.MqttEventBusBinding] - MQTT: Activating event bus binding.
2017-06-08 18:49:41.731 [DEBUG] [ng.mqtt.internal.MqttEventBusBinding] - Initializing MQTT Event Bus Binding
2017-06-08 18:49:41.820 [DEBUG] [ng.mqtt.internal.MqttEventBusBinding] - MQTT Event Bus Binding initialization completed.
2017-06-08 18:49:41.825 [INFO ] [penhab.io.transport.mqtt.MqttService] - MQTT Service initialization completed.
2017-06-08 18:49:41.827 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection 'mosquitto'

Here is the log tail (grepped on ‘MQTT’) from Karaf

openhab> log:tail | grep MQTT
18:49:41.396 [DEBUG] [.binding.mqtt.internal.MqttActivator] - MQTT binding has been started.
18:49:41.728 [DEBUG] [ng.mqtt.internal.MqttEventBusBinding] - MQTT: Activating event bus binding.
18:49:41.731 [DEBUG] [ng.mqtt.internal.MqttEventBusBinding] - Initializing MQTT Event Bus Binding
18:49:41.820 [DEBUG] [ng.mqtt.internal.MqttEventBusBinding] - MQTT Event Bus Binding initialization completed.
18:49:41.825 [INFO ] [penhab.io.transport.mqtt.MqttService] - MQTT Service initialization completed.
18:49:41.827 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection 'mosquitto'

Any ideas how to solve this ?

Solved this one myself, below line was missing in the config file

statePublishTopic=/openHAB/OUT/${item}/state
2 Likes