# RF Bridge send from UI

**URL:** <https://discourse.nodered.org/t/rf-bridge-send-from-ui/13805>\
**Category:** Dashboard\
**Created:** [29 July 2019 19:28 UTC](https://discourse.nodered.org/t/rf-bridge-send-from-ui/13805 "2019-07-29T19:28:14Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![BrianD](https://avatars.discourse-cdn.com/v4/letter/b/e9c0ed/32.png) [@BrianD](https://discourse.nodered.org/u/BrianD)\
**Post date:** [29 July 2019 19:28 UTC](https://discourse.nodered.org/t/rf-bridge-send-from-ui/13805/1 "2019-07-29T19:28:14Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [29 July 2019 20:52 UTC](https://discourse.nodered.org/t/rf-bridge-send-from-ui/13805/2 "2019-07-29T20:52:37Z")

</div>

> [@BrianD](#):
>
> **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 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.

---

<div class="post-metadata">

**Author:** ![BrianD](https://avatars.discourse-cdn.com/v4/letter/b/e9c0ed/32.png) [@BrianD](https://discourse.nodered.org/u/BrianD)\
**Post date:** [29 July 2019 21:14 UTC](https://discourse.nodered.org/t/rf-bridge-send-from-ui/13805/3 "2019-07-29T21:14:43Z")

</div>

Apologies, flow editor and dashboard.

1. 
  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.

2. 
  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

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [29 July 2019 21:23 UTC](https://discourse.nodered.org/t/rf-bridge-send-from-ui/13805/4 "2019-07-29T21:23:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![BrianD](https://avatars.discourse-cdn.com/v4/letter/b/e9c0ed/32.png) [@BrianD](https://discourse.nodered.org/u/BrianD)\
**Post date:** [29 July 2019 21:48 UTC](https://discourse.nodered.org/t/rf-bridge-send-from-ui/13805/5 "2019-07-29T21:48:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [30 July 2019 05:52 UTC](https://discourse.nodered.org/t/rf-bridge-send-from-ui/13805/6 "2019-07-30T05:52:33Z")

</div>

To send a command you need something like

```auto
[{"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.

---

<div class="post-metadata">

**Author:** ![BrianD](https://avatars.discourse-cdn.com/v4/letter/b/e9c0ed/32.png) [@BrianD](https://discourse.nodered.org/u/BrianD)\
**Post date:** [30 July 2019 11:53 UTC](https://discourse.nodered.org/t/rf-bridge-send-from-ui/13805/7 "2019-07-30T11:53:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [30 July 2019 12:05 UTC](https://discourse.nodered.org/t/rf-bridge-send-from-ui/13805/8 "2019-07-30T12:05:04Z")

</div>

> [@BrianD](#):
>
> I presume the Inject nodes need to reflect these responses.

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

---

<div class="post-metadata">

**Author:** ![BrianD](https://avatars.discourse-cdn.com/v4/letter/b/e9c0ed/32.png) [@BrianD](https://discourse.nodered.org/u/BrianD)\
**Post date:** [30 July 2019 15:24 UTC](https://discourse.nodered.org/t/rf-bridge-send-from-ui/13805/9 "2019-07-30T15:24:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [30 July 2019 15:41 UTC](https://discourse.nodered.org/t/rf-bridge-send-from-ui/13805/10 "2019-07-30T15:41:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![BrianD](https://avatars.discourse-cdn.com/v4/letter/b/e9c0ed/32.png) [@BrianD](https://discourse.nodered.org/u/BrianD)\
**Post date:** [30 July 2019 15:58 UTC](https://discourse.nodered.org/t/rf-bridge-send-from-ui/13805/11 "2019-07-30T15:58:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [30 July 2019 16:06 UTC](https://discourse.nodered.org/t/rf-bridge-send-from-ui/13805/12 "2019-07-30T16:06:29Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![BrianD](https://avatars.discourse-cdn.com/v4/letter/b/e9c0ed/32.png) [@BrianD](https://discourse.nodered.org/u/BrianD)\
**Post date:** [30 July 2019 16:14 UTC](https://discourse.nodered.org/t/rf-bridge-send-from-ui/13805/13 "2019-07-30T16:14:40Z")

</div>

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

No response

---

<div class="post-metadata">

**Author:** ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)\
**Post date:** [30 July 2019 16:32 UTC](https://discourse.nodered.org/t/rf-bridge-send-from-ui/13805/14 "2019-07-30T16:32:20Z")

</div>

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](https://community.home-assistant.io/t/help-with-sonoff-tasmota-rf-bridge-switch-config/85949/2)

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [30 July 2019 16:38 UTC](https://discourse.nodered.org/t/rf-bridge-send-from-ui/13805/15 "2019-07-30T16:38:15Z")

</div>

_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)

```auto
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:

```auto
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.

---

<div class="post-metadata">

**Author:** ![BrianD](https://avatars.discourse-cdn.com/v4/letter/b/e9c0ed/32.png) [@BrianD](https://discourse.nodered.org/u/BrianD)\
**Post date:** [30 July 2019 17:42 UTC](https://discourse.nodered.org/t/rf-bridge-send-from-ui/13805/16 "2019-07-30T17:42:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![BrianD](https://avatars.discourse-cdn.com/v4/letter/b/e9c0ed/32.png) [@BrianD](https://discourse.nodered.org/u/BrianD)\
**Post date:** [30 July 2019 17:52 UTC](https://discourse.nodered.org/t/rf-bridge-send-from-ui/13805/17 "2019-07-30T17:52:02Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [30 July 2019 17:55 UTC](https://discourse.nodered.org/t/rf-bridge-send-from-ui/13805/18 "2019-07-30T17:55:14Z")

</div>

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.
