Downlink message from ThingsBoard to TTN

Hi,
I’ll appreciate some guidance as I have been stuck for two days trying to get my first downlink message to work.

Setup:
So I have about 10 different Dragino sensors defined as End Devices in an application on TTN. The Application is using a MQTT integration with ThingsBoard. I’ve managed to create all the Payload formatters for the Uplink part, and all the data is successfully arriving in the ThingsBoard dashboard.
On the Downlink side, I followed this example TheThingsNetwork Integration.

The Class C device I am attempting to send a Downlink message to, is a LT-22222-L LoRa I/O Controller.

In the TTN Console when I schedule a Downlink message with the Payload of “05 00 11 07 D0” (via the Messaging function), then the LT-22222-L receives the message and the relays activates for 2 seconds. So I know that TTN → LT-22222-L is working.

On the ThingsBoard side, have adapted example mentioned above, and created the Downlink Data Converter. I can see that the following JSON file is sent to the TTN application, when triggered:

{
    "topic": "v3/asgt-tb-demo@ttn/devices/a84041ba31839ccf/down/push",
    "payload": {
        "port": 1,
        "confirmed": false,
        "payload_fields": {
            "type": 5,
            "state": 0,
            "duration1": 7,
            "duration2": 208
        }
    }
}

What I can not get working or figured out, is why I can not see any downlink data arriving in my Application or Device’s “Live data” in the console.

I will really appreciate some pointers or ideas that I can try next. Or if anyone have some examples I can work through.

Thanks in advance.
Jan

Hi Jan,
I am doing the same so if you could give help for the thingsboard part I will be endless thanksfull.
I am still stuck in TTN. When I try to send a JSON test downlink I got always the message “submit failed No script output”
image

It should switch ON/OFF a relais.
When I send the payload using bytes it works without problem.

Problem as usual is in front of the screen…
I need to get different Bytes output for ON/OFF input.
Where is my error, please? When I delete the "IF condition the script is working.
Thanks
function encodeDownlink(input) {
var outputstatus1 = [“ON”, “OFF”];

if (outputstatus1==“ON”) {
return {
bytes: [4,0,1,0,0,0,0,0,0,0],
fPort: 1,
}
}

if (outputstatus1==“OFF”) {
return {
bytes: [4,0,0,0,0,0,1,0,0,0],
fPort: 1,
}
}