Sonoff Tasmota with MQTT?

Hello … I’m a beginner so my request is mayby solved … the question is: it is possible to use sonoff tasmota without any mqtt broker? The easiest way should have a thing from a binding maybe from Belkin or WeMo with all the features the sonoff devices have. I hope that this add-on is realized in OpenHab 2.5 … anybody with news for me??

Tasmota supports hue emulation I believe. If so you can connect with hue binding.

the hue binding does not really works … Openhab 2.4 is discover the Sonoff/tasmota devices as WeMo thing but the handling doesn’t work too. For example I can’t switch the power on the devices. In portscan tools the devices were specified as Belkin devices so I thought a Belkin Binding in OpenHab 2.5 can help …

A question out of curiosity:
What is the problem with a MQTT broker?
I’m running Mosquitto on my Raspi besides openHAB. Started it once, never had to worry about it since then (besides the updates, which run without any trouble).

Basically there is no problem with MQTT but have updated the raspberry with new files how it is recommended … after the update/upgrade the MQTT broker feels ill :wink: and I not able to go back in wotking place …

Fix it or start over again

What broker are you using? If the embedded one then try mosquitto as the other is no longer supported.

Hey, I used the embedded one … do you have an example for activating mosquitto broker on raspberry and handling in Opnehab 2.5?

How did you install OH? If you flashed the openhabian image then use sudo openhabian-config at command line. then scroll thru all the options and you will find “install mosquitto broker” I would tell you exactly where but it’s worth finding for yourself. It’s not that much to look thru but many options that will help in future.

If you did not install the openhabian image you can add it using:

# install git
sudo apt-get update
sudo apt-get install git

# download and link
sudo git clone /opt/openhabian
sudo ln -s /opt/openhabian/ /usr/local/bin/openhabian-config

# execute
sudo openhabian-config
1 Like

I think the explaning is very confused … I thought mosquitto should be enabled but in the explanation I found:

Do you really want to install a separate MQTT broker? │
│ Note that openHAB version 2.5M1 or higher comes with a new OHv2 MQTT │
│ binding that if you choose to enable it by default will use thus occupy │
│ the same ports as mosquitto here would try to use.

So I need no mosquitto I can use MQTT Binding - but how ??

1 Like

Yes, this is confusing.
Please disregard this information and install mosquitto. The mqtt binding by itself is NO mqtt broker, what was meant is the (openHAB) “embedded mqtt broker” ( which we do not suggest!).

1 Like

But the text actually DO suggest it :slight_smile:

I´d notice this a few days back… I simply forgot to mention it. The text should be removed or rewritten totally… I´m not sure whos in charge of this one though. Maybe Markus knows… @mstormi

I aready filed such a question/request on Github


Could I get your opinion (in here on on Github) on either removing that note completly (my suggestion) or what other text to put there. IMHO the actual text sounds as if the MQTT binding would (automatically) install the embedded broker. As far as I can tell both setups (embedded or mosquitto) would use the same ports, so I would not expect any “port clashing”.

I agree with you. The note should be removed.
In my opinion, those who install a MQTT broker, should already be aware of port settings as well. If not, they simply have to learn the hard way :slight_smile:

1 Like

Yes it’s a very hard way … but now I’ve learned a little bit more … using mqtt-binding 2.4.x and enable the MQTT Embedded Broker in Services. Afterwards you create Generic MQTT thing whre you called to add the MQTT Embedded broker - works. But now the next challange is waiting … If the generic mqtt thing is generated you must create a channel for this thing. For example I create a Sonoff-Lamp thing and the channel should be a Switch: -> Add Channel -> On/Off Switch -> Channel-ID: Switch -> Label:Switch - and now the challange: MQTT state topic?? MQTT command topic??

My Sonoff/Tasmota entities are: |MQTT client|Sonoff|
| — | — |
|MQTT topic|Sonoff-17228|
|MQTT group topic|sonoffs|
|MQTT full topic|Sonoff-17228/cmnd/|

what should I place in the channel commands?

So I come back to my first idea …it would be fantastic to have a binding for Sonoff/Tasmota things !!!

Maybe an idea, however I seriously doubt that anybody would step forward creating such while a perfectly working solution is on hand,

You selected to change the default setup of the tasmota device, based on what documentation/example?
Since I’m using the default setup I can only guess which ard the correct settings:

stateTopic="Sonoff-17228/stat/POWER" , commandTopic="Sonoff-17228/cmnd/POWER"

Adding to what @opus mentioned I thought I would share a few of my config file as an example.

Note most recommend to create the Thing in PaperUI but this example will have all files.


Bridge mqtt:broker:pibroker "pibroker" [ host="", port=1883, secure=false, username="xxxxxxx", password="xxxxxxx" ]
    // Sonoffs
    Thing topic sonoff11 "Living Room Light" @ "Living Room" {
        Type switch : power       "Power"         [ stateTopic="stat/sonoff11/POWER", commandTopic="cmnd/sonoff11/POWER" ]
        Type number : temperature "Temperature"   [ stateTopic="tele/sonoff11/SENSOR", transformationPattern="JSONPATH:$.SI7021.Temperature" ]
        Type number : humidity    "Humidity"      [ stateTopic="tele/sonoff11/SENSOR", transformationPattern="JSONPATH:$.SI7021.Humidity" ]

    Thing topic sonoff2 "Couch Light" @ "Couch Light" {
        Type switch : power        "Power"         [ stateTopic="stat/sonoff2/POWER", commandTopic="cmnd/sonoff2/POWER" ]

    Thing topic sonoff55 "Office Light" @ "Office" {
        Type switch : power        "Power"         [ stateTopic="stat/sonoff55/POWER", commandTopic="cmnd/sonoff55/POWER" ]


Switch LivingRoom_Light "Living Room Light" <light>  ["Lighting"] { channel="mqtt:topic:pibroker:sonoff11:power" }
Number LivingRoom_Light_Temp "Temperature [%.1f °F]"      <temp>             { channel="mqtt:topic:pibroker:sonoff11:temperature" }
Number LivingRoom_Light_Humidity    "Humidity [%.1f %%]"    <humidity>       { channel="mqtt:topic:pibroker:sonoff11:humidity" }

Switch CouchLight "Couch Light" <light>  ["Lighting"]  { channel="mqtt:topic:pibroker:sonoff2:power" }

Switch OfficeLight "Office Light" <light>  ["Lighting"]  { channel="mqtt:topic:pibroker:sonoff55:power", expire="180m,command=OFF" }

Hope this example helps and if you run into a problem we’re here to help. :wink:


thanks for the examples :slight_smile: helps me a lot to implement my esp8266 with the bmp280 sensor and tasmota