How to configure HA to send 433MHz RF signals via MQTT through Sonoff's RF-Bridge?

Does anyone send 433MHz RF via MQTT through Sonoff’s RF-Bridge (running Tasmota and Portish-FW) with Home-Assistant?

I want to control 433MHz RF Plugs (simple ones with DIP-Switches, not Intertechno) with Home-Assistant, but I struggle getting the config right.
I can send the signals and switch the plugs via Tasmota’s Webui-Buttons and via Tasmota Console commands !

Any hints or examples how to configure Home-Assistant ?

I tried several config block examples from the forum without success, f.e. the following blocks did not send rf signals:

switch:
  - platform: mqtt
    name: "Light 1"
    state_topic: "cmnd/rfbridge/RESULT"
    command_topic: "cmnd/rfbridge/Backlog"
    payload_on: "RfSync 9520; RfLow 320; RfHigh 910; RfCode #41551F"
    payload_off: "RfSync 9520; RfLow 290; RfHigh 910; RfCode #415514"
    optimistic: true
    icon: mdi:lightbulb
  - platform: mqtt
    name: "Light 2"
    command_topic: "cmnd/rfbridge/RFCODE"
    availability_topic: "tele/rfbridge/LWT"
    payload_available: "Online"
    payload_not_available: "Offline"
    payload_on: "#414551"
    payload_off: "#414554"
    optimistic: true
    icon: mdi:lightbulb

In your automation

action:
  - data:
      payload: '#414551'
      topic: cmnd/rfbridge/RfCode
    service: mqtt.publish
1 Like

Thank you, but I want a switch to work … it should be possible to send RFCodes via MQTT with a webui-switch.
I haven’t got any automations yet !

First you create a binary_sensor :

- platform: mqtt
  name: 'light2'
  state_topic: 'tele/RF_Bridge/RESULT'
  value_template: >-
    {% if value_json.RfReceived.Data == '414551' %}
      {{'ON'}}
    {% elif value_json.RfReceived.Data == '414554' %}
      {{'OFF'}}
    {% else %}
      {{states('binary_sensor.light2') | upper}}
    {% endif %}
  device_class: Plug

Then you create your switch:

 - platform: template
    switches:
      light_2:
        value_template: "{{ is_state('binary_sensor.light2', 'on') }}"
        turn_on:
          - service: mqtt.publish
            data:
              payload: '#414551'
              topic: cmnd/rfbridge/RfCode

        turn_off:
          - service: mqtt.publish
            data:
              payload: '#414554'
              topic: cmnd/rfbridge/RfCode

Just not sure if you need to publish with or without #

Check this topic :

Thank you… but I did not get it to work.

I even don’t really know what to send via MQTT with f.e. mosquitto_pub CLI-command to switch my 433MHz-Plugs via Sonoff RF Bridge… I mean for testing if switching via MQTT actually works without Homeassistant.
I don’t know how to proceed :frowning:

Use Node Red - It’s much more intuitive with such automations.

For testing you can just use the Mqtt topic in HA under developer tools.

Ok, I can switch my plugs via MQTT like this:

# mosquitto_pub -h 172.16.42.40 -u mqtt -P "***" -t rfbridge/cmnd/RfCode -m '#414551' -d

# mosquitto_pub -h 172.16.42.40 -u mqtt -P "***" -t rfbridge/cmnd/RfCode -m '#414554' -d

Next step is translating that correctly to HA !

I modified what francisp provided above and it works somehow, but not reliable.
And the UI-switch goes back to off after a second or so… some fine tuning is required now.

  - platform: mqtt
    name: 'light2'
    state_topic: 'tele/rfbridge/RESULT'
    value_template: >-
      {% if value_json.RfReceived.Data == '414551' %}
        {{'ON'}}
      {% elif value_json.RfReceived.Data == '414554' %}
        {{'OFF'}}
      {% else %}
        {{states('binary_sensor.light2') | upper}}
      {% endif %}
    off_delay: 0
    device_class: light
    qos: 1

  - platform: template
    switches:
      light_2:
        value_template: "{{ is_state('binary_sensor.light2', 'on') }}"
        turn_on:
          - service: mqtt.publish
            data:
              payload: '#414551'
              topic: rfbridge/cmnd/RfCode
        turn_off:
          - service: mqtt.publish
            data:
              payload: '#414554'
              topic: rfbridge/cmnd/RfCode
1 Like

You can also check this topic Easier way to define mqtt rflink switch? , it is not about the rfbridge (but an rflink), but the principle is the same

Now that I think about it, since you have a rf switch with both an off and on signal, you should take the off_delay out… The switch should only go out when it receives the off signal, not after 0 or 2 seconds.

1 Like

Actually off_delay was absent before, I tried to disable the off_delay with “off_delay: 0”, but I’m actually not quite sure if it works like that.

It does not matter if off_delay is there or not, the switch in the Web-UI turns off after 2 or 3 seconds automatically.
How can I disbale this behaviour so that the switch stays in its position ?

Just remove the line with off_delay entirely.

It is easy to debug. Just use mqtt fx, mqtt explorer, mqtt lens or even mosquitto_sub to monitor the received mqtt messages. When you receive ‘414551’, your light2 should switch to ‘ON’ (check under developer tools, states), and stay on as long as no ’ 414554’ is received.

Same for off : your light2 should switch to ‘OFF’ when ‘414554’ is received, and stay off as long as no ‘414551’ is received.

I just learned my relay the dafult rf bridge code of two of the sixteen buttons(one for “on” and one for “off”)
and then created a simple switch
Not sure if the availability code is correct. But the command works fine

- platform: mqtt
    name: "rf_bridge"
    state_topic: "stat/RF_Bridge/RfKey1"
    command_topic: "cmnd/RF_Bridge/RfKey1"
    availability_topic: "tele/RF_Bridge/LWT"
    qos: 1
    payload_on: "Default sent"
    payload_available: "Online"
    payload_not_available: "Offline"
    retain: false

Francis

quick question: if I have CO Gas sensor which only receives signal in rfraw166 or rfraw177 does it mean the sonoff bridge has to stay all the time in that mode?

I have few devices which work in rfraw 0 but only this new device would work only in rfraw 166. Do I need two sonoff bridges?

I don’t know. None of my rf bridges run portisch firmware. I guess you will have to try it out.

Hey everyone, I have a newer version of the Sonoff RF bridge board, R2 v2.2, which has a different configuration than past versions. While I was able to flash Tasmota using this guide:
https://tasmota.github.io/docs/devices/Sonoff-RF-Bridge-433/

I was not able to figure out which pins to connect to flash Portisch.

Any help that could be provided would be greatly appreciated, and we could use any information gleaned here to update the guide for this device.

Here are images of the new board.

Is that the one in the white box ?

Yes, this new version comes in the white chassis.

Portisch Firmware has been abandoned for a number of years. Honestly you’re probably better off trying to make it work on stock firmware or buying a different device like RM Pro4.