Using Sonoff Power Switches with Tasmota firmware and openHAB2 MQTT2 binding

Tags: #<Tag:0x00007faee5d1b9b0> #<Tag:0x00007faee5d1b848> #<Tag:0x00007faee5d1b690>

There is a 3 pages long examples file in the repository. That was once part of the main mqtt documentation, but I took the right as the maintainer to split that part off as the documentation grew.

I have notified the website guys to please include additional example files (in a second tab, via a sidebar link or however), but since then nothing has changed :confused:

I have to say though: If the textual files are soo complicated and non intuitive (the bridge / thing split syntax is not an mqtt invention btw), they might need to change :wink:

Cheers, David

@opus where is the info on the @ flag or other modifiers? I’d like to read up - haven’t seen mention of it anywhere.

@David_Graeff you’ll hear no argument from me about the non-intuitiveness of OH textual configuration, it’s downright nasty! Unfortunately every platform has this problem - the nature of automation is gluing things together that were never meant to talk, so with that comes complexity… Even professional platforms have terrible script languages (Crestron) its a necessary evil to build an elegant solution.

Thank you for following up with the website team to get additional examples posted, There is a larger issue of disorganization in the OH2 documentation making it hard to track down syntax.

1 Like

The @ flag is documented Here, look for location.

2 Likes

Hi,

my sonoff S20 switches dont work. I add all, the broker mosquitto is running, the devices connected.
The state updates are not in the event log of openhab. In the openhab.log every time i have trouble logs of double entries with “state”. Its the first time i use sonoff in openhab (Fresh install test system for mqtt2)

I dont know why it now work.

here is my config:
mqtt.things

Bridge mqtt:broker:MosquittoMqttBroker “Mosquitto MQTT Broker” @ “MQTT” [
host=“IP Adress”,
secure=false,
port=1883,
qos=0,
retain=false,
clientid=“Oh2Mqtt2Thing”,
//certificate="",
//certificatepin=false,
//publickey="",
//publickeypin=false,
keep_alive_time=30000,
reconnect_time=60000,
//lastwill_message="",
//lastwill_qos=1,
//lastwill_topic="",
username="",
password=""
]
{
// Buero

// Sonoff Corin-I Strom
Thing mqtt:topic:CorinI “Sonoff Corin-I Strom” @ “Büro” {
Channels:
Type switch : switch “Power Switch” [
stateTopic=“buero/CorinI/POWER”,
commandTopic=“buero/CorinI/cmnd/POWER”,
//retained=false,
//postCommand="",
//transformationPattern=“JSONPATH:$.POWER”,
//formatBeforePublish="%s",
on=“ON”,
off=“OFF”
]
Type string : state01 “Switch State 01” [
stateTopic=“buero/CorinI/STATE”,
transformationPattern=“JSONPATH:$.POWER”,
on=“ON”,
off=“OFF”
]
Type string : state02 “Switch State 02” [
stateTopic=“stat/CorinI/POWER”,
on=“ON”,
off=“OFF”
]
Type string : state03 “Switch State 03” [
stateTopic=“stat/CorinI/RESULT”,
transformationPattern=“JSONPATH:$.POWER”,
on=“ON”,
off=“OFF”
]
Type number : vcc “VCC” [
stateTopic=“buero/CorinI/STATE”,
transformationPattern=“JSONPATH:$.Vcc”
]
Type string : wifi-ap “Wifi AP” [
stateTopic=“buero/CorinI/STATE”,
transformationPattern=“JSONPATH:$.Wifi.AP”
]
Type string : wifi-ssid “Wifi SSID” [
stateTopic=“buero/CorinI/STATE”,
transformationPattern=“JSONPATH:$.Wifi.SSId”
]
Type string : wifi-channel “Wifi Channel” [
stateTopic=“buero/CorinI/STATE”,
transformationPattern=“JSONPATH:$.Wifi.Channel”
]
Type string : wifi-rssi “Wifi RSSI” [
stateTopic=“buero/CorinI/STATE”,
transformationPattern=“JSONPATH:$.Wifi.RSSI”
]
Type string : uptime “Uptime” [
stateTopic=“buero/CorinI/STATE”,
transformationPattern=“JSONPATH:$.Uptime”
]
Type string : time “Time” [
stateTopic=“buero/CorinI/STATE”,
transformationPattern=“JSONPATH:$.Time”
]
Type string : devicestate “Device State” [
stateTopic=“buero/CorinI/LWT”
]
}

// Sonoff Valeshi-I Strom
Thing mqtt:topic:ValeshiI “Sonoff Valeshi-I Strom” @ “Büro” {
Channels:
Type switch : switch “Power Switch” [
stateTopic=“buero/ValeshiI/POWER”,
commandTopic=“buero/ValeshiI/cmnd/POWER”,
//retained=false,
//postCommand="",
//transformationPattern=“JSONPATH:$.POWER”,
//formatBeforePublish="%s",
on=“ON”,
off=“OFF”
]
Type string : state01 “Switch State 01” [
stateTopic=“buero/ValeshiI/STATE”,
transformationPattern=“JSONPATH:$.POWER”,
on=“ON”,
off=“OFF”
]
Type string : state02 “Switch State 02” [
stateTopic=“stat/ValeshiI/POWER”,
on=“ON”,
off=“OFF”
]
Type string : state03 “Switch State 03” [
stateTopic=“stat/ValeshiI/RESULT”,
transformationPattern=“JSONPATH:$.POWER”,
on=“ON”,
off=“OFF”
]
Type number : vcc “VCC” [
stateTopic=“buero/ValeshiI/STATE”,
transformationPattern=“JSONPATH:$.Vcc”
]
Type string : wifi-ap “Wifi AP” [
stateTopic=“buero/ValeshiI/STATE”,
transformationPattern=“JSONPATH:$.Wifi.AP”
]
Type string : wifi-ssid “Wifi SSID” [
stateTopic=“buero/ValeshiI/STATE”,
transformationPattern=“JSONPATH:$.Wifi.SSId”
]
Type string : wifi-channel “Wifi Channel” [
stateTopic=“buero/ValeshiI/STATE”,
transformationPattern=“JSONPATH:$.Wifi.Channel”
]
Type string : wifi-rssi “Wifi RSSI” [
stateTopic=“buero/ValeshiI/STATE”,
transformationPattern=“JSONPATH:$.Wifi.RSSI”
]
Type string : uptime “Uptime” [
stateTopic=“buero/ValeshiI/STATE”,
transformationPattern=“JSONPATH:$.Uptime”
]
Type string : time “Time” [
stateTopic=“buero/ValeshiI/STATE”,
transformationPattern=“JSONPATH:$.Time”
]
Type string : devicestate “Device State” [
stateTopic=“buero/ValeshiI/LWT”
]
}

// Wohnzimmer

// Sonoff Media Center Strom
Thing mqtt:topic:MediaCenter “Sonoff Media Center” @ “Wohnzimmer” {
Channels:
Type switch : switch “Power Switch” [
stateTopic=“wohnzimmer/MediaCenter/POWER”,
commandTopic=“wohnzimmer/MediaCenter/cmnd/POWER”,
//retained=false,
//postCommand="",
//transformationPattern=“JSONPATH:$.POWER”,
//formatBeforePublish="%s",
on=“ON”,
off=“OFF”
]
Type string : state01 “Switch State 01” [
stateTopic=“wohnzimmer/MediaCenter/STATE”,
transformationPattern=“JSONPATH:$.POWER”,
on=“ON”,
off=“OFF”
]
Type string : state02 “Switch State 02” [
stateTopic=“stat/MediaCenter/POWER”,
on=“ON”,
off=“OFF”
]
Type string : state03 “Switch State 03” [
stateTopic=“stat/MediaCenter/RESULT”,
transformationPattern=“JSONPATH:$.POWER”,
on=“ON”,
off=“OFF”
]
Type number : vcc “VCC” [
stateTopic=“wohnzimmer/MediaCenter/STATE”,
transformationPattern=“JSONPATH:$.Vcc”
]
Type string : wifi-ap “Wifi AP” [
stateTopic=“wohnzimmer/MediaCenter/STATE”,
transformationPattern=“JSONPATH:$.Wifi.AP”
]
Type string : wifi-ssid “Wifi SSID” [
stateTopic=“wohnzimmer/MediaCenter/STATE”,
transformationPattern=“JSONPATH:$.Wifi.SSId”
]
Type string : wifi-channel “Wifi Channel” [
stateTopic=“wohnzimmer/MediaCenter/STATE”,
transformationPattern=“JSONPATH:$.Wifi.Channel”
]
Type string : wifi-rssi “Wifi RSSI” [
stateTopic=“wohnzimmer/MediaCenter/STATE”,
transformationPattern=“JSONPATH:$.Wifi.RSSI”
]
Type string : uptime “Uptime” [
stateTopic=“wohnzimmer/MediaCenter/STATE”,
transformationPattern=“JSONPATH:$.Uptime”
]
Type string : time “Time” [
stateTopic=“wohnzimmer/MediaCenter/STATE”,
transformationPattern=“JSONPATH:$.Time”
]
Type string : devicestate “Device State” [
stateTopic=“wohnzimmer/MediaCenter/LWT”
]
}

}

sonoff.items

// Steckdose Corin-I Strom
Switch CorinI_Switch “Corin-I Switch” (SonoffPowerSwitches_Basic,ChristmasLivingrooms) { channel=“mqtt:topic:CorinI:switch” }
String CorinI_State “Corin-I State” (SonoffPowerSwitches_Basic) { channel=“mqtt:topic:CorinI:state01”, channel=“mqtt:topic:CorinI:state02”, channel=“mqtt:topic:CorinI:state03”, channel=“mqtt:topic:CorinI:switch” }
Number CorinI_Vcc “Corin-I VCC” (SonoffPowerSwitches_Basic) { channel=“mqtt:topic:CorinI:vcc” }
String CorinI_WifiAp “Corin-I Wifi AP” (SonoffPowerSwitches_Basic) { channel=“mqtt:topic:CorinI:wifi-ap” }
String CorinI_WifiSsid “Corin-I Wifi SSID” (SonoffPowerSwitches_Basic) { channel=“mqtt:topic:CorinI:wifi-ssid” }
String CorinI_WifiChannel “Corin-I Wifi Channel” (SonoffPowerSwitches_Basic) { channel=“mqtt:topic:CorinI:wifi-channel” }
String CorinI_WifiRssi “Corin-I Wifi RSSI” (SonoffPowerSwitches_Basic) { channel=“mqtt:topic:CorinI:wifi-rssi” }
String CorinI_Uptime “Corin-I Uptime” (SonoffPowerSwitches_Basic) { channel=“mqtt:topic:CorinI:uptime” }
String CorinI_Time “Corin-I Time” (SonoffPowerSwitches_Basic) { channel=“mqtt:topic:CorinI:time” }
String CorinI_DeviceState “Corin-I Device State” (SonoffPowerSwitches_Basic) { channel=“mqtt:topic:CorinI:devicestate” }

// Steckdose Valeshi-I Strom
Switch ValeshiI_Switch “Valeshi-I Switch” (SonoffPowerSwitches_Basic,ChristmasLivingrooms) { channel=“mqtt:topic:ValeshiI:switch” }
String ValeshiI_State “Valeshi-I State” (SonoffPowerSwitches_Basic) { channel=“mqtt:topic:ValeshiI:state01”, channel=“mqtt:topic:ValeshiI:state02”, channel=“mqtt:topic:ValeshiI:state03”, channel=“mqtt:topic:ValeshiI:switch” }
Number ValeshiI_Vcc “Valeshi-I VCC” (SonoffPowerSwitches_Basic) { channel=“mqtt:topic:ValeshiI:vcc” }
String ValeshiI_WifiAp “Valeshi-I Wifi AP” (SonoffPowerSwitches_Basic) { channel=“mqtt:topic:ValeshiI:wifi-ap” }
String ValeshiI_WifiSsid “Valeshi-I Wifi SSID” (SonoffPowerSwitches_Basic) { channel=“mqtt:topic:ValeshiI:wifi-ssid” }
String ValeshiI_WifiChannel “Valeshi-I Wifi Channel” (SonoffPowerSwitches_Basic) { channel=“mqtt:topic:ValeshiI:wifi-channel” }
String ValeshiI_WifiRssi “Valeshi-I Wifi RSSI” (SonoffPowerSwitches_Basic) { channel=“mqtt:topic:ValeshiI:wifi-rssi” }
String ValeshiI_Uptime “Valeshi-I Uptime” (SonoffPowerSwitches_Basic) { channel=“mqtt:topic:ValeshiI:uptime” }
String ValeshiI_Time “Valeshi-I Time” (SonoffPowerSwitches_Basic) { channel=“mqtt:topic:ValeshiI:time” }
String ValeshiI_DeviceState “Valeshi-I Device State” (SonoffPowerSwitches_Basic) { channel=“mqtt:topic:ValeshiI:devicestate” }

// Steckdose Media Center Strom
Switch MediaCenter_Switch “Media Center Switch” (SonoffPowerSwitches_Basic,ChristmasLivingrooms) { channel=“mqtt:topic:MediaCenter:switch” }
String MediaCenter_State “Media Center State” (SonoffPowerSwitches_Basic) { channel=“mqtt:topic:MediaCenter:state01”, channel=“mqtt:topic:MediaCenter:state02”, channel=“mqtt:topic:MediaCenter:state03”, channel=“mqtt:topic:MediaCenter:switch” }
Number MediaCenter_Vcc “Media Center VCC” (SonoffPowerSwitches_Basic) { channel=“mqtt:topic:MediaCenter:vcc” }
String MediaCenter_WifiAp “Media Center Wifi AP” (SonoffPowerSwitches_Basic) { channel=“mqtt:topic:MediaCenter:wifi-ap” }
String MediaCenter_WifiSsid “Media Center Wifi SSID” (SonoffPowerSwitches_Basic) { channel=“mqtt:topic:MediaCenter:wifi-ssid” }
String MediaCenter_WifiChannel “Media Center Wifi Channel” (SonoffPowerSwitches_Basic) { channel=“mqtt:topic:MediaCenter:wifi-channel” }
String MediaCenter_WifiRssi “Media Center Wifi RSSI” (SonoffPowerSwitches_Basic) { channel=“mqtt:topic:MediaCenter:wifi-rssi” }
String MediaCenter_Uptime “Media Center Uptime” (SonoffPowerSwitches_Basic) { channel=“mqtt:topic:MediaCenter:uptime” }
String MediaCenter_Time “Media Center Time” (SonoffPowerSwitches_Basic) { channel=“mqtt:topic:MediaCenter:time” }
String MediaCenter_DeviceState “Media Center Device State” (SonoffPowerSwitches_Basic) { channel=“mqtt:topic:MediaCenter:devicestate” }

Paper UI

sonoff console

22:00:33 MQT: Verbindungsversuch…
22:00:33 MQT: verbunden
22:00:33 MQT: buero/sonoff-CorinI/LWT = Online (beibehalten)
22:00:33 MQT: buero/sonoff-CorinI/cmnd/POWER =
22:01:23 MQT: buero/sonoff-CorinI/STATE = {“Time”:“2019-07-13T22:01:23”,“Uptime”:“0T11:06:21”,“Heap”:15,“SleepMode”:“Dynamic”,“Sleep”:50,“LoadAvg”:19,“POWER”:“ON”,“Wifi”:{“AP”:1,“SSId”:“C-Lab Network”,“BSSId”:“9C:3D:CF:49:96:8F”,“Channel”:1,“RSSI”:48,“LinkCount”:1,“Downtime”:“0T00:00:06”}}
22:02:24 MQT: buero/sonoff-CorinI/STATE = {“Time”:“2019-07-13T22:02:24”,“Uptime”:“0T11:07:22”,“Heap”:15,“SleepMode”:“Dynamic”,“Sleep”:50,“LoadAvg”:19,“POWER”:“ON”,“Wifi”:{“AP”:1,“SSId”:“C-Lab Network”,“BSSId”:“9C:3D:CF:49:96:8F”,“Channel”:1,“RSSI”:42,“LinkCount”:1,“Downtime”:“0T00:00:06”}}
22:03:24 MQT: buero/sonoff-CorinI/STATE = {“Time”:“2019-07-13T22:03:24”,“Uptime”:“0T11:08:22”,“Heap”:15,“SleepMode”:“Dynamic”,“Sleep”:50,“LoadAvg”:19,“POWER”:“ON”,“Wifi”:{“AP”:1,“SSId”:“C-Lab Network”,“BSSId”:“9C:3D:CF:49:96:8F”,“Channel”:1,“RSSI”:46,“LinkCount”:1,“Downtime”:“0T00:00:06”}}
22:04:24 MQT: buero/sonoff-CorinI/STATE = {“Time”:“2019-07-13T22:04:24”,“Uptime”:“0T11:09:22”,“Heap”:15,“SleepMode”:“Dynamic”,“Sleep”:50,“LoadAvg”:19,“POWER”:“ON”,“Wifi”:{“AP”:1,“SSId”:“C-Lab Network”,“BSSId”:“9C:3D:CF:49:96:8F”,“Channel”:1,“RSSI”:44,“LinkCount”:1,“Downtime”:“0T00:00:06”}}
22:05:24 MQT: buero/sonoff-CorinI/STATE = {“Time”:“2019-07-13T22:05:24”,“Uptime”:“0T11:10:22”,“Heap”:15,“SleepMode”:“Dynamic”,“Sleep”:50,“LoadAvg”:19,“POWER”:“ON”,“Wifi”:{“AP”:1,“SSId”:“C-Lab Network”,“BSSId”:“9C:3D:CF:49:96:8F”,“Channel”:1,“RSSI”:46,“LinkCount”:1,“Downtime”:“0T00:00:06”}}
22:06:24 MQT: buero/sonoff-CorinI/STATE = {“Time”:“2019-07-13T22:06:24”,“Uptime”:“0T11:11:22”,“Heap”:15,“SleepMode”:“Dynamic”,“Sleep”:50,“LoadAvg”:19,“POWER”:“ON”,“Wifi”:{“AP”:1,“SSId”:“C-Lab Network”,“BSSId”:“9C:3D:CF:49:96:8F”,“Channel”:1,“RSSI”:44,“LinkCount”:1,“Downtime”:“0T00:00:06”}}

Logs:
openhab2.log

2019-07-13 23:02:44.345 [INFO ] [el.core.internal.ModelRepositoryImpl] - Validation issues found in configuration model ‘mqtt.things’, using it anyway:

Provide a thing type ID and a thing ID in this format:

Provide a thing type ID and a thing ID in this format:

Provide a thing type ID and a thing ID in this format:

2019-07-13 22:51:35.741 [WARN ] [ore.common.registry.AbstractRegistry] - Cannot add “Metadata” with key “channel:CorinI_State”. It exists already from provider “GenericMetadataProvider”! Failed to add a second with the same UI

D from provider “GenericMetadataProvider”!

2019-07-13 22:51:35.741 [WARN ] [ore.common.registry.AbstractRegistry] - Cannot add “Metadata” with key “channel:CorinI_State”. It exists already from provider “GenericMetadataProvider”! Failed to add a second with the same UI

D from provider “GenericMetadataProvider”!

2019-07-13 22:51:35.759 [WARN ] [ore.common.registry.AbstractRegistry] - Cannot add “Metadata” with key “channel:CorinI_State”. It exists already from provider “GenericMetadataProvider”! Failed to add a second with the same UI

D from provider “GenericMetadataProvider”!

2019-07-13 22:51:35.760 [WARN ] [ore.common.registry.AbstractRegistry] - Cannot add “Metadata” with key “channel:ValeshiI_State”. It exists already from provider “GenericMetadataProvider”! Failed to add a second with the same

UID from provider “GenericMetadataProvider”!

2019-07-13 22:51:35.760 [WARN ] [ore.common.registry.AbstractRegistry] - Cannot add “Metadata” with key “channel:ValeshiI_State”. It exists already from provider “GenericMetadataProvider”! Failed to add a second with the same

UID from provider “GenericMetadataProvider”!

2019-07-13 22:51:35.761 [WARN ] [ore.common.registry.AbstractRegistry] - Cannot add “Metadata” with key “channel:ValeshiI_State”. It exists already from provider “GenericMetadataProvider”! Failed to add a second with the same

UID from provider “GenericMetadataProvider”!

2019-07-13 22:51:35.764 [WARN ] [ore.common.registry.AbstractRegistry] - Cannot add “Metadata” with key “channel:MediaCenter_State”. It exists already from provider “GenericMetadataProvider”! Failed to add a second with the sa

me UID from provider “GenericMetadataProvider”!

2019-07-13 22:51:35.765 [WARN ] [ore.common.registry.AbstractRegistry] - Cannot add “Metadata” with key “channel:MediaCenter_State”. It exists already from provider “GenericMetadataProvider”! Failed to add a second with the sa

me UID from provider “GenericMetadataProvider”!

2019-07-13 22:51:35.765 [WARN ] [ore.common.registry.AbstractRegistry] - Cannot add “Metadata” with key “channel:MediaCenter_State”. It exists already from provider “GenericMetadataProvider”! Failed to add a second with the sa

me UID from provider “GenericMetadataProvider”!

i hope you may help me.

I would recommend to cut your problem into little pieces.

  1. Can you switch on/off the SonOff divices using their web-pages (so OH independent)?
  2. Can you monitor your MQTT traffic (with i.e. MQTTlens)?
  3. Can you improve readability? (see my example)
  4. Start with one new device at the time
  5. Do not ignore errors (too much)
  6. Check your “Paper UI: configuration -> things” for duplicates?

Seems your problem is in your thing file (for starters). I prefer i.e. to split brigde and things file and for a Sonoff basic (with Tasmota) the thing file is reduced to a simple:

Thing mqtt:topic:Sonoff2 "Sonoff 2" (mqtt:broker:MyMosquitto) @ "MQTT"  {
  Channels:
    Type switch : power          [ stateTopic="stat/Sonoff2/POWER",  commandTopic="cmnd/Sonoff2/Power"]
    Type string : fw             [ stateTopic="tele/Sonoff2/INFO1",  transformationPattern="JSONPATH:$.Version"]
    Type string : hostname       [ stateTopic="tele/Sonoff2/INFO2",  transformationPattern="JSONPATH:$.Hostname"]
    Type string : ip             [ stateTopic="tele/Sonoff2/INFO2",  transformationPattern="JSONPATH:$.IPAddress"]
    Type string : wifi-rssi      [ stateTopic="tele/Sonoff2/STATE",  transformationPattern="JSONPATH:$.Wifi.RSSI" ]
    Type switch : devicestate    [ stateTopic="tele/Sonoff2/LWT",    transformationPattern="MAP:reachable.map" ]
} // end of thing

My suggestion would be to start over slowly. Succes.

These are just warnings, associated with those of your Items that have been linked to two channels. You can ignore these warnings, they are removed in later openHAB versions.

That looks like a real problem. Simplify to just one sonoff, don’t add any more until you have one working. Be careful of the type of quotemarks " you use in this file.

  1. Yes i can

  2. Yes

  3. The files are readable. The paste did this.

  4. i try it today.

  5. if i ignores error, i didnt wrote here :smiley:

  6. i will check after test today.

by the way. i copied the things and items of the first thread here.

@rossko57
ok i will check the quotemarks today.

Thanks

If you want to stick to the one file version remove the “:” in the channel definition! Here is the syntax of my working file:

Bridge mqtt:broker:opusMQTT [ host="192.168.178.50", secure=false, username="UserName", password="IWillNotTellYou" , clientID="opusMQTTClient" ]
{
  Thing topic sonoff_1_Thing "Light_1" @ "Sonoff" {  
    Channels:
        Type switch : PowerSwitch  [ stateTopic="stat/sonoff_1/POWER" , commandTopic="cmnd/sonoff_1/POWER", on="ON", off="OFF" ]
        Type string : Version [stateTopic="stat/sonoff_1/STATUS2", transformationPattern="JSONPATH:$.StatusFWR.Version"]
      }   
}

The mqtt state of the above Sonoff is “sonoff_1” with the FullTopic left with the default “%prefix%/%topic%/”!

For readability, please format the posted content as “Preformatted Text” (the “</>” Icon!).

In best Case i want more files.

  • mqtt.things
  • sonoff-buero.things
  • sonoff-livingroom.things

but if i cut them in own files, they dont visible in paper ui. i dont know why.
in the future i have more than 1-2 items per room. with one file it is very unusable for me.

check your log when saving file, it will show you an error for sure, thats why they are not shown in basicUI

I do have several files with things,items etc and all is working just fine, you have to be carefull on double definitions and syntax

The syntax I showed and use is for using a single file, if the broker is in a separated file, the syntax is different. See some posts above.
In any case, using the correct syntax the so created things do show in PaperUI, but they are not changeable by PaperUI!
@kriznik: Things are never shown on BasicUI!

i haven’t say they do…

For now i get infos in log of the first device.

mqtt.things and other things are cutted. I cant switch, cause i dont know, how to write the switch. at the moment iam a little bit confused. i tried to use the switch, but it dont work.

mqtt.things

Bridge mqtt:broker:MqttBroker “MQTT Broker” @ “MQTT” [
host="",
secure=false,
port=1883,
qos=0,
retain=false,
clientid=“Oh2Mqtt2Thing”,
keep_alive_time=30000,
reconnect_time=60000,
username="",
password=""
]

buero.things

//=================================================================================================================================================
Thing mqtt:topic:sonoffcorin1 “Strom Corin 1” (mqtt:broker:MqttBroker) @ “Büro” {
Channels:
Type switch : power [ stateTopic=“buero/sonoffcorin1/POWER”, commandTopic=“buero/sonoffcorin1/Power”]
Type string : fw [ stateTopic=“buero/sonoffcorin1/INFO1”, transformationPattern=“JSONPATH:$.Version”]
Type string : hostname [ stateTopic=“buero/sonoffcorin1/INFO2”, transformationPattern=“JSONPATH:$.Hostname”]
Type string : ip [ stateTopic=“buero/sonoffcorin1/INFO2”, transformationPattern=“JSONPATH:$.IPAddress”]
Type string : wifi-rssi [ stateTopic=“buero/sonoffcorin1/STATE”, transformationPattern=“JSONPATH:$.Wifi.RSSI” ]
Type switch : devicestate [ stateTopic=“buero/sonoffcorin1/LWT”, transformationPattern=“MAP:reachable.map” ]
} // end of thing
//=================================================================================================================================================

buero.items

//=================================================================================================================================================
Switch sonoffcorin1_Switch “sonoffcorin1 Power” (Sonoffs) { channel=“mqtt:topic:sonoffcorin1:power” }
String sonoffcorin1_hostname “sonoffcorin1 hostname” (Sonoffs) { channel=“mqtt:topic:sonoffcorin1:hostname” }
String sonoffcorin1_IP “sonoffcorin1 IP” (Sonoffs) { channel=“mqtt:topic:sonoffcorin1:ip” }
String sonoffcorin1_FW “sonoffcorin1 FW” (Sonoffs) { channel=“mqtt:topic:sonoffcorin1:fw” }
String sonoffcorin1_WifiRssi “sonoffcorin1 Wifi RSSI” (Sonoffs) { channel=“mqtt:topic:sonoffcorin1:wifi-rssi” }
Switch sonoffcorin1_DeviceState “sonoffcorin1 Device State” (gReachable,Sonoffs) { channel=“mqtt:topic:sonoffcorin1:devicestate” }
//=================================================================================================================================================

To switch this item click on power of your last picture (so located at “paper UI - control - etc”)
resulting in log entries like:

2019-07-14 21:40:50.731 [ome.event.ItemCommandEvent] - Item 'Sonoff2_Switch' received command ON
2019-07-14 21:40:50.748 [nt.ItemStatePredictedEvent] - Sonoff2_Switch predicted to become ON
2019-07-14 21:40:50.762 [vent.ItemStateChangedEvent] - Sonoff2_Switch changed from OFF to ON

Because your details shows firmware and RSSI you will see the light. But…
If not working please check the syntac of thing channel “power”.
This line might be incorrect using Tasmota.

I click, and it do nothing.

Would you show us your event.log please. You might also look in openhab.log for any messages at this time.

I note that your command topic looks wrong

Event.log if i click in paper ui

2019-07-15 19:24:16.555 [ome.event.ItemCommandEvent] - Item ‘sonoffcorin1_Switch’ received command OFF
2019-07-15 19:24:16.556 [nt.ItemStatePredictedEvent] - sonoffcorin1_Switch predicted to become OFF
2019-07-15 19:24:16.557 [vent.ItemStateChangedEvent] - sonoffcorin1_Switch changed from ON to OFF
2019-07-15 19:24:16.936 [ome.event.ItemCommandEvent] - Item ‘sonoffcorin1_Switch’ received command ON
2019-07-15 19:24:16.937 [nt.ItemStatePredictedEvent] - sonoffcorin1_Switch predicted to become ON
2019-07-15 19:24:16.937 [vent.ItemStateChangedEvent] - sonoffcorin1_Switch changed from OFF to ON
2019-07-15 19:24:17.336 [ome.event.ItemCommandEvent] - Item ‘sonoffcorin1_Switch’ received command OFF
2019-07-15 19:24:17.337 [nt.ItemStatePredictedEvent] - sonoffcorin1_Switch predicted to become OFF
2019-07-15 19:24:17.338 [vent.ItemStateChangedEvent] - sonoffcorin1_Switch changed from ON to OFF
2019-07-15 19:24:17.705 [ome.event.ItemCommandEvent] - Item ‘sonoffcorin1_Switch’ received command ON
2019-07-15 19:24:17.706 [nt.ItemStatePredictedEvent] - sonoffcorin1_Switch predicted to become ON
2019-07-15 19:24:17.706 [vent.ItemStateChangedEvent] - sonoffcorin1_Switch changed from OFF to ON

meanwhile the switch
“nothing”

if i click on the webgui of the switch directly

18:27:17 MQT: buero/sonoffcorin1/RESULT = {“POWER”:“OFF”}
18:27:17 MQT: buero/sonoffcorin1/POWER = OFF
18:27:19 MQT: buero/sonoffcorin1/RESULT = {“POWER”:“ON”}
18:27:19 MQT: buero/sonoffcorin1/POWER = ON

So, did you have a close look at your command topic? These are case sensitive.

i try something… nothing works…

now i tried the template of tasmota wiki, all pastes of this thread. nothing work.

no errors in openhab.log

2019-07-15 20:32:13.881 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘buero.things’
2019-07-15 20:32:14.887 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model ‘buero.things’
2019-07-15 20:33:12.440 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model ‘buero.things’
2019-07-15 20:34:13.523 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model ‘buero.things’
2019-07-15 20:34:38.517 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model ‘buero.things’
2019-07-15 20:36:42.519 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model ‘buero.items’
2019-07-15 20:37:56.015 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model ‘buero.items’
2019-07-15 20:39:11.024 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘buero.things’
2019-07-15 20:41:17.014 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model ‘buero.things’
2019-07-15 20:42:14.516 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model ‘buero.things’
2019-07-15 20:44:41.011 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model ‘buero.things’
2019-07-15 20:47:32.514 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model ‘buero.things’
2019-07-15 20:48:17.508 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model ‘buero.things’

switch didnt react

2019-07-15 20:41:21.730 [vent.ItemStateChangedEvent] - sonoffcorin1_Switch changed from ON to OFF

2019-07-15 20:41:22.034 [ome.event.ItemCommandEvent] - Item ‘sonoffcorin1_Switch’ received command ON

2019-07-15 20:41:22.035 [nt.ItemStatePredictedEvent] - sonoffcorin1_Switch predicted to become ON

2019-07-15 20:41:22.035 [vent.ItemStateChangedEvent] - sonoffcorin1_Switch changed from OFF to ON

2019-07-15 20:41:22.360 [ome.event.ItemCommandEvent] - Item ‘sonoffcorin1_Switch’ received command OFF

2019-07-15 20:41:22.361 [nt.ItemStatePredictedEvent] - sonoffcorin1_Switch predicted to become OFF

2019-07-15 20:41:22.362 [vent.ItemStateChangedEvent] - sonoffcorin1_Switch changed from ON to OFF

2019-07-15 20:41:22.669 [ome.event.ItemCommandEvent] - Item ‘sonoffcorin1_Switch’ received command ON

2019-07-15 20:41:22.672 [nt.ItemStatePredictedEvent] - sonoffcorin1_Switch predicted to become ON

2019-07-15 20:41:22.673 [vent.ItemStateChangedEvent] - sonoffcorin1_Switch changed from OFF to ON

2019-07-15 20:41:23.025 [ome.event.ItemCommandEvent] - Item ‘sonoffcorin1_Switch’ received command OFF

2019-07-15 20:41:23.027 [nt.ItemStatePredictedEvent] - sonoffcorin1_Switch predicted to become OFF

2019-07-15 20:41:23.027 [vent.ItemStateChangedEvent] - sonoffcorin1_Switch changed from ON to OFF

2019-07-15 20:41:23.361 [ome.event.ItemCommandEvent] - Item ‘sonoffcorin1_Switch’ received command ON

2019-07-15 20:41:23.362 [nt.ItemStatePredictedEvent] - sonoffcorin1_Switch predicted to become ON

2019-07-15 20:41:23.363 [vent.ItemStateChangedEvent] - sonoffcorin1_Switch changed from OFF to ON

2019-07-15 20:42:20.037 [ome.event.ItemCommandEvent] - Item ‘sonoffcorin1_Switch’ received command OFF

2019-07-15 20:42:20.041 [nt.ItemStatePredictedEvent] - sonoffcorin1_Switch predicted to become OFF

2019-07-15 20:42:20.041 [vent.ItemStateChangedEvent] - sonoffcorin1_Switch changed from ON to OFF

2019-07-15 20:42:20.666 [ome.event.ItemCommandEvent] - Item ‘sonoffcorin1_Switch’ received command ON

2019-07-15 20:42:20.667 [nt.ItemStatePredictedEvent] - sonoffcorin1_Switch predicted to become ON

2019-07-15 20:42:20.668 [vent.ItemStateChangedEvent] - sonoffcorin1_Switch changed from OFF to ON

2019-07-15 20:42:21.131 [ome.event.ItemCommandEvent] - Item ‘sonoffcorin1_Switch’ received command OFF

2019-07-15 20:42:21.131 [nt.ItemStatePredictedEvent] - sonoffcorin1_Switch predicted to become OFF

2019-07-15 20:42:21.136 [vent.ItemStateChangedEvent] - sonoffcorin1_Switch changed from ON to OFF

2019-07-15 20:42:21.615 [ome.event.ItemCommandEvent] - Item ‘sonoffcorin1_Switch’ received command ON

2019-07-15 20:42:21.616 [nt.ItemStatePredictedEvent] - sonoffcorin1_Switch predicted to become ON

2019-07-15 20:42:21.618 [vent.ItemStateChangedEvent] - sonoffcorin1_Switch changed from OFF to ON

2019-07-15 20:42:22.040 [ome.event.ItemCommandEvent] - Item ‘sonoffcorin1_Switch’ received command OFF

2019-07-15 20:42:22.041 [nt.ItemStatePredictedEvent] - sonoffcorin1_Switch predicted to become OFF

2019-07-15 20:42:22.042 [vent.ItemStateChangedEvent] - sonoffcorin1_Switch changed from ON to OFF

2019-07-15 20:42:22.494 [ome.event.ItemCommandEvent] - Item ‘sonoffcorin1_Switch’ received command ON

2019-07-15 20:42:22.496 [nt.ItemStatePredictedEvent] - sonoffcorin1_Switch predicted to become ON

no more ideas…

you have to look to your mqtt broker if OH broadcasting commands and if yes to which topics, if no there is a problem with binding tho

if you are using default sonoff tasmota configuration it should be something like

    stateTopic="stat/sonoff/POWER"
    commandTopic="cmnd/sonoff/POWER"

and for telemetry it is

    stateTopic="tele/sonoff/STATE"
    stateTopic="tele/sonoff/LWT"