Hello
I have downlink url from uplink request body
and want to post it on postman.
on Application console - device - I sent bytes data to change interval of checking temp.
It work like charm!!!
but wonder how to do it on postman.
I searched it for it but says I should put device id and payload_raw on body.
is it so?
should I put bytes data to payload_raw?
like below?
{
"dev_id": "xxxxxxxxx", // The device ID
"port": 11, // LoRaWAN FPort
"confirmed": false, // Whether the downlink should be confirmed by the device
"payload_fields": { // The JSON object to be encoded by your encoder payload function
0B 81 04 00 00 01 2C
}
}
Alternatively, provide an Encoder function in TTN Console, and pass human-readable values in payload_fields. Like, just as an example, if your encoder would be:
function Encoder(object, port) {
var bytes = [];
// Encode 8 boolean values into a single byte
bytes[0] |= object.my1stBoolean ? 1<<0 : 0;
bytes[0] |= object.my2ndBoolean ? 1<<1 : 0;
bytes[0] |= object.my3rdBoolean ? 1<<2 : 0;
bytes[0] |= object.my4thBoolean ? 1<<3 : 0;
bytes[0] |= object.my5thBoolean ? 1<<4 : 0;
bytes[0] |= object.my6thBoolean ? 1<<5 : 0;
bytes[0] |= object.my7thBoolean ? 1<<6 : 0;
bytes[0] |= object.my8thBoolean ? 1<<7 : 0;
// Unsigned decimal in range from 0 to 655.35, or signed decimal in
// range from -327.68 to +327.67, multiplied by 100 to be sent as
// signed integer; Most Significant Byte first
bytes[1] = (object.my16bitsDecimal * 100)>>8 & 0xFF;
bytes[2] = (object.my16bitsDecimal * 100) & 0xFF;
// 32 bits value, MSB
bytes[3] = object.my24bitsInteger>>24 & 0xFF;
bytes[4] = object.my24bitsInteger>>16 & 0xFF;
bytes[5] = object.my24bitsInteger>>8 & 0xFF;
bytes[6] = object.my24bitsInteger & 0xFF;
return bytes;
}
The screenshot shows you’re using payload_fields instead of payload_raw. The Base64-encoded payload should go into payload_raw. Only use payload_fields if you’ve defined an Encoder in TTN Console.
Your MHgwQjgxMDQwMDAwMDAxRQ== converts to hexadecimal 30783042383130343030303030303145 which is ASCII text. Converting that hexadecimal representation into an ASCII representation gives me0x0B81040000001E again.
So, you’ve encoded twice. That’s wrong.
To send the byte 0x0B you should send a single value, basically the bits00001011. But above you’re sending the human-readable ASCII characters 0 and B, which in hexadecimal notation are the bytes 0x30 and 0x78, or when displayed as bits are 00110000 01111000, so twice as many bits. See also https://www.thethingsnetwork.org/docs/devices/bytes.html
i have dragino lora i/o (LT-33222-L), according to datasheet for activate relay on/of just sending 0x030101 to downlink , i try send downlink via ttn console and it works i can activate on/off relay, but why i can’t activate relay via button in my node-red
im using this json payload format
{
“dev_id”: “dev_dragino”,
“confirmed”: false,
“port”: 2,
“payload_raw”: “AwEB”
}
i can see data on schedule in my downlink but not activate the relay, any idea to solve this?