MQTT Binding (v1.11) Getting Started 101

Do you happen to know more about this, e.g. the status of development, conceptual changes (ref. the Exec binding controversy, :-)), etc.

1 Like

I believe @ThomDietrich was referring to this pull request.

The development of

  • the core MQTT integration,
  • the MQTT broker configuration binding,
  • an embedded MQTT broker that is ready with a button press,
  • and a generic MQTT topic to OpenHAB Thing binding

is finished.

But a lot of smaller and bigger issues with the core (Eclipse Smarthome) appeared. For example:

  • a central provider for SSL configurations,
  • nested configuration parameters.

So it still might take some time to get everything merged.

Cheers,
David

4 Likes

That’s what I thought. So despite the hopefully soon available new binding, I decided to write this thread as a quick help here and now. @David_Graeff Please feel free to take as much as you can from the OP for the new Bindings README. A short introduction, some links and setting up of a testing Item might be useful to new users, even with the new binding.

Oh :sweat_smile: corrected. I’ve added MQTTLens. Thanks!

@rlkoshak @Dim from now on you just have to link it when a new user with old problems arises. Remember do to add details when possible. It would be great if we could have more threads like this… :wink:

2 Likes

Thanks for the info! Cool stuff!!!

Agreed. I can point to the Solving Exec Binding Problems thread as another one. I’m going to convert that to a wiki right now. Honestly, I’m pretty weak with Exec too. I only know as much as I do from helping others with their problems. I don’t use it myself. Others please contribute to this one too.

@David_Graeff, the new binding is very ambitious. I look forward to using it!

Even if it were available today, we would be fielding MQTT 1.x version questions for at least another year. People migrate painfully slowly. :frowning:

1 Like

All, I’ve added a section regarding the config bug where one needs to manually delete the file mqtt.config to get rid of old configuration.

2 Likes

Thanks Thom for this very simple and working example.

But I feel I have only half of the solution:
I can update OH2 switch status from MQTT, but OH2 does not send back the status changes to MQTT when I click on the switch.

Yes that is correct. The Item is only there to test the connection between openHAB and the broker. For more options you should check out the MQTT Binding README.

Anyhow. As it doesn’t hurt I’ve added an outbound connection to the example. (Btw. In order to do that I had to consult the README. No magic involved…)

Is it worth adding an example showing how the MQTT Action fits in? Or is that a little bit overkill. It is well documented and a one liner.

First of all, the Tutorial shouldn’t be a replacement for the need to read documentation. :wink:

The focus should stay on “How to get started with the Binding” and the Binding is able to publish data just fine. Imo the Action is something rather special and I’m not sure if we would even need it in a “101 Tutorial”…

But yeah whatever :smiley: Feel free to add it’s README to the references list in the beginning and mention the action before or after the Troubleshooting chapter.

Really great Thom,

This mini tutorial got me running in few minutes, while I spent hours to try already.
I think most of the oddity was because I did not realize we should use all config files since other examples uses PaperUI to define the entire solution.

Great job,

i didn’t understand 5th step. i am not able to find any file name " test.items ". please can you help me to create one. i installed everything on windows not respberry pi.

Create a file named test.items in c:\whereeveryouunzippedopenhab\conf\items and put the code in step 5 into that file.

1 Like

Not sure how this can be improved. “test” is clearly a placeholder name and if a file doesn’t exist you can simply create it. What do you suggest we should improve?

@ThomDietrich

Thank you for this tutorial, works fine with the temperature und the luminance of my Fibaro Motion sensors connected to my PI with the Razberry module running with openHABian.

Still got some Problems to get the motion-detection to work:

22:20:08.061 [WARN ] [ab.core.events.EventPublisherDelegate] - given new state is NULL, couldn't post update for '61_FibaroSensorAnwesenheit'

My mqtt.items are the same as for temperature and luminance:

Number 61_FibaroSensorAnwesenheit "Anwesenheit [%s]" <Motion> { mqtt="<[pi:zway/60Flur/bewegung:state:default]"}

I run in the same issue with my AeonLabs Door/Window Sensors.

Is there something wrong with my item definition?

Regards
Heiko

@Heiko_Fanieng you need to check the messages on your broker, then configure your item accordingly. Can’t help further with the details provided…

Thanks for your reply @ThomDietrich :+1:

Meanwhile i found another thread in the community that pointed me to do some Mappings for the MQTT-Values.

Switch 61_FibaroSensorAnwesenheit "Anwesenheit [%s]" <Motion> { mqtt="<[pi:zway/60Flur/bewegung:state:MAP(uppercase.map)]"}  

uppercase.map:

on=ON
off=OFF

Maybe you want to extend this Tutorial with this inforamtions?

Regards
Heiko

Hmm well this is a feature of the MQTT Binding you can work with after the basic communication via MQTT works. The latter is the subject of this Tutorial. I’m not sure how far we want to drive it. I guess it wouldn’t be wrong to at least add a hint wrt the issue at the end of the article. @rlkoshak wdyt?

@Heiko_Fanieng the Tutorial is a wiki article, meaning that everyone is allowed to modify it. As I am currently preoccupied I’d like to ask you to add this part. Thanks!

I’m ambivalent. It wouldn’t hurt to mention that the messages might need to be transformed in the article and how to do so, but at some point we will just be duplicating what is already in the README, which I don’t think we want to do.

Like you say, its a wiki so @Heiko_Fanieng, please consider adding to the article.

Maybe we need an MQTT 201 article. :wink: