How to send RF codes via Sonoff RF 433MHz Bridge/Tasmota?

I have a Sonoff RF Bridge flashed with Tasmota which I am using with alarm sensors. I would also like to use the Bridge to control RF devices (e.g. 433Mhz power sockets), but have been unable to find anything that describes how this can be done (at least not with Tasmota).
Could anyone explain how/if I can send RF commands in HA via the RF Bridge?

https://tasmota.github.io/docs/Commands/#rf-transciever

  action:
  - data:
      payload: 'your_code'
      topic: RF_bridge/cmnd/Rfsend
    service: mqtt.publish

Depending on your mqtt configuration, it might be cmnd/RF_bridge/RfSend

Replace RF_bridge with the name of your bridge.

I have my automation set up as below. I derived the action payload (7B828F) by pressing the remote control for the socket and observing the MQTT message it generated on the Tasmota console.
When I run the actions on this automation (i.e. bypassing the trigger) the socket is not being turned on (and I don’t see anything on the Tasmota console). There was also nothing written to the HA log.

alias: Turn On Socket1
description: ''
trigger:
  - platform: mqtt
    topic: tele/rf-bridge/RESULT
    value_template: Template:Value json.RfReceived.Data
    payload: 773B72
condition: []
action:
  - data:
      payload: 7B828F
      topic: rf-bridge/cmnd/Rfsend
    service: mqtt.publish
mode: single

???

It is either

payload: '773B72'

or

payload: '#773B72'

Use quotes

And I made a mistake, it is RFsend, not Rfsend (bad autocorrect)

I’ve tried these two variants, and neither seem to send an MQTT message. Neither is the trigger recognised from my 433MHz remote (although I do see a message on the Tasmota console when I press the remote).

alias: Turn On Socket1
description: ''
trigger:
  - platform: mqtt
    topic: tele/rf-bridge/RESULT
    value_template: Template:Value json.RfReceived.Data
    payload: '773B72'
condition: []
action:
  - data:
      payload: '7B828F'
      topic: rf-bridge/cmnd/RFsend
    service: mqtt.publish
mode: single
alias: Turn On Socket1
description: ''
trigger:
  - platform: mqtt
    topic: tele/rf-bridge/RESULT
    value_template: Template:Value json.RfReceived.Data
    payload: '#773B72'
condition: []
action:
  - data:
      payload: '#7B828F'
      topic: rf-bridge/cmnd/RFsend
    service: mqtt.publish
mode: single

if you receive on tele/rf-bridge/RESULT, you need

alias: Turn On Socket1
description: ''
trigger:
  - platform: mqtt
    topic: tele/rf-bridge/RESULT
    value_template: Template:Value json.RfReceived.Data
    payload: '773B72'
condition: []
action:
  - data:
      payload: '7B828F'
      topic: cmnd/rf-bridge/RFsend
    service: mqtt.publish
mode: single

alias: Turn On Socket1
description: ''
trigger:
  - platform: mqtt
    topic: tele/rf-bridge/RESULT
    value_template: Template:Value json.RfReceived.Data
    payload: '#773B72'
condition: []
action:
  - data:
      payload: '#7B828F'
      topic: cmnd/rf-bridge/RFsend
    service: mqtt.publish
mode: single

I doubt that value_template does anything useful.

Perhaps what you want is this:

value_template: "{{ value_json.RfReceived.Data }}"

The config below now recognises the trigger, but generates this on the Tasmota console when executed:

11:13:26 MQT: stat/rf-bridge/RESULT = {"Command":"Unknown"}
alias: Turn On Socket1
description: ''
trigger:
  - platform: mqtt
    topic: tele/rf-bridge/RESULT
    value_template: "{{ value_json.RfReceived.Data }}"
    payload: '773B72'
condition: []
action:
  - data:
      payload: '7B828F'
      topic: cmnd/rf-bridge/RFsend
    service: mqtt.publish
mode: single

Seems RFsend if for a generic rftransmitter and the rfbridge works a little different

alias: Turn On Socket1
description: ''
trigger:
  - platform: mqtt
    topic: tele/rf-bridge/RESULT
    value_template: "{{ value_json.RfReceived.Data }}"
    payload: '773B72'
condition: []
action:
  - data:
      payload: '#7B828F'
      topic: cmnd/rf-bridge/RfCode
    service: mqtt.publish
mode: single
3 Likes

That’s it - many thanks!

I am trying to accomplish this so I can send RF codes. I created a switch in HA, however, it’s not sending the code. Any help would be greatly appreciated. Sometimes, you need a fresh set of eyes to look over your code. Thanks in advance. I use the topic: Home/RF_Bridge/RESULT to receive codes and it works fine. I have many RF sensors integrated with HA and all work fine.

This is my switch in my mqtt configuration:

- name: "TestRF"
      state_topic: "Home/RF_Bridge/RESULT"
      command_topic: "cmnd/RF_Bridge/Backlog"
      availability_topic: "Home/RF_Bridge/LWT"
      payload_on: "RfSync 12220; RfLow 440; RfHigh 1210; RfCode #000001"
      payload_off: "RfSync 12220; RfLow 440; RfHigh 1210; RfCode #00000E"
      state_on: "#000001"
      state_off: "#00000E"
      value_template: "{{ value_json.RfCode }}"
      payload_available: "Online"
      payload_not_available: "Offline"
      optimistic: true
      retain: false
      qos: 2

did you get anywhere with this? I am having issues with my mqtt switches, says unavailable.