Sonoff rf bridge and remote lights

Hi everyone,
I wanted to add this as I struggled for hours getting this to work. I installed sonoff 4 channel switches to control my lights. To switch them on and off I needed remotes, so I added a sonoff RF Bridge and some remotes. They are all reloaded with Tasmota!

The way the bridge works is to issue a standard MQTT payload that includes the unique HEX code for the remote/button , so on a 4 button remote you would get 4 unique codes.

the topic by default is tele/RF_Bridge/RESULT and the payload is
{“RfReceived”:{“Sync”:8130,“Low”:270,“High”:780,“Data”:“4A01C2”,“RfKey”:“None”}}
The data field is the button code!

So to define the binary switches you need the following:
platform: mqtt
name: ‘Calvin_a’
state_topic: ‘tele/RF_Bridge/RESULT’
value_template: ‘{{value_json.RfReceived.Data}}’
payload_on: ‘997EC2’
payload_off: ‘997EC2_off’
device_class: light
qos: 1
The value template is what pulls the Data field out of the JSON to match with the defined payload_on.
There is a FAKE payload_off that I use to reset the state so that it is ready for the automation again.

The automation once entered in the UI , looks as follows in the YAML file.

  • id: ‘1553290370220’
    alias: Calvins lights toggle
    trigger:
    • entity_id: binary_sensor.calvin_a
      from: ‘off’
      platform: state
      to: ‘on’
      condition: []
      action:
    • data:
      entity_id: switch.calvins_lights
      service: switch.toggle
    • data:
      payload: ‘{“RfReceived”: {“Data”:“997EC2_off”}}’
      topic: tele/RF_Bridge/RESULT
      service: mqtt.publish

So I have an automation that checks for the change from off to on, which is handled by the default message sent by the RF Bridge on the press of a button, and toggles the required light switch, but the automation then issues the OFF payload using an mqtt.publish.

In the file the JSON for the payload looks normal, but to enter this in the automation UI, you must first escape all of the double quotes as follows:
“{“RfReceived”: {“Data”:“997EC2_off”}}”
I found it easier to create the first one in the UI, then copy and paste the items in the YAML file to get the rest setup. just remember to increment the id number at the beginning of each block.

save and restart, and your remotes now toggle your lights on and off using a single button.

1 Like

I need this and I can’t get it to work. I have similar setup to you - Sonoff RF bridge with Tasmota and a 2-way wall switch.

The automation just doesn’t get triggered no matter what I do. Codes, topics and “” are all seemingly correct and there’s no error messages related to this in the logs. I do see the MQTT messages in MQTT Explorer.

Why do you have 4A01C2 in the payload from Tasmota but 997EC2 in the code?

Any tips?

Check out this topic :

OMG, I had quotes around ON and OFF in the automation, that’s why it didn’t work 🤦🏻

Thank you all :slight_smile: