[SOLVED] Stucturing the mqtt= string

My last option: ask for help. . . Can someone point me in the right direction?

I’ve spent days trying to get openhab communicating with mosquitto and have been shooting in the dark so far, using some of the examples I see on the forum and elsewhere without understanding how they should be assembled. I’ve looked through hundreds of Google search results as well as forum posts here from a search for mqtt, and the documentations’ only reference is in for Items:
Switch Kitchen_Light “Kitchen Light” { mqtt="<[…], >[…]" }.
I must conclude that either I’m blind (i.e. I have, in fact, found the direction and I just don’t recognize it), or dense (maybe I’ve found it but it just hasn’t “clicked”).

Specifically, I have openHABian 2.4 on an RPi, with mosquitto installed and the with the new MQTT binding. I have a Sonoff Basic flashed with Tasmota configured with Host set to Pi’s IP, Client set to sonoff, User and Password set to reflect my credentials, Topic set to sonoff and Full Topic set to %topic%/%prefix%. I have the Sonoff set up on openHAB as a Generic MQTT Thing with its channel as an on/off switch and state topic house/sonoff/stat/POWER and command topic house/sonoff/cmnd/POWER.

I can toggle the Sonoff from its web page, though I suspect that it’s doing so over the network. I can also toggle it with commands in MQTT.fx and other apps I’ve tried. So, I believe it’s an error in the mqtt= string in my sonoff.items file.

So, again, could someone please point me to a comprehensive explanation. I’ve worn out Google.


There are two openHAB bindings. The old 1.x binding uses mqtt= in Item settings. The new 2.x one uses things and channels.
Totally different ways to set up, don’t mix examples, choose one and start over I’m afraid.

Wow, fast reply!
Great, didn’t understand that. I’ll change it to using the channels – that’ll make life much simpler alst!

That was way too easy. 30 seconds later and it works!
Thanks again, rossko