I am at my wits end, trying to figure out how to properly encode an integer for downlink to a node.
The simple synopsis is that I’d like to send an unsigned short (it’ll be a number under 50,000) to a remote node which will be a sleep interval in seconds. Happy to modify this behavior to minutes if this makes it easier.
The system sending is Linux and will be transmitting via MQTT. The TTN docco states that the packet must be in Base64 format.
If I look at the raw frame from the node to the MQTT bus, I can see that ‘49320’ translates to ‘qMA=’, but I can’t get a return payload to be the same value.
I’m assuming that I need to convert the number into hex, and then into base64, but I am stumped.
Does anyone have any sample code they’re using for a similar task?