# MQTT Commands using Sonoff RFbridge

**URL:** https://discourse.nodered.org/t/mqtt-commands-using-sonoff-rfbridge/89102
**Category:** General
**Tags:** home-assistant
**Created:** [30 June 2024 08:15 UTC](https://discourse.nodered.org/t/mqtt-commands-using-sonoff-rfbridge/89102 "2024-06-30T08:15:10Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![trevorf](https://avatars.discourse-cdn.com/v4/letter/t/cdc98d/32.png) [@trevorf](https://discourse.nodered.org/u/trevorf)
#### Post date: [30 June 2024 08:15 UTC](https://discourse.nodered.org/t/mqtt-commands-using-sonoff-rfbridge/89102/1 "2024-06-30T08:15:10Z")

</div>

Hi Gents,

My Setup is Home Assistant with RFbridge sonoff's flashed with tasmota and node red

I have an issue with my TV turning off and wanted to setup some debugging so I made my first dashboard.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/b/2b9b8e0da51cb3989d8353db49fb86ada1f2cfcd.png)

I am logging the data successfully however I want to send the commands back to MQTT for testing.

I have tried to send MQTT commands back but I keep getting "unknown" in the tasmota console window

I have attached the flow

Any help is appreciated.. I am new to Node-red so please be gentle.

```auto
[
    {
        "id": "6a1c4d7ea62a4d37",
        "type": "mqtt in",
        "z": "7ca8e2354b84ce02",
        "name": "",
        "topic": "tele/RFBridge/RESULT",
        "qos": "2",
        "datatype": "utf8",
        "broker": "eaa4d8b141fa9c52",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 320,
        "y": 200,
        "wires": [
            [
                "563a4b823b639882",
                "ef39177b77b03f9c",
                "6768d6a6f599060c"
            ]
        ]
    },
    {
        "id": "563a4b823b639882",
        "type": "csv",
        "z": "7ca8e2354b84ce02",
        "name": "",
        "spec": "rfc",
        "sep": ",",
        "hdrin": "",
        "hdrout": "none",
        "multi": "mult",
        "ret": "\\r\\n",
        "temp": "Date, RFReceived, Low, High, Rfkey",
        "skip": "0",
        "strings": true,
        "include_empty_strings": "",
        "include_null_values": "",
        "x": 670,
        "y": 200,
        "wires": [
            []
        ]
    },
    {
        "id": "eb855c4801bda466",
        "type": "debug",
        "z": "7ca8e2354b84ce02",
        "name": "debug 2",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1140,
        "y": 260,
        "wires": []
    },
    {
        "id": "4ad7f1e0258f7265",
        "type": "file",
        "z": "7ca8e2354b84ce02",
        "name": "",
        "filename": "\\home\\trevor\\logfile.txt",
        "filenameType": "str",
        "appendNewline": true,
        "createDir": false,
        "overwriteFile": "false",
        "encoding": "none",
        "x": 960,
        "y": 240,
        "wires": [
            []
        ]
    },
    {
        "id": "c15690726f4b0f78",
        "type": "exec",
        "z": "7ca8e2354b84ce02",
        "command": "tail",
        "addpay": "payload",
        "append": "-n 20",
        "useSpawn": "true",
        "timer": "",
        "winHide": false,
        "oldrc": false,
        "name": "",
        "x": 650,
        "y": 400,
        "wires": [
            [
                "bb03d8a64b4b6b71",
                "ef39177b77b03f9c"
            ],
            [],
            []
        ]
    },
    {
        "id": "bb03d8a64b4b6b71",
        "type": "ui_template",
        "z": "7ca8e2354b84ce02",
        "group": "2c79b12a6d1dac2d",
        "name": "",
        "order": 3,
        "width": 0,
        "height": 0,
        "format": "<div ng-bind-html=\"msg.payload\"></div>",
        "storeOutMessages": true,
        "fwdInMessages": true,
        "resendOnRefresh": true,
        "templateScope": "local",
        "className": "",
        "x": 880,
        "y": 400,
        "wires": [
            []
        ]
    },
    {
        "id": "241bfb45f0f0f19c",
        "type": "watch",
        "z": "7ca8e2354b84ce02",
        "name": "",
        "files": "\\home\\trevor\\logfile.txt",
        "recursive": "",
        "x": 280,
        "y": 400,
        "wires": [
            [
                "c15690726f4b0f78"
            ]
        ]
    },
    {
        "id": "ef39177b77b03f9c",
        "type": "debug",
        "z": "7ca8e2354b84ce02",
        "name": "debug 3",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 880,
        "y": 340,
        "wires": []
    },
    {
        "id": "1ca2369724608a47",
        "type": "inject",
        "z": "7ca8e2354b84ce02",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "Sync 16380; Low 480; High 1540; RFcode #5848B2_off",
        "payloadType": "str",
        "x": 690,
        "y": 480,
        "wires": [
            [
                "2f688218727ee3b0"
            ]
        ]
    },
    {
        "id": "6768d6a6f599060c",
        "type": "function",
        "z": "7ca8e2354b84ce02",
        "name": "function 1",
        "func": "msg.payload = msg.payload+'<br>'\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 740,
        "y": 240,
        "wires": [
            [
                "4ad7f1e0258f7265"
            ]
        ]
    },
    {
        "id": "2f688218727ee3b0",
        "type": "mqtt out",
        "z": "7ca8e2354b84ce02",
        "name": "",
        "topic": "cmnd/RFBridge/Backlog",
        "qos": "",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "eaa4d8b141fa9c52",
        "x": 1030,
        "y": 480,
        "wires": []
    },
    {
        "id": "f965baa645f533a6",
        "type": "ui_text_input",
        "z": "7ca8e2354b84ce02",
        "name": "",
        "label": "",
        "tooltip": "",
        "group": "2c79b12a6d1dac2d",
        "order": 3,
        "width": 0,
        "height": 0,
        "passthru": true,
        "mode": "text",
        "delay": 300,
        "topic": "topic",
        "sendOnBlur": true,
        "className": "",
        "topicType": "msg",
        "x": 920,
        "y": 600,
        "wires": [
            [
                "2f688218727ee3b0"
            ]
        ]
    },
    {
        "id": "761f3f63e9447c88",
        "type": "inject",
        "z": "7ca8e2354b84ce02",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "Sync 16380; Low 480; High 1540; RFcode #5848B2",
        "payloadType": "str",
        "x": 690,
        "y": 520,
        "wires": [
            [
                "2f688218727ee3b0"
            ]
        ]
    },
    {
        "id": "eaa4d8b141fa9c52",
        "type": "mqtt-broker",
        "name": "",
        "broker": "192.168.1.138",
        "port": "1883",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "autoUnsubscribe": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthRetain": "false",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closeRetain": "false",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willRetain": "false",
        "willPayload": "",
        "willMsg": {},
        "userProps": "",
        "sessionExpiry": ""
    },
    {
        "id": "2c79b12a6d1dac2d",
        "type": "ui_group",
        "name": "Default",
        "tab": "7c77d1e0731f7abc",
        "order": 1,
        "disp": true,
        "width": 22,
        "collapse": false,
        "className": ""
    },
    {
        "id": "7c77d1e0731f7abc",
        "type": "ui_tab",
        "name": "Home",
        "icon": "dashboard",
        "disabled": false,
        "hidden": false
    }
]

```

---

<div class="post-metadata">

### Author: ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)
#### Post date: [30 June 2024 09:17 UTC](https://discourse.nodered.org/t/mqtt-commands-using-sonoff-rfbridge/89102/2 "2024-06-30T09:17:05Z")

</div>

Hello @trevorf and welcome to the forum.

From your flow:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/9/79acb9340285b49277f5ff31564acebb87af0b06.png)

According to the [Tasmota commands documentation](https://tasmota.github.io/docs/Commands/#rf-bridge), the RF Bridge commands you need are `RfSync`, `RfCode`, `RfLow` and `RfHigh` not `Sync`, `Low`, etc.

ps commands are case insensitive so your RFcode should work for RfCode.

---

<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 June 2024 10:40 UTC](https://discourse.nodered.org/t/mqtt-commands-using-sonoff-rfbridge/89102/3 "2024-06-30T10:40:21Z")

</div>

Those values differ per keypress for the same key.  
OP first needs to put the bridge into learning mode and assign the RfKeys, then it can be captured based on the RfKey.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [28 September 2024 10:41 UTC](https://discourse.nodered.org/t/mqtt-commands-using-sonoff-rfbridge/89102/4 "2024-09-28T10:41:04Z")

</div>

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