how to reboot a LORA node if it stops sending data?


I have a LORA node up-linking data to a Thingspeak channel via The Things Network (TTN). Sometimes it stops sending data and I reboot it by logging into my console on TTN and sending a re-boot down-link message to the node. Is there any way I can transmit a downlink message to the node direct from Thinkspeak?
Christopher Stapels
Christopher Stapels 2024 年 4 月 22 日
Is there an API call to trigger the downlink? If so, you can trigger from ThingSpeak via MATLAB analysis code using webwrite aor webread.
Steven Grobler
Steven Grobler 2024 年 5 月 10 日
The TTN API documentation gives the following example of a downlink to the end device dev1 of the application app1 using the webhook wh1.
curl --location \
--header 'Authorization: Bearer NNSXS.XXXXXXXXX' \
--header 'Content-Type: application/json' \
--header 'User-Agent: my-integration/my-integration-version' \
--request POST \
--data '{"downlinks":[{
"frm_payload":"vu8=",
"f_port":15,
"priority":"NORMAL"
}]
}' \
'https://thethings.example.com/api/v3/as/applications/app1/webhooks/wh1/devices/dev1/down/push'
I've tried to enter that information into my ThingHTTP, using my own parameters for dev1, app1, wh1 etc, including the Authorisation header with the bearer key from TTN and the Content-Type header. I do not know what to insert for the User-Agent header, so left that out.
I tried sending the command from a CMD window in Windows 11, using curl as below, but I get a "-1" response, indicating a failure, and TTN does not receive the downlink either...
Maybe the User-Agent header is essential .
Any suggestions?
curl "https://api.thingspeak.com/apps/thinghttp/send_request?api_key=my-api-key"
Vinod
Vinod 約4時間 前
@Steven Grobler It is possible that incoming requests to the device are blocked by the networking firewalls. I'd start by looking to see if you can make a working the cURL request to the trigger the downlink from a machine on a different network than the TTN Node. If you can share that, I can help with converting that to the equivalent ThingHTTP request.
Christopher Stapels
Christopher Stapels 2024 年 5 月 10 日
User agent is not needed (thoug it can he helpful for statistics on our side).
The -1 for ThingHTTP usually means authorization problem. You could check though by making the ThingHTTP just do something simple like update a channel.
For flexibility, I would recomend you use a MATLAB analysis. Its a little harder to trigger from a device, but you can have a React set up from a channel, and when the device updates the channel, then the react will trigger the code. You get a lot more flexibility in what you can send from MATLAB code instead of the ThingHTTP UI. And its easier to develop and test code: if you have MATLAB desktop or usinging MATLAB onlineor the MATLAB AI chat playground (the last two have a free tier if needed).
You can use webread or webwrite in your code to call other API's. weboptions can help wih the authorization and setting other headers. The playground can help you write the code also.
Steven Grobler
Steven Grobler 2024 年 4 月 24 日
Thanks Christopher, thanks for that - there is indeed an API for TTN. I shall investigate that further and I'll post back here with what I find... regards, Steve
Steven Grobler
Steven Grobler 2026 年 5 月 9 日 14:20
Well I did manage to get this working - I now detect if a channel has not sent any data in the last say 30min, and if not I send a reboot command to that node. If anyone is interested I will dig it up and provide an explanation....
Vinod
Vinod 2026 年 5 月 9 日 15:13
I think it would be useful if you could share the info on remotely rebooting the TTN node. I could imagine other users setting up a React with a no data insert check.