MQTT downlink from Node-Red

After spending far too much time mucking about I am turning somewhat frustrated to the Forum for help.

I have several different nodes running and happily sending their data to TTN and I visualize this with Node-Red. All fine there.
But now I wish to download some data from Node-Red to one of these nodes, let’s say turn a LED on or off with a particular Byte. (0x11 for ON and 0x10 for OFF).
Sending these Bytes in the TTN downlink Console works fine.
But now I wish to do this from Node-Red and cannot get it done, and hope that the Forum may have some pointers.
My Node-Red flow is as follows. (json attached)flows.json (536 Bytes)

The encoder that I have defined in TTN is:
// encoder function

function Encoder(object, port) {
if (object.led === “LEDON”) {
return [17];
} else if (object.led === “LEDOFF”) {
return [16];
return [0];

Any and all help would be appreciated !

The forum has you but you should search for it yourself before creating a new topic for questions already answered (use the Search option).

MQTT in Node-RED [HowTo]

Also see: How do I format my forum post? [HowTo]

I had already researched that post but didn’t succeed in getting the downlink to work.
I have now gone back to it and modified some properties.
As it turns out const [appId, devId] = flow.get([‘appId’, ‘devId’]); did not operate correctly.
By hard coding the appId and devId it now works.

I can now successfully download data.

Thanks again for your help !

Thanks for your feedback.