Using 433MHz Cloning Remote with Sonoff RF Bridge

Good morning!

I just got my Sonoff RF bridge and some assorted 433MHz devices from BangGood, and things have been going well so far. I got the Sonoff flased with Tasmota, and I have some door sensors and a PIR communicating with it.

The problem I’m running into is that I might have bought a 433MHz remote that isn’t going to work as an input for me. This is what I bought:

Now that I’ve looked at the documentation, it looks like i won’t send its own codes out of the box, I have to have it clone an existing code. I don’t have any existing codes to clone, is there any way you folks can think of that I might be able to get it sending some assorted generic codes to get picked up by my RF Bridge?

1 Like

@dimagoltsman solved this for the Broadlink 433Mhz hub. You need to send a code from your bridge and have the remote learn that signal.

1 Like

Thanks! I’ve had that tool create some random codes for me, and I’m attempting to use the Tasmota web console to get my RF Bridge to transmit those (so that this keyfob can learn them), but I haven’t been successful yet. I feel like I’m almost certainly doing something wrong.

In console, I’m typing:
RFCode sgw0AA0kJA0NJCQNDSQNJA0kDSQNJCQNDSQNJA0kDSQNJA0kDSQNJA0kDSQkDSQNJA0NJAwAAW8AAAAA

And the console tells me:
16:46:43 CMD: RFCode sgw0AA0kJA0NJCQNDSQNJA0kDSQNJCQNDSQNJA0kDSQNJA0kDSQNJA0kDSQkDSQNJA0NJAwAAW8AAAAA
16:46:43 MQT: stat/sonoff_rf_bridge/RESULT = {"RfCode":0}

The RF LED does NOT light up, so it’s not sending anything for this remote to learn. Am I misunderstanding how to get the Sonoff to send the code?

Thanks again for the help!

It looks like the Sonoff uses a different format than the Broadlink.
Broadlink (all my rf codes start sg/si and end with A’s followed by 0 or more ='s):
sgw0AA0kJA0NJCQNDSQNJA0kDSQNJCQNDSQNJA0kDSQNJA0kDSQNJA0kDSQkDSQNJA0NJAwAAW8AAAAA
Sonoff:
AAB0210314016703F924180101011001100110010101100110011001010110010101100255

I expect there is a way to convert them but a quick google doesn’t show much. Perhaps you could copy some codes from someones public config files?

Ok, is the Sonoff RF Code you pasted valid? If so, I should be able to send
RFCode AAB0210314016703F924180101011001100110010101100110011001010110010101100255
And the bridge should transmit something, right? I tried that and it still doesn’t transmit anything.

I’ll keep looking on the Googles to see if I can find some more raw RFCodes in the meantime.

I copied that from the Tasmota wiki but rereading it I think that is for modified hardware only (it uses RFRaw command).
I also saw this
RfSync 11320; RfLow 360; RfHigh 1090; RfCode #151151
It looks like 4 separate console commands to configure and transmit the signal.

Googling for “RfReceived”:{ finds a bunch of values you could try.

1 Like

Ok, I think I’ve gotten some success. I went into the Tasmota web console and entered:
Backlog RfSync 11320; RfLow 360; RfHigh 1090; RfCode #151151
And the RF Bridge blinked its RF LED!
So, I held down a button on my RF Remote to tell it to clone what it sees, and manually sent that twice from the console - success!
Now, when I press that button my RF Remote, the RF Bridge reports it!
18:44:14 MQT: tele/sonoff_rf_bridge/RESULT = {"RfRaw":{"Data":"AAA427F60186040615115155"}}
I’ve still got to set that up as an MQTT switch, but I’m a lot closer!

1 Like

The sweet smell of progress!

Thanks for this, it makes the RF_Bridge an infinite number of codes sender instead of a 16 code sender.

The exact coding for this I have not found in the wiki or the Tasmota docs, so this should be shouted from the roof tops!

It works awesome!

1 Like

So i wanted to add an actual switch here to show how it’s done. I have some cheap Menards 433mhz switches that run by a 6 button remote. 3 switches, and each has a different on and off code.

What you do is click the button about 5 times as the capture is not perfect. Then you use that info to make a switch like below…

This is from the bridge control panel. I pushed the on, then the off 5 times. You can average these number or just pick something in the middle. Throw out the outlayers. You may have to tweak the numbers in HA if it isn’t responding correctly most of the time.

04:00:12 MQT: RF_Bridge/tele/RESULT = {"RfReceived":{"Sync":9540,"Low":300,"High":880,"Data":"472083","RfKey":"None"}}
04:00:15 MQT: RF_Bridge/tele/RESULT = {"RfReceived":{"Sync":9590,"Low":300,"High":880,"Data":"472083","RfKey":"None"}}
04:00:17 MQT: RF_Bridge/tele/RESULT = {"RfReceived":{"Sync":9560,"Low":300,"High":890,"Data":"472083","RfKey":"None"}}
04:00:20 MQT: RF_Bridge/tele/RESULT = {"RfReceived":{"Sync":8140,"Low":310,"High":890,"Data":"239041","RfKey":"None"}}
04:00:22 MQT: RF_Bridge/tele/RESULT = {"RfReceived":{"Sync":9520,"Low":300,"High":880,"Data":"472083","RfKey":"None"}}
04:00:25 MQT: RF_Bridge/tele/RESULT = {"RfReceived":{"Sync":9560,"Low":300,"High":880,"Data":"472082","RfKey":"None"}}
04:00:27 MQT: RF_Bridge/tele/RESULT = {"RfReceived":{"Sync":9560,"Low":300,"High":880,"Data":"472082","RfKey":"None"}}
04:00:32 MQT: RF_Bridge/tele/RESULT = {"RfReceived":{"Sync":9580,"Low":290,"High":890,"Data":"472082","RfKey":"None"}}
04:00:34 MQT: RF_Bridge/tele/RESULT = {"RfReceived":{"Sync":9590,"Low":300,"High":890,"Data":"472082","RfKey":"None"}}
04:00:37 MQT: RF_Bridge/tele/RESULT = {"RfReceived":{"Sync":9550,"Low":310,"High":880,"Data":"472082","RfKey":"None"}}

Your topic may be switched in order and your names will change, but this is a working switch, Optimistic seems to work the best, and state could probably be removed, but it’s working for me.

switch:
    #####################################################
    # MQTT Plug Set D Lights                            #
    #####################################################
    #######
    ## 1 ##
    #######
    - platform: mqtt
      id: "D1"
      name: "D1"
      command_topic: "RF_Bridge/cmnd/Backlog"
      payload_on: "RfSync 9600; RfLow 290; RfHigh 890; RfCode #472083"
      payload_off: "RfSync 9600; RfLow 290; RfHigh 890; RfCode #472082"
      state_topic: "RF_Bridge/tele/RESULT"
      value_template: '{{value_json.RfCode}}'
      state_on: "#472083"
      state_off: "#472082"
      optimistic: true
      qos: 2
      retain: false
      availability_topic: "RF_Bridge/tele/LWT"
      payload_available: Online
      payload_not_available: Offline

When you push the button in HA, the console looks like this and the switch reacts.

04:02:59 MQT: RF_Bridge/stat/RESULT = {"RfSync":9600}
04:02:59 MQT: RF_Bridge/stat/RESULT = {"RfLow":290}
04:03:00 MQT: RF_Bridge/stat/RESULT = {"RfHigh":890}
04:03:00 MQT: RF_Bridge/stat/RESULT = {"RfCode":"#472083"}
......
04:03:01 MQT: RF_Bridge/stat/RESULT = {"RfSync":9600}
04:03:01 MQT: RF_Bridge/stat/RESULT = {"RfLow":290}
04:03:01 MQT: RF_Bridge/stat/RESULT = {"RfHigh":890}
04:03:02 MQT: RF_Bridge/stat/RESULT = {"RfCode":"#472082"}
1 Like

Hi, thanks everyone a lot for this thread, and for working out how to send the codes. This is great stuff!

I would just like to strongly suggest to change “reatain” to false (default) in your exemplary switch configuration. I missed it and just copied it over… huge mistake for an RF switch that has only one code to toggle on/off. Cost me an hour to figure out how to replace the retained state with an empty one. Still my RF bridge is not the same anymore, since it now receives empty states for “cmnd” and “tele” ca. once a minute. The ghost switching is gone, but it never goes to sleep anymore.

It seems like the only option to get rid of the empty states is to remove the MQTT broker from the system and to then reinstall it. Apparantly that is the only way to clear the file containing the retained states. :frowning: Update: This actually solves the problem in minutes. You will lose all retained states, but other than that there’s not much that can go wrong (just don’t forget to backup your conifg window).

Did you not have any problems with retaining rf switches? Either way, please set it to false in your config, as I’m sure you’ll safe some people some trouble.

I have been playing with settings to try to fix another problem,
This is working for me but I’ll edit and take retain out.
You may want to adjust the qos as well.

I discovered that using MQTT Explorer in Windows to delete retained entries saved me from having to mess about reinstalling Mosquitto on RPi.

Hope that helps.

1 Like

@Sir_Goodenough - Many thanks for this. Works perfectly. As you flagged, my topics are switched in order so I changed the HA code accordingly.

One thing, rather than having on and off RF switches, my device has a toggle, so I have to use the same RF code for on and off. This also means that HA always thinks it is on. Any way to combat that so it know once is on, twice if off?

@Kosh42, These are one state one code switches as well The code with the hashtag (#) in front are made up and serve as OFF placeholders for HA. They however do nothing for the switch.

Most of my 433 stuff thru the RF Bridge uses a snippit of python code as an add-in now. This solved the problem of HA expecting only 2 codes per device spamming the error log. See here:
sonoff-rf-bridge-strategies-for-receiving-data
This works a lot better and is more stable. Check it out and don’t let the word python scare you!