Sonoff RF BRIDGE with Tasmota - correct config with OH2

  • Platform information:
    • Hardware: CPUArchitecture/RAM/storage
    • OS: what OS is used and which version
    • Java Runtime Environment: which java platform is used and what version
    • openHAB version:
  • Issue of the topic: please be detailed explaining your issue
  • Please post configurations (if applicable):
    • Items configuration related to the issue
    • Sitemap configuration related to the issue
    • Rules code related to the issue
    • Services configuration related to the issue
  • If logs where generated please post these here using code fences:

You didn’t provide much info.

See this topic.

I apologize for the previous post … its correct content disappeared somewhere :slight_smile:


I’m new here, I’m learning all the time and I need your help.

I have several touch switches with the option of RF 433MHZ control. I would like to control them by OH2.
I have Sonoff RF bridge with TASMOTA software with configured MQTT.

I have read many forum threads, Tasmota documentations… but I’m stuck all the time.

I found some similar threads on the forum, for example this one is very similar

How should the ITEMS RULEs configuration look like … if I know that a given switch is controlled by a paired remote control which sends code (read in the TASMOTA console) - button A

16:33:27 MQT: tele/sonoffbr/RESULT = {"RfReceived":{"Sync":12960,"Low":420,"High":1260,"Data":"4DD503","RfKey":"None"}}

Will you be using the 1.x or 2.x mqtt binding? If planning to use the 1.x then make sure to turn on legacy bindings in PaperUI so the option to install is available.

I allready have instaled MQTT binding (binding-mqtt1 - 1.12.0)
because I use the MQTT protocol for communication with nodeMCU and sonoff Basic

Looking at the link you posted above you have an example of the item.

String Sonoff_Button { mqtt="<[broker:tele/sonoff_rf/RESULT:state:JSONPATH($.RfReceived.Data)]" }

For the rule change the name and use the correct number e.g. 4DD503

rule "Button Pressed"
    Item Sonoff_Button received update // Need received update if Data has not changed but button still pressed
    Thread::sleep(100) // Need the sleep to allow for the state to change
    if (Sonoff_Button.state == "6A8CD2") {
        if (S4CH04.state == ON || S4CH04.state == NULL) { S4CH04.sendCommand(OFF) }
        else { S4CH04.sendCommand(ON) }

Change the name, Sonoff_Button, to suit your needs and test if it works. Check the logs for info on what may be the issue.

For your regular sonoff switch you will need to use something like this.

Switch Test_Sonoff "Test sonoff2" <light> (gSonoff) ["Lighting"] //swapped with CouchLight 11/19/18
	{ mqtt=">[pibroker:cmnd/sonoff4/POWER:command:*:default],
	<[pibroker:stat/sonoff4/POWER:state:default]" }

THX for another solution for regular sonoff switch - Sonoff Basic. I’II check it
This item code work great for me

Switch socket "Night Lamp" {mqtt="<[broker:/sonoff/nlamp/switch/cmd:command:ON:on] <[broker:/sonoff/nlamp/switch/cmd:command:OFF:off],<[broker:/sonoff/nlamp/switch/state:state:ON:on],<[broker:/sonoff/nlamp/switch/state:state:OFF:off]"}

With the sonoff you shouldn’t need or use the leading slashes after the broker: like below. Also the first part should be cmnd or stat? But you have it working so who knows.:laughing:

Switch socket "Night Lamp" {mqtt="<[broker:sonoff/nlamp/switch/cmd:command:ON:on] <[broker:sonoff/nlamp/switch/cmd:command:OFF:off],<[broker:sonoff/nlamp/switch/state:state:ON:on],<[broker:sonoff/nlamp/switch/state:state:OFF:off]"}

back to the topic : )

in the code from the example

“S4CH04” is an element of “Item”
My guess is that it is channel # 4 from the 4-channel SONOFF switch

How to define channels for such a switch in my case

or otherwise

how to force RF BRIDGE to send the code “4DD503” after switching the button in OH2 ???

That is the item’s name. For using the rule above just replace the name with your item name e.g. socket.sendCommand(ON)

With a rule and the RF code.


rule "Code"
    Item Your_Button received update

OK I’ve got another solution. I would like use predefined codes of buttons 1-16 in tasmota
how code of item SWITCH … should like if in tasmota console I get this ?

19:46:38 MQT: stat/sonoffbr/RESULT = {"RfKey1":"Default sent"}

Something like this doesn’t work
Switch RF1 "TEST" {mqtt=">[broker:/cmnd/sonoffbr/RfKey1:command:ON:1], >[broker:/cmnd/sonoffbr/RfKey1:command:OFF:0]"}

I think there are multiple solutions. I went through different topics on this forum and decided to put all together. I wrote a post here if somebody needs tutorial step by step how to configure Sonoff Bridge with OpenHAB with no rules.