Sonoff rfbridge: RF; signal send and receive, changing switch state (on/off)

Hello Everyone

I am very new to home assistant, please be patient.

I recently intergrated a rfbridge into my system.
I setup the rfbridge to send and recieve rf signals.

  1. send signal on/off
  2. recieve RF signal from switch when pressed

It all done on the sonoff integration (hacks) and sonoff app.

I want to setup the switches to change color when it tunes on/off from the dashboard or when the bridge recieves signal from the RF switch.

In short I want the switch to show when its off/on and it shouldn’t matter if I activate it on the HA dashboard or the RF switch.

  • Make a toggle helper.
  • Make an automation that reacts to the recieved signal for on and for off and make it set the state of the toogle with a service call
  • Make your HA dashboard button and make it do two service call per click one to send the RF signal and one to set the state of the toggle.

Not sure if you’re into NodeRed, but i found out that it makes it easier…
Now I use it to control light directly, but ofc this could also set helpers…
image

[{"id":"ec5f4e71.2f17d","type":"switch","z":"93fcc754.afaf08","name":"D7E798","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"D7E798","vt":"str"}],"checkall":"true","repair":true,"outputs":1,"x":320,"y":20,"wires":[["41005807.3f41e8"]]},{"id":"4cf74af1.fa9aa4","type":"switch","z":"93fcc754.afaf08","name":"D7E79C","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"D7E79C","vt":"str"}],"checkall":"true","repair":true,"outputs":1,"x":320,"y":60,"wires":[["b40be53.0efd018"]]},{"id":"9c9cec88.f1a41","type":"switch","z":"93fcc754.afaf08","name":"D7E794","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"D7E794","vt":"str"}],"checkall":"true","repair":true,"outputs":1,"x":320,"y":100,"wires":[["f739cefe.ebbcc"]]},{"id":"71d96860.9bd7e8","type":"switch","z":"93fcc754.afaf08","name":"D7E799","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"D7E799","vt":"str"}],"checkall":"true","repair":true,"outputs":1,"x":320,"y":140,"wires":[["60a2cf1.c80083"]]},{"id":"f0ddb83c.1c7f78","type":"switch","z":"93fcc754.afaf08","name":"D7E792","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"D7E792","vt":"str"}],"checkall":"true","repair":true,"outputs":1,"x":320,"y":180,"wires":[["24023bb0.683684"]]},{"id":"3006b088.8b625","type":"switch","z":"93fcc754.afaf08","name":"D7E795","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"D7E795","vt":"str"}],"checkall":"true","repair":true,"outputs":1,"x":320,"y":220,"wires":[["4855e1bc.81169"]]},{"id":"e98c1252.c569","type":"switch","z":"93fcc754.afaf08","name":"D7E791","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"D7E791","vt":"str"}],"checkall":"true","repair":true,"outputs":1,"x":320,"y":260,"wires":[["1600b5a9.f20cfa"]]},{"id":"dd3fa1ca87857ce4","type":"switch","z":"93fcc754.afaf08","name":"D7E793","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"D7E793","vt":"str"}],"checkall":"true","repair":true,"outputs":1,"x":320,"y":300,"wires":[[]]},{"id":"f6005625.9fca88","type":"mqtt in","z":"93fcc754.afaf08","name":"RF433 Tasmota","topic":"TasmotaBRG1/tele/RESULT","qos":"2","datatype":"auto","broker":"f90cfe3b.a8bd7","nl":false,"rap":false,"rh":"0","inputs":0,"x":100,"y":220,"wires":[["ec5f4e71.2f17d","9c9cec88.f1a41","71d96860.9bd7e8","f0ddb83c.1c7f78","3006b088.8b625","e98c1252.c569","4cf74af1.fa9aa4","670aeaaf.b7c124","dd3fa1ca87857ce4","c7a62c8593325414","500e743bc4280e92","3bb9f812bfd445fa","c5d33d7b55eb5bea","39390b903a4ace9e"]]},{"id":"f90cfe3b.a8bd7","type":"mqtt-broker","name":"","broker":"192.168.103.9","port":"1883","clientid":"node-red","autoConnect":true,"usetls":false,"compatmode":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closeRetain":"false","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willRetain":"false","willPayload":"","willMsg":{},"sessionExpiry":""}]

I’m still too new to home assistant. I looked at it and would work perfectly but it will take me few months of reading just to get one light switch operating.
I notice you use the mqtt broker to do the functions, do you have to do it like that or can you use the normal sonoff firmware?

I’m still new so I have some ideas what to do where (thank you youtube)
not sure about this path thou:

  • Make your HA dashboard button and make it do two service call per click one to send the RF signal and one to set the state of the toggle.

i think you can only use the RF bridge when tasmotized…and that works through mqtt :thinking:

At least, my sonoff works like that…

I’m running the original firmware, the integration was easy. Think that was the only easy part haha

Ok, I think I tried to explain something without having access to my HA and misremembered something.
Here is my setup for a Lava lamp with same issue.

Configuration.yaml addition (I use light here, but switch should work the same):

light lamps:
  - platform: template
    lights:
      lava_lamp:
        friendly_name: "Lava Lamp"
        turn_on:
          service: script.lava_lamp_turn_on
        turn_off:
          service: script.lava_lamp_turn_off

Scripts for on and off (Only one is shown, since just the codes are changed for the other. I use ESPHome on my Sonoff RF Bridge 433, so the code might look a bit different)

alias: Lava Lamp Turn Off
sequence:
  - service: esphome.rfbridge1_send_rf_code
    data:
      sync: 10000
      low: 280
      high: 900
      code: 5326164
mode: single
icon: mdi:lava-lamp

The last part I have is catching the RF codes for on and off and set the state with a service call of the light. I do this in Node Red, but it should be the same with a simple automation reacting to the RF codes on the event bus or where ever the RF code signal is received.

I use ESPHome and that works even better than Tasmota, because it is directly integrated in HA. At least for a Sonoff RF Bridge 433 (black one). I do not know how the RF Bridge V2 (white one) works.

I have the Sonoff RF Bridge 433 V2. the integration very easy. It lacks the state change/track ability.

Hey @WallyR
Can you define ‘better’? :nerd_face:
I have one black sonoff RF and only a handful of sensors, i never bothered to move to EspHome.
If i ever have time left and feel the need to fiddle, i might, but it works fine like it is now…
(and by now i have way more Esphome devices than RF’s :thinking:)

Maybe sensors are not that big a problem.
I have some remotes and switches that are RF and the Tasmota firmware are slow to rebounce after a command compared to ESPHome.
It takes a few seconds to be able to send the same RF remote code again, if I turn on something that should not have been turn on and it requires the same key for turning it off.
It might also be the MQTT that have an issue with two similar topics received too close to each other.