RF Bridge send from UI

I have installed Node-Red on a raspberry pi 3B using Peter Scargill's script. I have been successful in reading 433 RF output from PIR, door bell and magnetic switch sensors using the Sonoff Bridge which has tasmota firmware installed. I have been able to use the mqtt console from the RFbridge output (using rules) in the Node-Red dashboard and UI. Unfortunately I am completely stuck with sending mqtt from the dashboard or the UI. I have set up 2 of the RF Bridge tasmota rfkeys and they work well with an external RF switch receiver. Any suggestions or examples where 'sending' from Node-Red has been successful?

I don't understand, does it work or not ?

What do you mean with 'Node-Red dashboard and UI' - the flow editor and the dashboard ?
Little steps.

  1. You can receive data via mqtt.
  2. You want to send data via mqtt, triggered from the dashboard (?)

Note that the devices you've listed only send data, they don't receive. And node-red cannot send, it is not an RF bridge.

Apologies, flow editor and dashboard.

    1. You can receive data via mqtt.
      Yes - On the rfbridge console I can receive (read) RF sensor data and then use it in nodes in the Dashboard. For instance I can receive the mqtt code from my doorbell and then turn on a light and send myself an email. Works fine.
    1. You want to send data via mqtt, triggered from the dashboard (?)
      Yes I would like to turn on a light which is controlled by a RF remote switch (the code from which I can read in the RFBridge console. This is where i'm stuck.
      Brian

So in short you want to trigger a light ? How is that light controlled ?

The light (250volt) is plugged into an RF controlled socket. A battery powered remote unit sends the code to the socket to turn on/off. I can read the code in the RFbridge mqtt console. I would like to use node-red to send the mqtt code to the socket via the RFbridge. Hope this makes some sense.

Brian

To send a command you need something like

[{"id":"87e20f35.508fb","type":"inject","z":"3f613818.2c1a","name":"","topic":"light/cmnd/POWER","payload":"on","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":315,"y":275,"wires":[[]]},{"id":"65a8bbdf.c86ee4","type":"inject","z":"3f613818.2c1a","name":"","topic":"light/cmnd/POWER","payload":"off","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":315,"y":325,"wires":[[]]}]

2 inject nodes, on and off with a topic, you need to modify it so that it matches your device.
Connect it to a configured mqtt output node (leave the topic empty).

Once that is working, you can look at the dashboard.

Thanks for your helpful replies.
Close but no cigar.
Here is the simple rle I have set up on the RFbridge console -
rule3 on rfreceived#Data=49E341 do publish rfbridge/switch ON endon

When I press the remote switch manually I get this response in the console -
12:49:22 MQT: rfbridge/switch = ON
12:49:25 MQT: rfbridge/tele/RESULT = {"RfReceived":{"Sync":12540,"Low":440,"High":1240,"Data":"EF610E","RfKey":"None"}}

I presume the Inject nodes need to reflect these responses.

Brian

Have you tried??
I would guess the initial bit is the MQTT topic and the bit after = is the payload...

No success. I just can't get the Inject Nodes to trigger a response in the RFBridge.
MQTT topic - rfbridge/switch
payload - ON
I'm missing something.

You have set up a rule on the bridge to handle incoming rf Where/what is the rule you have setup to handle outgoing ?

Here is the rule -
rule3 on rfreceived#Data=49E341 do publish rfbridge/switch ON endon

Ok you receive a code from your remote. What does rfbridge/switch ON do ?
Normally you would send a command like cmnd/light/power on to a device to turn on. Or trigger some mqtt topic where a subscriber is listening.

How do you turn on your light from the rfbridge console with mqtt ?

17:13:36 CMD: rfbridge/switch ON
17:13:37 MQT: rfbridge/stat/RESULT = {"Command":"Unknown"}

No response

I think you can find the solution from this thread https://community.home-assistant.io/t/help-with-sonoff-tasmota-rf-bridge-switch-config/85949/2

Edit.

I have a sonoff bridge, but never actually send commands from it, as I only receive information from devices.

Some looking around how to actually send commands, easiest is a function node (mainly for readability)

t = "cmnd/sonoff-rf-bridge/backlog"
o = "RfSync 11960; RfLow 380; RfHigh 1150; RfCode #444CC5"
return {topic:t,payload:o}

t is the topic, could be different in your case, but the 'backlog' is the key for getting the bridge to process it. in my case cmnd comes first, but out-of-the-tasmota-box it is something like bridge/cmnd.

You need to determine the Rf values. (like the one you mentioned above - {"Sync":12540,"Low":440,"High":1240,"Data":"EF610E","RfKey":"None"}})

You need to have an on/off possibility, so you could use 2 inject nodes with a string 'on' and the other 'off' and in the function node use something like:

t = "cmnd/sonoff-rf-bridge/backlog"
m = msg.payload
if (m==="on"){
 o = "RfSync 11960; RfLow 380; RfHigh 1150; RfCode #444CC5"
} 
else{
o = "RfSync 11960; RfLow 380; RfHigh 1150; RfCode #45568C"
}
return {topic:t,payload:o}

Connect the function node to an mqtt node and click on/off, device should turn on/off (just tried it with a fan.

Many thanks to all who responded. I'm not there yet but will use your ideas to solve the problem.
Brian

Well it works - thankyou NiPi!
I entered the code in the inject node payload - #49E341
No topic entered.
In the MQTT Output node I entered - rfbridge/cmnd/RFCODE as the topic entry
QoS 1
Retain True

Works a treat. Thanks again to all.

1 Like

Good news!

No topic entered.

In the MQTT Output node I entered - rfbridge/cmnd/RFCODE as the topic entry

Either one would work. Advantage for specifying the topic is to reduce the number of mqtt output nodes as you would only need 1.