# Need Help in configuring Openhab to Tasmota Firmware Sonoff switch

**URL:** <https://community.openhab.org/t/need-help-in-configuring-openhab-to-tasmota-firmware-sonoff-switch/36470>\
**Category:** Beginners\
**Tags:** openhab2, mqtt, tasmota\
**Created:** [November 22, 2017, 1:54pm UTC](https://community.openhab.org/t/need-help-in-configuring-openhab-to-tasmota-firmware-sonoff-switch/36470 "2017-11-22T13:54:36Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![BrutalBirdie](https://community.openhab.org/user_avatar/community.openhab.org/brutalbirdie/32/47907_2.png) [@BrutalBirdie](https://community.openhab.org/u/BrutalBirdie)\
**Post date:** [November 22, 2017, 3:40pm UTC](https://community.openhab.org/t/need-help-in-configuring-openhab-to-tasmota-firmware-sonoff-switch/36470/3 "2017-11-22T15:40:44Z")

</div>

Okay lets start.  
We need input.

Give us your /etc/openhab2/services/mqtt.cfg  
Give us your /etc/openhab2/items/mqtt.items  
Give us a Screenshot of your Sonoff Device\>Configuration\>MQTT  
Do you use openHABian?  
openHAB 2.X ? Which one?  
Did you read the [MQTT Docs ?](http://docs.openhab.org/addons/bindings/mqtt1/readme.html)  
Did you read this Topic ? [ITEAD Sonoff switches and sockets - cheap ESP8266 Wifi+MQTT hardware](https://community.openhab.org/t/itead-sonoff-switches-and-sockets-cheap-esp8266-wifi-mqtt-hardware/15024)  
Did you check out the [Tasmota Wiki?](https://github.com/arendst/Sonoff-Tasmota/wiki)

mqtt.items example

```csv
Switch a_Licht_Outdoor_Sonoff4Channel_2_Biertisch "Lichterketten Biertisch" (g_Outdoor, g_MYSQL) { mqtt=">[mosquitto:cmnd/sonoff-80786B/POW
ER2:command:*:default], <[mosquitto:stat/sonoff-80786B/POWER2:state:default]" }

```

mqtt.cfg example

```csv
#
# Define your MQTT broker connections here for use in the MQTT Binding or MQTT
# Persistence bundles. Replace <broker> with an ID you choose.
#

# URL to the MQTT broker, e.g. tcp://localhost:1883 or ssl://localhost:8883
#<broker>.url=tcp://<host>:1883

# Optional. Client id (max 23 chars) to use when connecting to the broker.
# If not provided a default one is generated.
#<broker>.clientId=<clientId>

# Optional. User id to authenticate with the broker.
#<broker>.user=<user>

# Optional. Password to authenticate with the broker.
#<broker>.pwd=<password>

# Optional. Set the quality of service level for sending messages to this broker.
# Possible values are 0 (Deliver at most once),1 (Deliver at least once) or 2
# (Deliver exactly once). Defaults to 0.
#<broker>.qos=<qos>

# Optional. True or false. Defines if the broker should retain the messages sent to
# it. Defaults to false.
#<broker>.retain=<retain>

# Optional. True or false. Defines if messages are published asynchronously or
# synchronously. Defaults to true.
#<broker>.async=<async>

# Optional. Defines the last will and testament that is sent when this client goes offline
# Format: topic:message:qos:retained <br/>
#<broker>.lwt=<last will definition>
mosquitto.clientId=SmartOffice
#mosquitto.url=tcp://192.168.107.2:1883
#mosquitto.url=tcp://107.0.0.1:1883
mosquitto.url=tcp://192.168.107.2:1883
mosquitto.user=openhabian
mosquitto.pwd=NoWayYouGetMyPass
mosquitto.qos=1
mosquitto.retain=true
mosquitto.async=true

# The Sonoff Tasomate Broker
#maddox.url=tcp://sonoff.maddox.co.uk:1883

```

Example Screenshot of my 4Ch Sonoff

[https://puu.sh/yrn1X/c2d47700ac.png](https://puu.sh/yrn1X/c2d47700ac.png)

I could bet your broker is not named broker, for me I named it mosquitto. Followed the wiki.

> [@samiraa78](#):
>
> Switch Masterlight “Masterlight” [“Switchable”]
> 
> {mqtt="\>[broker:cmnd/Masterlight/POWER:command:ON],\>
> 
> [broker:cmnd/Masterlight/POWER:command:OFF]"}

---

_[View the full topic](https://community.openhab.org/t/need-help-in-configuring-openhab-to-tasmota-firmware-sonoff-switch/36470)._
