OH2 not working with MQTT for me

I’m trying to connect my OH2 to my Mosquitto-Broker running onn my Synology NAS.
The broker is running well and accepts MQTT send by MQTTLens and also succesfully sends MQTT to MQTTLens.
An App on my mobile works fine as well.

I’m trying to get this work a two days now. I think there is no thread on the internet I didn’t read.

My mqtt.cfg:

My Items:
Number TemperaturTest “Temperatur [%.2f °C]” {mqtt:"<[mosquitto:/TemperaturTest:state:default]"}

The openhab.log:
2016-12-17 16:01:10.839 [INFO ] [penhab.io.transport.mqtt.MqttService] - MQTT Service initialization completed.
2016-12-17 16:01:10.839 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection ‘mosquitto’

The item is watched in habPanel and is always NULL.

My aspiration is to link two instances of openhab with MQTT. One should be the master holding all rules etc. and the other one is for my heating and should send the data to the master where something will be done with it.

Please helb me.

syntax for one of my MQTT items

Number lux_1251 “light level 12/53[%.1f lux]” (HouseData, light_chart,Kitchen,Node12,log) {mqtt="<[OH2MQTT:home/rfm_gw/nb/node12/dev53:state:default]"}

if you subscribe to the topic on the OH machine do you see the data?

i.e. mosquitto_sub -v -t +/#

Also I run two instances of OH2 - both have same rules etc and access same data points, but only OH2 with correct IP address runs rules

Hi Wayne,

Mosquitto_sub, Mosquitto_pub, my mobile-App and MQTTlens work fine togehter. Only openhab2 doesn’t work.
I had a mistake in my written items-declaration. I also use “=” for mqtt-binding:
Number TemperaturTest “Temperatur [%.2f °C]” {mqtt="<[mosquitto:/TemperaturTest:state:default]"}

I tested many configs for in- and outbound MQTT, but nothing worked.

So my mqtt.cfg looks like


and my mosquitto.conf looks like

pid_file /var/run/mosquitto.pid
persistence true
persistence_location /var/lib/mosquitto/
log_dest file /var/log/mosquitto/mosquitto.log
include_dir /etc/mosquitto/conf.d
max_connections 5
persistence true
log_dest stderr
log_type error
log_type warning
log_type notice
log_type information
connection_messages true
log_timestamp true
allow_anonymous false (try setting this to true?)
password_file /etc/mosquitto/passwd

In terms of OH2, I have the MQTT binding loaded (binding-mqtt1 - 1.9.0.SNAPSHOT)

I have been using MQTT (mosquitto) for about two years with OH1 and OH2.

I think I may have changed the name of the broker from mosquitto to OH2MQTT to make it work - so perhaps try another name other than msoquitto in the mqtt.cfg and the items.


Is the leading slash of the topic needed in your configuration?
Do you have the same topic (with leading slash) for MQTTLens?
Normally it is recommended to not use a leading slash as it defines an empty top level.

Your client id “openhab2_pc” is only used by openhab? If you use the client id more than once the connections get lost…