[SOLVED]Generic MQTT thing

hi everyone, i am quit new in OB2 and having my first project. using dht22 and nodeMCU i would like to display my results in basic UI. everything works fine, i can get my results through mqtt to generic MQTT thing. but how can i import these results to my basic UI. i can not figure it out. i have items ready but i can not fing the way to link my items with mqtt. can you please help me?

if you go to configuration/your generic mqtt thing you have a button to copy the channel link:

once you copied this you put it in the channel part of your item definition

Thats all you have to do, for the fitting item definition eg number or string have a look at

and at

for how to utilise them in a sitemap
Probably you want to link the channels of your mqtt things to number items and than use text items in your sitemap file to display them in basic ui.
regards Johannes

1 Like

thank you for you quick reply, but unfortunately i do not have copy the channel link :confused:

do you have simple mode turned on?

if yes than openhab automatically creates items for every channel in the jasondb. You can still use those items which you find under configuration/items in paperui in the definition of the sitemap file for basic ui. I would recommend turning simple mode off right now and to use item files instead as paperui doesnt support offset profiles which are really useful for temperature and humidity sensors.
best regards Johannes

thank you so much your your help, it works fine right now. I really appreciate it. have a nice day :slight_smile:

1 Like

hi, how are you? again me i have one more question, i thought you could help me. because i am stuck and can not find an answer. i have simple LED it works fine with mqtt. i linked that to a swtich on OH, but the problem is when the led is off switch turns it on but doesnt turn if off. and doesnt matter if the switch if off or on, when i slide it it turn LED on, but doesnt turn it off. Do you have an idea about this problem? have a nice day

best regards

They’re going to want to see your Item and channel definitions, and some detail about what the mystery LED expects to have sent to it.

1 Like

hi, Switch DEMOSW {channel=“mqtt:topic:ee12abb2:led”}, here is my items file. it turns it on when the light is off. and on mqtt it works find when i send commands it turns off or on but could not run it on OH. btw thank you for your answer but still couldnt make it work.

btw i forgot to mention i am using NodeMCU and there is a single LED connected to it. just simple thing, i am trying to get familiar with OH2 atm.

Do you use the arduino ide or lua for the node mcu? Can you post your thing configuration? What kind off message does your nodemcu expect and which topic. Maybe you need to use custom on off values? But it’s really hard to tell just from the item file. Do you see both messages when you monitor your broker externally?

i use aruino ide. and unfortunately i have a thing file but it’s empty nothing defined in it. my nodemcu is expecting 1 or 0 from mqtt, and it’s topic to publish. i am kind of lost :confused:

So you use paper ui? When you configured your generic mqtt thing did you input the custom on off values correctly?

Can you see openhab send those values to the right command topic when you use something like http://mqtt-explorer.com/ to monitor your broker?
Please post the c code you use on your arduino using code fences and Ill have a look at it.

thank you so much, i did not notice that i had to type custom on/off values, after entering them it works fine. thank you so much :slight_smile:

1 Like