Initial MQTT Setup with OH2.5.8

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: https://randomnerdtutorials.com/how-to-install-mosquitto-broker-on-raspberry-pi/

And welcome!

EDIT:
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).