The data you’re seeing has already been decrypted by TTN and are hexadecimal representations of the decrypted “binary data”, each two digits being one “byte”, just like sent by your node. The bytes could be anything: like numbers, text, some special encoding of the states of some switches, and so on. And any combination. You’ll need to decode that, to reverse the encoding that your node used.
In your example, that binary data happens to be plain ASCII text (readable text; not recommended, as it uses a lot of bandwidth).
So, in your case each byte is one text character: hexadecimal 0x48
(which is the same as decimal 72, and is written with the 0x
prefix to make clear it’s not the decimal number 48) is the character H
. Likewise, 0x65
is e
, 0x6c
is l
, and so on. For the number, 0x31
is the character 1
, 0x32
is the character 2
, and so.
The above needs 5 bytes to send the number 12345
as text. That’s a lot of waste, as by design numbers only have digits 0 to 9, and possibly one decimal point and one sign, while ASCII text also reserves space for upper case and lower case letters, punctuation characters, and so on.
When knowing you only need a number, then when sending in a dedicated binary format you would, for example, only need 16 bits (2 bytes) for a so-called “short signed integer”, which can hold all numbers between -32,767 and +32,767. And a 32 bits (4 bytes) integer (a.k.a. “long”) fits all numbers between -2,147,483,647 and +2,147,483,647, which when sent as characters (without the commas) would need as many as 11 bytes for one number.
If, for testing, you really want to send plain text and decode that into a readable format, then there are many online converters, or you’d need a payload function:
function Decoder(bytes, port) {
// Decode plain text; for testing only
return {
myTestValue: String.fromCharCode.apply(null, bytes)
};
}
After that, see https://github.com/TheThingsNetwork/workshops#send-sensor-data to learn how to send the data in better format.