Sending MQTT to RF Bridge

Hi,
i am very new to MQTT and Node-Red but i managed it already to setup some simple commands for controlling my WiFi Power-Switches with

Topic: myDevice/cmnd/Power
Payload: ON or OFF

This was easy, but know i am stuck with my RF Bridge, where i want to send the appropriate cmnd to RF-devices via MQTT and bridge.
What i see, when i monitor the payload sended by the bridge when pressing a button on my RF remote control is something like this:

{„Time":"2020-08-13T09:41:37","RfReceived":{"Sync":11520,"Low":410,"High":1070,"Data":"000014","RfKey":"None"}}

I assume that "DATA":""000014" is the specific part of the command, but how would i construct the whole payload to generate the same RF-cmd via the bridge for the RF-device?

Could someone help me out with an example!

Thanks

The easiest way is to first learn/assign a RfKey for your device.
Once learned you send a RfKey command via mqtt.

To set this up, go to the console of the bridge, enter:

RfKey1 2       // key1 and 2 means learning mode 

The bridge will go into learning mode for key1 (red LED on the bridge)
See documentation.

Press the remote control (single button)

Look at the console, it should have learned the button.

Go back to the homepage and click the button, your device should respond.
Repeat for all the buttons (RfKey2 2, RfKey3 2 etc)

In node red you can now use send the key "press" via mqtt with a topic of cmnd/yourbridge/RfKey<x> where <x> is the key you programmed, no payload.

Note that you can send the low/high/data also via separate topics, all combined which will also trigger your device, but in a convoluted way.

Hi,

thank you so much for your answer!

Actually i tried this already via MQTT commands via Node-Red and it showed no success,
The bridge seems to send an RF signal (red LED) but it shows no reaction on my decice.
I did the same now with the console, as you proposed. See the log below:

18:47:40 CMD: RfKey1 2
18:47:40 MQT: Sonoff/RFBridge/RESULT = {"RfKey1":"Start learning"}
18:47:43 MQT: Sonoff/RFBridge/RESULT = {"RfKey1":"Learned"}
18:48:06 CMD: RfKey2 2
18:48:06 MQT: Sonoff/RFBridge/RESULT = {"RfKey2":"Start learning"}
18:48:08 MQT: Sonoff/RFBridge/RESULT = {"RfKey2":"Learned"}
18:48:39 MQT: Sonoff/RFBridge/RESULT = {"RfKey1":"Learned sent"}
18:48:42 MQT: Sonoff/RFBridge/RESULT = {"RfKey1":"Learned sent"}
18:48:44 MQT: Sonoff/RFBridge/RESULT = {"RfKey1":"Learned sent"}
18:48:45 MQT: Sonoff/RFBridge/RESULT = {"RfKey2":"Learned sent"}
18:48:46 MQT: Sonoff/RFBridge/RESULT = {"RfKey1":"Learned sent"}
18:48:47 MQT: Sonoff/RFBridge/RESULT = {"RfKey1":"Learned sent"}
18:48:49 MQT: Sonoff/RFBridge/RESULT = {"RfKey1":"Learned sent"}
18:48:50 MQT: Sonoff/RFBridge/RESULT = {"RfKey1":"Learned sent"}
18:48:51 MQT: Sonoff/RFBridge/RESULT = {"RfKey1":"Learned sent"}
18:48:52 MQT: Sonoff/RFBridge/RESULT = {"RfKey1":"Learned sent"}
18:48:54 MQT: Sonoff/RFBridge/RESULT = {"RfKey2":"Learned sent"}
18:48:56 MQT: Sonoff/RFBridge/RESULT = {"RfKey1":"Learned sent"}
18:48:57 MQT: Sonoff/RFBridge/RESULT = {"RfKey2":"Learned sent“}

but again no reaction on my RF-device.

I red on some other posts that the red LED should blink rapidly after "Start learning“ but my bridge only beeps once (and does also after „Learned“).

I assumed, and tried also, that it is possible to send the Code directly via MQTT (what you call the convoluted way!?), something like:
cmnd/RfSend:{"Sync":11560,"Low":390,"High":1100,"Data":"000014","RfKey":"None"}
but this fails also with "{"Command":"Unknown"}".

Do you know, how to send a specific code back for transmitting?

It says learned, but didnt actually do anything.

Another way is to store the signal is by using backlog, in console paste:

backlog rfsync 11520; rflow 410 rfhigh 1070; rfcode #000014; rfkey1 4

If this signal comes in, it is mapped to key 1.

Note - the signal needs these exact values, good to press the same button a couple of times to see if they always match.

do i have to transmit the RF signal from my remote control again after backlog?
I tried also this, but did not help.
I get the suspicion that something is wrong with my hardware.
Unfortunately i have no other RF device to check.

Once you set the backlog command, you should be able to do:

rfkey1 6

if your device responds, you can use mqtt from node red. (cmnd/yourbridge/RfKey1 payload: 6)

Note, you are not alone with problems sending commands. There are many issues described on github about this. It might just not work.

I don't know!
Receiving RF-signals works fine but sending seems difficult.
I guess the parameters might be quite specific and will not be requognized if not exact (RFSync, RFLow, RFHigh).

By the way, you and others always propose the format of the MQTT topic like this:

cmnd/myDevice/RFKey1 (cmnd in front!)

But this does not work for me in Node-Red!? I have to write like this:

myDevice/cmnd/RFKey1 (cmnd before Payload!?)

Why this difference?

Why this difference?

because you changed the default mqtt prefix in tasmota ?

Please follow the tasmota documentation, there is lots of information in there, also in regard to the rfbridge.

I see that i made a typo here, it should be:

backlog rfsync 11520; rflow 410; rfhigh 1070; rfcode #000014; rfkey1 4

OK, here my 2 cent:

My RM mini is flashed with Tasmota 8.3.1 and I named it tasmotaIR1

With a MQTT in-node I check for changes:

tele/tasmotaIR1/RESULT

If you connect this node to a debug node and also check the console in the tasmota webinterface, you get strings like

{"Protocol":"RC6","Bits":36,"Data":"0xC800F...
{"Protocol":"SAMSUNG","Bits":32,"Data":"0xE0E0...

I use an old Microsoft remote control to switch on/off lights etc. so I check the input of the remote control with the above MQTT in node and afterwards in a switch node I check for msg.payload "contains" these strings (just the start which never changes for this remote control) and after converting the JSON payload to a Javascript object with the json node I check in another switch node msg.payload.IrReceived.Data "contain" small snippets of strings which stay the same every keypress of the remote control.
In my case it was always a three-digit-code for each keypress, which changed in the complete string.

To control devices via IR I use the debug node, mentioned above to get the correct string and send this string to a MQTT out node with topic cmnd/tasmotaIR1/IRSend with the correct JSON-formated string in the payload.

Hi Stefan24,

after some time i tried again and with the learning RfKey methode i succeded finally with simply sending

cmnd/myRFBridge/RfKey1
payload: 6

I guess i achieve the same result that with directly sending with "backlog" as stated above!

I have a final questions regarding your post.
It seems to me you have a different device because your response looks very different from mine.
Is yours an InfroRed bridge?

I don't us the rfKey method at all as it's limited to 16, that's just 8 devices (ON/OFF)

I just watch the console when pressing the remote buttons and note the values of rfSync, rfLow, rfHigh and rfcode then inject an array containing these values into a series of change nodes connected to a MQTT out node. Works a treat. Have a look at the flow below:

[{"id":"1f74cd3c.990323","type":"mqtt out","z":"5542a8a0.2ca958","name":"","topic":"","qos":"","retain":"","broker":"33b374f4.96a50c","x":790,"y":460,"wires":[]},{"id":"7a82df4b.03e23","type":"inject","z":"5542a8a0.2ca958","name":"On","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"num","x":90,"y":500,"wires":[["85828f1b.1d25e"]]},{"id":"96bcea02.0e7f28","type":"change","z":"5542a8a0.2ca958","name":"rfSync","rules":[{"t":"set","p":"payload","pt":"msg","to":"rfcmnd[0]","tot":"msg"},{"t":"set","p":"topic","pt":"msg","to":"cmnd/rfbridge1/rfSync","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":420,"wires":[["4dcd768f.3462e8","1f74cd3c.990323"]]},{"id":"4dcd768f.3462e8","type":"change","z":"5542a8a0.2ca958","name":"rfLow","rules":[{"t":"set","p":"payload","pt":"msg","to":"rfcmnd[1]","tot":"msg"},{"t":"set","p":"topic","pt":"msg","to":"cmnd/rfbridge1/rfLow","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":460,"wires":[["a90310e5.3cc07","1f74cd3c.990323"]]},{"id":"a90310e5.3cc07","type":"change","z":"5542a8a0.2ca958","name":"rfHigh","rules":[{"t":"set","p":"payload","pt":"msg","to":"rfcmnd[2]","tot":"msg"},{"t":"set","p":"topic","pt":"msg","to":"cmnd/rfbridge1/rfHigh","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":500,"wires":[["e61e8605.bb05b8","1f74cd3c.990323"]]},{"id":"e61e8605.bb05b8","type":"change","z":"5542a8a0.2ca958","name":"rfcode","rules":[{"t":"set","p":"payload","pt":"msg","to":"rfcmnd[3]","tot":"msg"},{"t":"set","p":"topic","pt":"msg","to":"cmnd/rfbridge1/rfcode","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":540,"wires":[["1f74cd3c.990323"]]},{"id":"85828f1b.1d25e","type":"change","z":"5542a8a0.2ca958","name":"Dishwasher ON ","rules":[{"t":"set","p":"rfcmnd","pt":"msg","to":"[5380,170,530,\"#155533\"]","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":320,"y":500,"wires":[["96bcea02.0e7f28"]]},{"id":"d311681e.acd6b8","type":"change","z":"5542a8a0.2ca958","name":"Dishwasher OFF","rules":[{"t":"set","p":"rfcmnd","pt":"msg","to":"[5350,180,530,\"#15553C\"]","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":330,"y":540,"wires":[["96bcea02.0e7f28"]]},{"id":"56bb2280.88bd7c","type":"inject","z":"5542a8a0.2ca958","name":"Off","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"num","x":90,"y":540,"wires":[["d311681e.acd6b8"]]},{"id":"a6452426.d99e28","type":"link in","z":"5542a8a0.2ca958","name":"dwo","links":["7af67686.7051a8"],"x":195,"y":480,"wires":[["85828f1b.1d25e"]]},{"id":"ac5dcd52.90357","type":"link in","z":"5542a8a0.2ca958","name":"dwoff","links":["120e5a59.698036"],"x":195,"y":520,"wires":[["d311681e.acd6b8"]]},{"id":"ce789c2c.5febc","type":"inject","z":"5542a8a0.2ca958","name":"On","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"num","x":90,"y":400,"wires":[["d5ba286f.4b3a68"]]},{"id":"d5ba286f.4b3a68","type":"change","z":"5542a8a0.2ca958","name":"Tumbledryer ON ","rules":[{"t":"set","p":"rfcmnd","pt":"msg","to":"[5380,170,530,\"#1555C3\"]","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":320,"y":400,"wires":[["96bcea02.0e7f28"]]},{"id":"8e3dd12c.7093a","type":"change","z":"5542a8a0.2ca958","name":"Tumbledryer OFF","rules":[{"t":"set","p":"rfcmnd","pt":"msg","to":"[5350,180,530,\"#1555CC\"]","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":330,"y":440,"wires":[["96bcea02.0e7f28"]]},{"id":"f7121559.3471d8","type":"inject","z":"5542a8a0.2ca958","name":"Off","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"num","x":90,"y":440,"wires":[["8e3dd12c.7093a"]]},{"id":"fdd5a509.f6e5f8","type":"link in","z":"5542a8a0.2ca958","name":"tdon","links":["21592798.5624a8"],"x":195,"y":380,"wires":[["d5ba286f.4b3a68"]]},{"id":"443e9e9e.ae188","type":"link in","z":"5542a8a0.2ca958","name":"tdoff","links":["5d9ff029.92c2e"],"x":195,"y":420,"wires":[["8e3dd12c.7093a"]]},{"id":"33b374f4.96a50c","type":"mqtt-broker","z":"","name":"","broker":"192.168.1.2","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

[edit] ignore the link nodes!!

1 Like

Yes, it is this RM mini, bought at Amazon.de: https://www.amazon.de/dp/B07MGR1YJX/ref=cm_sw_em_r_mt_dp_9eatFbHXS0Q4P
I flashed Tasmota 2 minutes after unpacking :smile:

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.