I took a few hours and implemented the ttn-send utility I described above. What I did was to clone the standard lmic base and created YAGP (yet another git project) and did some modifications to the thethingsnetwork-send-v1 example. The executable now runs a socket server and receives strings from the ttn-send client program and sends them out during the upload cycle.
An example run is this:
Start the lmic core and a socket server listening on port 8877:
./thethingsnetwork-send-v1 -p 8877 &
Send strings to the server:
./send-ttn -p 8877 -h 127.0.0.1 -a 70B3D57ED0012BD2 -d 0047F5BD541A3688 -n 760A9100DF266D853F42EAFE47B81530 -s 3BDCBA20FE2F99B9A1A2FAD989B0A520 -e 2602119A -x 010203040506
p - port of server
h - host of server
a - appeui
d - deveui
n - network key
s - session key
e - devaddr of node
x - arbitrary string of hex bytes to send
Given the above input it should send the bytes 010203040506 to TTN:
The repo is here:
I also messed with the frequencies in lorabase.h because the Dragino hat doesn’t seem to be frequency hopping correctly (or lmic isn’t doing it right). I also have it configured for US915.
I tested it with the Dragino Hat 1.4 and RPI3 and a Laird RG1xx gateway.
It probably makes more sense to use MQTT for this instead of custom socket code.