MQTT migrating to OH2

I’m having some trouble with MQTT while trying to migrate to OH2.

I have OH2 “functional” on a new server. I installed the mqtt binding and action. I set the mqtt.cfg to point to my current OH 1 server’s mqtt broker as I will have to flash sketches to arduinos when I move the broker to my new VM. I copied the items files over and started OH2. I don’t get any errors, it just doesn’t seem to work.

On the new OH2 VM, I can use mosquitto_sub -h to connect to the broker and see the topic and messages but OH2 runtime doesn’t see them.

The items and broker configs work on OH1, just not on OH2.


Switch SW_C_Theater_CaFan {mqtt=">[broker:/home/theater/AVR/CaFan:command:on:1],>[broker:/home/theater/AVR/CaFan:command:off:0],<[broker:/home/theater/AVR/CaFan/state:state:default"}



Try again without the action …

OK, I removed the action and rebooted. Now I’m seeing:

2017-02-15 16:56:11.473 [INFO ] [] - MQTT Service initialization completed.
2017-02-15 16:56:11.486 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection ‘broker’

I didn’t get this before.

Items still don’t seem to do anything though. Is there a different syntax for items in OH2’s mqtt? I looked in the documentation and it looked the same to me.

WAIT! Check that. The item I tested I forgot I had taken the leading “/” out seeing if that was it. I tested a different item and it works.


1 Like