MQTT Not authorized to connect

I have installed Openhab2 on my QNAP NAS. It took a while, but I finally figured out how to install the QIoT suite and also Node-Red and MQTT. I went into QIoT and created a json file, from which I was able to find my connection information. I have been able to connect to the MQTT server using MQTT-SPY. Using the same configuration parameters however, I’m unable to connect with Openhab.

This is my mqtt.cfg file:


What could I be doing wrong?

I feel so stupid… I’ve been struggling with this for several hours. I finally decided to try removing the quotes around the username and password and I connected successfully. Hopefully this will help others!

1 Like

Thank you for your Infos @schettlers. I am trying to get my new ESP32 with 433Mhz Module working. Would you be so kind and send me your Tutorials how to get MQTT working? Are all functions working at OpenHab?
Which MQTT Broker did you install? Mosquitto?

I found these Tutorials: --> Mosquitto? --> NodeRed

I am totally new to this QIoT. Thanks --> Mosquitto

Sorry the upper link is from another MQTT Broker.

It’s been an uphill battle that I’ve been struggling with for only the last several days myself. From my understanding, MQTT is built into QIoT. No extra software is required. Inside QIoT, you need to setup a “Thing”. The “Thing” name is your master topic, and your resource is the final node of the topic you want to publish to. Once you create your thing, click on the “Connect a device” tab, then on MQTT, then on Next. Inside the Json code in the window, you will find the IP, Port, Username, Password, and ClientID. The ClientID will change every time you view the connection information. I’m not certain, but the beginning part of the ID may be required, whereas the number after the underscore may be able to be altered.

Everything in here is very poorly documented in my opinion, but once everything’s working, I think it will be the most ideal solution, since the NAS is running 24/7. In terms of tutorials, I’ve not really found anything super helpful. I have just been doing random internet searches to find the information I need. Needless to say, it’s been extremely difficult to find anything helpful.

Good luck with your project! Hopefully you can get yours working faster than it’s taken me!

@schettlers Thank you for your answere.

I would have understood it like: Download QIoT, install openHab, install RedNode, flash your “Arduino”,Pi or som other IoT Device with QMTT support. Search for it at QIoT and implement it in your System. Now OpenHab should work with the via QIoT connected device.

Did i understand it right?

Thanks schettlers. We are pioneers on this area. Commercial solutions will show up in a few years. But i love to build those things by my own. :slight_smile:

Regards from Austria

I finally got my project working last night. It was definitely more complicated than I feel it should have been, but it works.

I think your steps should get you going in the right direction. I’m not completely certain that NodeRed is necessary, but it won’t hurt. What I figured out last night (and what was key to getting my system working) is that the MQTT topic that your “Thing” is assigned in QIoT can be expanded upon. For example,. if you’re assigned “qiot/things/admin/BedroomLamps” or something, you can also Publish to qiot/things/admin/BedroomLamps/cmnd/POWER or something along those lines. And you can have multiple devices connect with the same given username/password as long as the ClientId is different.

Good luck!

Could you please share your steps or tutorial?

I am struggling with sending MQTT message from OpenHAB to QIoT on QNap NAS. Thank you

My OpenHab2 installation has mysteriously quit working. I’m trying to get it reinstalled and once done, I’ll try to provide some additional direction for you.

When using MQTT it is always helpful to have a stand-alone client to check if messages are actually being received at the broker, and updated at the client.

I use MQTT.fx but other clients are available. MQTT lens (chrome extension) was the favourite until the GUI went all supersized.

Mosquitto and other brokers are actually not part of the openhab system, they are stand alone, so just find a good tutorial on installation, and worry about OH integration afterwards.

Once it all works as expected through a client, then install the binding, fill in the mtqq.cfg with your login information, and it should all work as expected.

1 Like

I agree with phych Mike. I just downloaded MQTTBox from the Microsoft store to validate my MQTT server setup. If you can successfully send/receive messages then you can start to trace your problem more directly.

For my Openhab, I migrated from Openhab 1.x to Openhab 2. I just copied all my files over and that was nearly all that was necessary. Here are the steps I can think of for you to try:

  • Verify in PaperUI that the MQTT Binding has been set
  • Verify that you have a MQTT.cfg file properly configured in the conf/services directory
  • Verify your item configuration has the proper bindings to MQTT.
  • Double check your log files (userdata/logs) to ensure that a connection is being made to MQTT

With all that, you should be reasonably assured that your connection is working. In terms of where to find documentation for each of the above items, google is your friend. :slight_smile: I haven’t configured any of this in about 2 months. I really don’t have any record of the sites that I used to resolve my issues, but there are plenty out there.

Finally, there is a discord group for openhab to help get rapid support from other users. Please feel free to join as you may get faster responses from those much more knowledgeable than me!

-Oh and I did get my Openhab working again. I saved off all my site config information, deleted everything in my openhab share, removed and re-installed the QPKG, then copied all my settings back over. Everything came back to life. :slight_smile: