Send a downlink message to the end node via node-red

I’m using node-red to send a downlink message to the end node.
The end node, also, sends an uplink message and it works.
For the MQTT down message, I use the same credential o uplink.
The topic has been changed on v3/{application id}@{tenant id}/devices/{device id}/down/replace.

This is the payload:

{"payload":{"f_port":2,"confirmed":false,"schedule":"replace","frm_payload":"AQ=="}}

The frm_payload is the base64 encryption of 0x01.
But nothing seems received by the device.

The command works if sent directly from the TTN console, where the message payload was set to ‘none’.

I’ve read the documentation (for example MQTT Server | The Things Stack for LoRaWAN or MQTT in Node-RED [HowTo]), but without results.
I need some help in order to debug the sent message and those received by the end node (if it receives it).
Thanks for any help.

One more question, how to form a payload if I want to use the downlink payload formatters from the TTN console?

Hi,

my downlink in Node Red looks like this:

value = percent + time;
value = parseInt(value);
msg.topic = "v3/my-id@ttn/devices/my-device/down/replace";
var bytes = [];
bytes[0] = value >> 8;
bytes[1] = value;

    msg.payload = {
        "downlinks": [{
            "f_port": 1,
            "confirmed": false,
            "frm_payload": Buffer.from(bytes).toString('base64'),
            "priority": "HIGH"
            
        }]
    };
    
    return msg;

Hope this helps…

The “tenant id” should be “ttn”.

My payload looks like this (input to MQTT Node):

{“downlinks”:[{“f_port”:1,“frm_payload”:“AQ==”,“priority”:“NORMAL”}]}

Sorry, for my late reply.
Thanks for your answers. It was a trivial syntax error, repeated several times.

I have one more question, how to send a downlink message in JSON format (after setting the payload formatters).