How to? Sonoff RF Bridge OpenMQTTGateway Activating RF outlet

Hi guys,

So i followed this awesome tutorial from @DrZzs about the Sonoff RF bridge and how it can listen to RF Signals.

It works great for receiving signals, but now i want to start sending them as well.

Im using cheap RF outlets to test and the result from pushing the button is:

4276501 = on

home/OpenMQTTGateway/SRFBtoMQTT/Raw 26B6014A03C0414115
home/OpenMQTTGateway/SRFBtoMQTT 4276501
home/OpenMQTTGateway/SRFBtoMQTT/Tsyn 9910
home/OpenMQTTGateway/SRFBtoMQTT/Thigh 330
home/OpenMQTTGateway/SRFBtoMQTT/Tlow 960

4276500 = off

home/OpenMQTTGateway/SRFBtoMQTT/Raw 26DE014A03C0414114
home/OpenMQTTGateway/SRFBtoMQTT 4276500
home/OpenMQTTGateway/SRFBtoMQTT/Tsyn 9950
home/OpenMQTTGateway/SRFBtoMQTT/Thigh 330
home/OpenMQTTGateway/SRFBtoMQTT/Tlow 960

Using a simple binary sensor in HA, i can see the state change from off to on etc:

  - platform: mqtt
    name: "RF stekker 1"
    state_topic: "home/OpenMQTTGateway/SRFBtoMQTT"
    payload_on: "4276501"
    payload_off: "4276500"
    optimistic: true
    retain: true

But now i want to change the outlet from on to off from within home assistant.

How do i do that?

I tried publishing to MQTT from HA, but no result.


Payload (template allowed)


It does register when i monitor the MQTT traffic but nothings happens.

Any idea’s?

I´m also looking for a working configuration without prelearned codes.

You can learn rfkeys in the sonoff itself. in the console you can type

rfkey<number1-16> 2

to start the learning process. it will beep and you can press a key on a remote. after that you can send the
code via the number pad in sonoff or use the console with


for example: rfkey1

sonoff will listen to mqttt commands with the following topic without any payload.


for example:
turn on: cmnd/sonoffBridge/rfkey1
turn off: cmnd/sonoffBridge/rfkey2

commands see:

Hi Export,

Thanks for the reply, but that is whn using tasmota?

Im using OpenMQTTGateway, so i think it works different?

yes, you´re right. My bad, sry. My answer was for using tasmota not OpenMQTTGateway.

No problem. Do you have any succes with Tasmota? Im not married to OpenMQTTGateway.

Other people who could help me out?

I can help by putting out a new (and much better) video about using Tasmota with the RF Bridge. Just give me a couple more days, it’s almost done.

Sorry I don’t know how to send 433 signals with OMG on the bridge…

1 Like

Awesome, no hurry!!


You just have to add a command topic like the example below:

replace in the example:

and put your payloads

Hi, having a bit of difficulty getting this working with some cheap RF 433 Outlets.

I can sniff out the remote control codes fine for example,


4:34:26 MQT: tele/RF_Bridge/RESULT = {"RfReceived":{"Sync":9430,"Low":310,"High":900,"Data":"E05F55","RfKey":"None"}}


14:34:25 MQT: tele/RF_Bridge/RESULT = {"RfReceived":{"Sync":9450,"Low":310,"High":890,"Data":"E05F5D","RfKey":"None"}}

But when I try to put this as a switch in config.yaml to control the outlets I get no luck? Nothing also displays in the console so I’m not sure if the RF_Bridge is actually transmitting RF codes, as when I try and pair the sockets with the 1-16 buttons, nothing happens?

It can receive RF codes from the button fine so I’m not sure what the issue is?


the code that you received doesn’t seems to correspond to OpenMQTTGateway, are you sure you flashed it with OMG?

hah! that would explain my issues… I’m using Tasmota, but had changed the state and command topic to “tele/RF_Bridge/RESULT”

Figured it would be same sort of code.

nope it is not the same code

You can check Export advice, you should ‘teach’ tasmota buttons on the rf bridge.
Use the tasmota console, at the command line enter ‘rfkey<1> 1’ for setting key number 1, when you hear the beep you press the on button on ur rf remote , ‘rfkey<2> 1’ for setting key number 2 , when you hear the beep you should press the off button on your rf remote.
Now button number 1 on sonoff rf bridge will be the on button, and button number 2 on rf bridge will be the off button.

Can you please show us here how to set the switch for on and off in the yaml file.
I understand the command_topic, but how to write it to.use the on and off to show in one switch?
Can it be like toggle?

I am trying to send the code via home assistant and it is not working. This is my config:

platform: mqtt
name: 'Luz RF'
command_topic: "home/OpenMQTTGateway/commands/MQTTtoSRFB"
payload_on: "4325375"
payload_off: "4325375"

What am I doing wrong?

In your automation

  - data:
      payload: '4325375'
      topic: home/OpenMQTTGateway/commands/MQTTtoSRFB
    service: mqtt.publish

I don’t have an automation, I am trying to configure a light or switch.

That is a little more complicated, since you have only one code that toggles the light/switch (not two, one for one and one for off)

First you create an input_boolean (this will keep track if your light is on or off) :

    name: light2
    icon: mdi:lightbulb

Then you create a binary_sensor :

  - platform: mqtt
    name: light2_sensor
    state_topic: 'home/OpenMQTTGateway/SRFBtoMQTT'
    value_template: >- 
      {% if value_json.value == 4325375 %}
      {% else %}
        {{states('binary_sensor.light2_sensor') | upper}}
      {% endif %}
    off_delay: 20

And an automation for it :

- id: '1562219853852'
  alias: Light2 toggle
  - entity_id: binary_sensor.light2_sensor
    from: 'off'
    platform: state
    to: 'on'
  - data:
      entity_id: input_boolean.light2
    service: input_boolean.toggle

Then you create your switch:

 - platform: template
        value_template: "{{ is_state(' input_boolean.light2', 'on') }}"
          - service: mqtt.publish
              payload: '4325375'
              topic: home/OpenMQTTGateway/commands/MQTTtoSRFB

          - service: mqtt.publish
              payload: '4325375'
              topic: home/OpenMQTTGateway/commands/MQTTtoSRFB

That should do the trick.


Thank you!!!
I’ll try this out tonight and let you know.