Sonoff RF Bridge Controlling RF Outlets

I am quite new to Home Assistant and just bought a Sonoff RF Bridge and would like to control some old RF outlets I have that use a 433mhz remote. My ideal use would be that I can control these outlets with the remotes or the HA IOs app or any automations I may dream up in the future.

I flashed the RF Bridge Tasmota and have it so it can control the outlets but I don’t think the state topic is working properly as the switch state doesn’t change when I use the remote and then check it in the frontend. Below is the code I have.

  • platform: mqtt
    name: “Living Room Lamp 2”
    command_topic: cmnd/RF_Bridge/rfcode
    state_topic: “tele/RF_Bridge/RESULT”
    value_template: ‘{{value_json.RfReceived.Data}}’
    availability_topic: “tele/RF_Bridge/LWT”
    payload_available: “Online”
    payload_not_available: “Offline”
    payload_on: “#5455C3
    payload_off: “#5455CC
    optimistic: false
    qos: 1
    icon: mdi:lamp
    retain: false

Hi,
Here is how I did it

In configuration.yaml file, I defined the switch like this:

- platform: mqtt
  name: "RFPlug-1"
  command_topic: cmnd/RF_Bridge/rfcode
  availability_topic: "tele/RF_Bridge/LWT"
  payload_available: "Online"
  payload_not_available: "Offline"
  payload_on: "#0414025"
  payload_off: "#0414026"
  optimistic: true

In Home Assistant, the Switch will appear like this:
image

Hope this helps you in your setup.

Thanks for the information. Believe me I have gone over your posts many times. I do believe I have read all the posts in this forum related to this topic.

Most RF sockets don’t feed back their state so you need to set optimistic: true so HA thinks it switched OK and shows what it thinks the state is in the front end.

1 Like

I am now trying the automation approach as I think I can send the state to mqtt this way as I have seen other people do. I may be wrong who knows. Here is what I have so far and it doesn’t work if anyone has ideas on how to get this to work I would love to hear them. I can’t even get the lights to turn on now as I don’t think it is sending the code.

configuration.yaml
binary_sensor:
- platform: mqtt
state_topic: “tele/RF_Bridge/RESULT”
name: “Living Room Lamp Test”
value_template: ‘{{value_json.RfReceived.Data}}’
payload_on: “5455C3”
payload_off: “54553C”
device_class: light
optimistic: false
qos: 1
retain: false

automations.yaml
- alias: Test Lamp On
hide_entity: false
initial_state: ‘off’
trigger:
- platform: state
entity_id: binary_sensor.living_room_lamp_test
from: ‘off’
to: ‘on’
action:
service: mqtt.publish
data:
topic: tele/RF_Bridge/RESULT
payload: 5455C3

Two people have given you the answer now, if you didn’t want it why did you ask?

1 Like

This part is wrong, your RF Outlet is not a binary_sensor. You need to add it under the switch: section in configuration.yaml

Ok so I have something that sort of works now and would love help getting it to 100%. I’ve setup a binary sensor to trigger an action when it picks up the proper RF frequency off the Sonoff Bridge. The issue I am having is it appears the RF remote doesn’t always send the same data code so it takes multiple pressing of the button until it fires the correct code. These alternate codes seems random as I try other buttons on the remote and I see it will fire the same codes at times.

Second question, is there a way to combine my automation statements into one code? I tried looking at “or” conditions but it looks like they only allow one action.

configuration.yaml

binary_sensor:    
  - platform: mqtt
    name: "RF Remote Button 3"
    payload_on: "5455C3"
    payload_off: '5455CC'
    state_topic: "tele/RF_Bridge/RESULT"
    value_template: '{{ value_json.RfReceived.Data }}'

automations.yaml

- alias: RF Remote State 1
  hide_entity: true
  trigger:
    platform: mqtt
    topic: tele/RF_Bridge/RESULT
  condition:
    condition: template
    value_template: '{{ trigger.payload_json.RfReceived.Data == "5455C3" }}'      
  action:
    service: switch.turn_on
    entity_id: switch.living_room_lamp_2
    
- alias: RF Remote State 2
  hide_entity: true
  trigger:
    platform: mqtt
    topic: tele/RF_Bridge/RESULT
  condition:
    condition: template
    value_template: '{{ trigger.payload_json.RfReceived.Data == "5455CC" }}'      
  action:
    service: switch.turn_off
    entity_id: switch.living_room_lamp_2
1 Like

So after mucking around with this on and off for 10 months I still have issues with identifying the state of the outlets when someone in the house use the RF remote. It is because the remote never sends a consistent code which I have just accepted as the way it is probably for reasons I do not understand.

My new question is can anyone suggest a setup of remote controlled light switches that I can use with HA both from the app and included remote which will capture the state of the outlet regardless?

About the inconsistent codes, there is an issue in Tasmota with technical details: https://github.com/arendst/Tasmota/issues/2095