Initial MQTT Setup with OH2.5.8

I apologise for this question here but I somehow do not find any sort of useful documentation on this topic.
So I try setting up MQTT on a PI with OH2.5.8.

  1. I have installed the “MQTT Binding” by David. No configuration seems possible in Paper UI
  2. I have NOT installed the Addons ->Misc “MQTT Broker Moquette” as it seems deprecated
  3. I have created a MQTT Broker Thing (Add Manually), set the IP to “localhost”. As OH2 and MQTT Broker shall run locally (seems logical…)
    –> I do get an error “Status: OFFLINE - COMMUNICATION_ERROR$AnnotatedConnectException: Connection refused: localhost/”

I suppose I also need a channel - but with what settings. Arg. I really need a good documentation but I can find any…

So:What is wrong or where can I find a good documentation? All documentation somehow deal with older versions or plugins (Mosquito, EMbedded MQTT…) that seem no longer to be available in my OH2 version.

You need to actually install an MQTT broker. This is completely separate to openHAB. I would recommend to install Mosquitto - it’s as simple as following this guide:

And welcome!

By way of explanation: to get MQTT working for your home automation, using openHAB, you will need:

  1. An MQTT broker. This is the central piece of an MQTT system - everything else communicates through the broker. The broker is completely separate to openHAB (ignoring Moquette, which is deprecated).
  2. Within openHAB:
    • The MQTT binding installed
    • A Bridge thing defined (which I think you’ve done with your MQTT Broker Thing - presumably you’re using PaperUI for setup?), which tells openHAB where your MQTT broker is (IP address and port), and if it needs a username or password and some other feature.

OpenHAB can now communicate with and through the MQTT broker. Once that is setup, it’s time to add your devices.

  1. Outside of openHAB setup your device so that it connects to the MQTT broker
  2. Configure openHAB to subscribe to the device’s topics through a Thing:
    • Create a Thing for the device
    • Within the Thing, create Channels for each topic (or more) that you want to subscribe to
  3. Once you have Channels setup, you can attach these to openHAB Items.
  4. Once you have openHAB Items you can expose them in Sitemaps, which makes them easily controllable!

If you don’t mind fiddling with text files for configuration (instead of PaperUI), have a look at this which I recently wrote - it’s based around a Sonoff Basic flashed with Tasmota, but the general principals are very similar between devices:

  1. Install broker
  2. Setup Bridge between openHAB and broker
  3. Connect device to broker
  4. Setup openHAB Thing for device
  5. Subscribe to device topics through Thing Channels
  6. Attach Thing Channels to Items
  7. Expose Items in Sitemap

(Note that you only need to do steps 1 & 2 once, whilst 3 onwards needs to be done for each new device).

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.