MQTT Binding: I don´t understand


I´m using the MQTT ver 1 in my setup which works fine with with my mosquitto broker. I would like to upgrade to the MQTT v2 Binding, but I don´t get it to work and really don´t understand why it has become so complicated. I expected a flawless move to v2, but I was wrong (as so often in OH).

Can anyone explain step by step what I have to do? The documentation doesn´t help. There is explained how to install the binding, and that worked, it is online, but my devices do not get the messages.
So the in the documentation I read there is a “MQTT Things and Channels Binding”, but I can´t find any download link or a binding in the marketplace. This all is very confusing and frustrating…

Thanks in advance!

1 Like

That comes with the MQTT V2 binding, so you already have it. I’m currently on the phone so can’t help much, but did write a sort of generic tutorial.

@rlkoshak also wrote this which might help.

And @Max_G very recently asked the same questions.

Use the above links to help, but in general:

  1. Create a Bridge Thing to connect openHAB to Mosquitto
  2. Create Things for each device.
  3. Within each Thing create Channels for each property of the device (temperature reading, relay etc)
  4. Link your items to your Thing Channels using the channel= syntax, instead of the mqtt= syntax.
1 Like

You are late to the party:

Another Example

Ok, thank you guys, following hafniumzinc guide I was able to set up my first MQTT device.
I must mention that my inital step was to try setting up broker and things through PaperUI -> No success!
After I switched to textual configuration it worked.
I hope UI setup will work in ver3 of OH…

I would also like to mention that setting up MQTT devices is more complex than with the old version (especially setting up a thing for every device). As far as I understand this is required to follow the logic behind OH things/channels logic.

Anyway, thanks again and have a nice day!

It has worked for hundreds of other people for years. We can’t tell what trouble you had.

I think the problem is just well known: OH does not have the most user friendly frontend. I am using OH for years now, but just switching from one binding version to another is quickly very confusing. So if you not look into the community frequently you miss important changes what leads into trouble when you want to update your system later. As I mentioned, the documentation didn´t help me, too.

Also, I decided to switch back to MQTT ver just because I don´t have to configure things, just use my items and I am good to go. When I upgrade to OH 3 I will move on to MQTT v2.

Fortunately the community is very helpful!

It’s also much more capable. But setting up one Thing per device is the recommended approach. It is not the required approach. You can set it up how ever you want. But the whole point of a Thing is that conceptually a Thing should represent a single device. And when you do this other features that are new in the MQTT 2.x binding can be used, such as subscribing to a LWT topic as part of the Thing configuration and have the Thing be marked as OFFLINE when the MQTT broker publishes that it’s gone offline.