Sonoff RF Bridge with ESPHOME?

Please correct your post. It incorrectly attributes the question posed by eRadix to me. I never asked the question.

Here’s your post, incorrectly attributing the question to me (probably as a result of ‘quoting a quotation’):

Here’s elRadix’s post with the question:

1 Like

For me it was critical (one of my lights change light mode after quick turn-off-turn-on). With ESPHome I have immediate reaction.
Okay, maybe my MQTT broker on HA was not configured properly, maybe there some settings which can speed up responses. But now I have no need in MQTT, as I use only ESPHome devices.

I found, that ESPHome RF protocol need to be adjusted to work with some of my RF keyfobs. When I did this, I got instant response, at least from the remotes I have.

If TASMOTA works for you and you have no problems - good, no need to change it while it works. I just was unhappy with slow response and with MQTT broker that was running only for one device in HA network.

2 Likes

FYI, I make heavy use of MQTT for other integrations with Home Assistant,and use mosquitto running in a Docker container, alongside of Home Assistant. I believe it has higher performance than the built-in MQTT broker. I also find it handy to use MQTT rather than the newer Home Assistant direct integration in ESPhome because I can easily monitor what’s going on with a simple MQTT client subscribing to a relevant topic.

Glad the ESPhome solution is working great for you! I’m really pleased with Home Assistant having so many options available to solve these problems as they come up, and based on your circumstances.

1 Like

Who made this rules? Your post is very informative - thank’s a lot! Can’t image it with more photos illustrated! :smiley:
EDIT: Never mind - catched the link you posted to the photos :wink:

I noticed that you have pin number 5 connected to ground on the back on the PCB, haven’t seen that referenced anywhere. Am I missing something?

1 Like

Wow! Eagle eye!
Naah, it just looks like soldered on the photo, there is no actually the connection (and should not be), wire end is floating above the hole.
But thanks for pointing on that, I removed it :slight_smile:

2 Likes

Have you used this approach with sensors that send multiple codes? Like a door sensor that sends one code when open and one when closed? Can they be “merged” into one binary sensor at the esphome level, or do they have to be treated as two separate sensors and merged in HA?

I did not find a way how to merge several codes into one sensor, I don’t think that is it possible. So door sensor with two states, open/close, will require to binary sensors and automation in HA (and I don’t think that it is a big problem).

I have one remove, where each button (4 pairs) send 4 different codes, cycling them on each next button press. So to you this remote, as example, to control 4 sockets with separate buttons for ON and OFF, I will had to create… 32 binary sensors… for 4 sockets. And I have TWO such remotes :slight_smile:

1 Like


Done. NodeMCU is working now with RF receiver and ESPHome & HA. I did some test month ago but without luck.

First of all, I used 3.3V before for RF receiver. Looks like it need 5V, so I connected it VU pin on NodeMCU (it have 5V there). Next, in my early NodeMCU config there was error, pin: 4 is NOT the same as pin: D4. So as it connected to D4 on the board, it should be pin: D4. I got first signals after this, but only from one of the remotes. So I began to play with config and found, that signals can be read with this settings in device config:

remote_receiver:
  pin: D4
  dump: rc_switch
  filter: 100us
  idle: 2ms
  tolerance: 50%

And here is how binary sensor looks like for remote buttons:

binary_sensor:
  - platform: remote_receiver
    name: "Keyfob Remote Button A"
    rc_switch_raw:
      code: '110010010111000010100010'
      protocol: 1
    filters:
      - delayed_off: 500ms

Now I have the signals from all the remotes. In compare to Sonoff RF Bridge (I make all changes on it to see the difference in performance between Sonoff Bridge and NodeMCU + RF), cheap RF receiver get more errors in signal recognition and really poor distance. So I made simple antenna for RF receiver. It increased distance a little, maybe even reduce errors count, but it still works poor. At end I can say, that Sonoff RF Bridge much more precise in recognition and have really good receiver sensitivity than separate RF module. But both can work with ESPHome if needed, without almost any difference in configs. At least, from what I saw on practice.

Also, the same approach should work for non-RF Sonoff devices, it is possible to connect cheap RF receiver there and read the signals (maybe I day I will test this too).

6 Likes

It should work easily with a template Sensor directly in esphome. If you don’t expose the to binary ones you build the template sensor from to home assistant everything is clean and tidy!

1 Like

hi, one question how top add switch with one raw code for on and one for off state pls?

Oh I think there is no way to do it. I have looked in esphome rc switch documentation and it has to be two separete switches :frowning:

You can create template to turn switch on or off with two binary sensors (or two RF codes in one sensor).

2 Likes

Hi, I note that you said you had really poor range with your 433Mhz receiver.
I think by chance you picked one of the worst performing ones on the market :slight_smile:
Have a look at the ones listed on this info page from RFlink below, it has the good info on what modules are best. Trust me there will be a significant improvement with the right quality RX module.
Good RX module info

2 Likes

I bought these RF modules like 10y ago for one of my Arduino projects. And now I used them only to figure out how to work with RF with ESP8266 + ESPHome.

For my smart home RF devices I use Sonoff RF Bridge.

Hi
Please help me with the answer to the noob question - how can I first flash the RF bridge with ESPHome after the HW modification (cutting circuits and solder the transistors) ? I dont see the RF bridge connected to the USB port in Home Assistant - only OTA is availlable.
I have tried starting the device with RF button pressed, with the internal switch in both positions (ON or OFF) …nothing I read is working.
Do I need to use the serial adapter to flash it?

Thank you

Yes, according to the instructions you need to

  • turn switch off
  • connect usb-ttl adapter to rf bridge
  • press rf button
  • connect usb-ttl adapter to computer while keeping the rf button pressed

flashing worked well, but no success with the RF part despite careful mod, reversed the mod and tasmota still works. will need to debug more anothter day

edit: hmm, nexa transmitter had dead battery, oddly enough worked with fresh battery. the other transmitter seems to use a different protocol which isn’t supported by rc_switch, but was supported by RFControl lib.

Thanks for all this insight. Pretty cool. I’ve got a sonoff rf bridge on the way and I’m going to have a crack at it for controlling some smart blinds.

1 Like

Found myself in a similar situation, this is what I ended up with. And its blazing fast, virtually no perceptionable delay between pressing a button and the web-ui updating. Love it!

binary_sensor:
  - platform: status
    name: "RF Bridge Status"

  - platform: remote_receiver
    name: "Switch 1(RF-On)"
    internal: true
    on_press:
      then:
        - switch.template.publish:
            id: switch_1
            state: ON
    rc_switch_raw:
      code: '000001010000000000010101'
      protocol: 1
  - platform: remote_receiver
    name: "Switch 1 (RF-Off)"
    internal: true
    on_press:
      then:
        - switch.template.publish:
            id: switch_1
            state: OFF
    rc_switch_raw:
      code: '000001010000000000010100'
      protocol: 1

switch:
  - platform: template
    name: Switch 1
    id: switch_1
    optimistic: true
    assumed_state: true
    turn_on_action:
      remote_transmitter.transmit_rc_switch_raw:
        code: '000001010000000000010101'
        protocol: 1
        repeat: 3
    turn_off_action:
      remote_transmitter.transmit_rc_switch_raw:
        code: '000001010000000000010100'
        protocol: 1
        repeat: 3

hth

edit: transmit was unreliable so added repeat: 3 and threw together this js bin to generate configs like the above. feel free to use/adapt.

3 Likes

So I’m going to have a crack at this too (Sonoff RF Bridge on the way), am new to this, and guess I need a usb-ttl adapter. Could someone point me to one please? Like maybe one of these? I don’t have a clue what I’m looking at. ta.

https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20190701012620&SearchText=USB+to+TTL+adapter