OpenHAB2 doesn't show MQTT devices

I’m trying to set up 3 sonoff devices with an openHAB on a raspberry pi.

I have an airport xtreme with a wifi network.
cable-connected an rPi2 to it with a netwerk cable.
wifi-connected 3 sonoff dual R2 devices, there’s tasmota 6.4.1.11 running on them.
and my macbook is connected to that wifi.

I’ve installed the openhabian rpi version on the rpi.
Because I ran into the same problem yesterday, I thought, I will start fresh, I must’ve done something wrong.
Let it install itself successfully overnight and got back at it this morning.

I did
sudo apt-get update
sudo apt-get upgrade
to start with.

then I opened the openHABian Configuration Tool sudo openhabian-config and installed Mosquitto.
I also selected & executed the update & upgrade functions from the configuration tool.

My sonoff devices are already configured with the ip, username/password for an MQTT so when I opened op the loggin of mosquitto, then had already connected to it and announced their functions.

Then I followed the guide, used the standard UI and continued (https://www.openhab.org/docs/tutorial/uis.html) to use the paperui to setup a thing.
In addons>bindings, I searched for “MQTT” and installed “MQTT Binding 2.4.0”.

I went to the inbox and clicked the + sign, it searched for a couple of seconds and then said “Thing not found. Manually add a thing?”
So I clicked “Manually add thing”.
I saw “MQTT broker” and added this.

I was able to add the broker hostname (localhost)
and under the “show more” section I was able to fill in the username & password.
I saved this and I had under configuration I now had an MQTT Broker which showed “online”.

When I checked the mosquitto logging I saw:

1548760473: New connection from 127.0.0.1 on port 1883.
1548760473: New client connected from 127.0.0.1 as paho49039595405949 (c1, k60, u’openhabian’).

So, from this logging, I expect my MQTT plugin to be linked to Mosquitto and thus my Openhab to be setup for adding new devices.

But, when I scan for new things, it show nothing.

So, I googled arround, I found a lot of people with the same problem but the resolutions were “openhab 1.x requires manual adding of cfg files for MQTT bindings”. But I’m on openhab2, and when I read the manual, it says that this is now done automatically. But I did read through everything I can find and I understood that normally a mqtt.cfg file should be created. But when I check the /etc/openhab2/services/ folder, there is no mqtt.cfg file.

And this is as far as I got. Yesterday I reached the same point. After a lot of searching, trying, (as I already said above) I reinstalled the raspberry pi with a fresh OpenHabian. Again, reaching this point.

  • Platform information: Raspberry Pi
    • Hardware: Raspberry Pi 2 Model B Rev 1.1
    • OS: openhabianpi-raspbian-201804031720-gitdba76f6-crc9e93c3eb.img(1)
    • Java Runtime Environment: openjdk version “1.8.0_152”
    • openHAB version: openHAB 2.4.0-1 (Release Build)
  • Issue of the topic: OpenHAB2 doesn’t show MQTT devices

Only devices that follow the Homie 3.0 standard or the Home Assistant standard of MQTT topic structure can be automatically discovered. You will need to manually create a Generic MQTT Thing. I recommend a separate Thing for each Sonoff. Then create a Channel on that Generic MQTT Thing for each of the topics you need to subscribe/publish to.

Then you will create Items and link those Channels to the Items.

This is not actually common any more for OH 2 bindings. Typically they assume that they are configured through PaperUI. The MQTT 2.4 version of mqtt.cfg is the MQTT Broker Thing you already created.

Unfortunately the MQTT 2.x version binding has only been released for about a month. There are years worth of tutorials and articles out there on the old MQTT 1.x version binding which will not apply. Any time you see { mqtt= in an Item definition you are looking at an old MQTT 1.x tutorial.

But there have been many tutorials and help threads posted in the past month showing how to migrate from MQTT 1.x to MQTT 2.x that may help you understand what you need to do when you encounter one of these old MQTT 1.x tutorials.

https://community.openhab.org/search?q=MQTT%202.4

Hi, thanks for the reply, this helped a lot!
But I did understand that the setup is far more complex to setup than I expected.
(Comparing to other projects I’ve done)
Thanks for the help.