I am new to this Lorawan world and need help to figure out some basic features for my Lorawan gateways. I have connected the Laird gateway to TTN console and i can see the sensor data coming in from the sensors.
On the Gateway overview page, i can see the Gateway ID, status and lots of other parameters. Is there any REST API to fetch this details from the outside application? I want to display the list of gateway online/offline statistics on my website. I can do that based on the sensor data arrival time, but instead i want to fetch the Gateway statistics on request when ever the user wants to see.
Thank you so much guys. The âhttp://noc.thethingsnetwork.org:8085/api/v2/gateways/gw_idâ worked.
The response is:
{âtimestampâ:â2020-08-20T13:30:47.178148912Zâ,âuplinkâ:â1749â,âdownlinkâ:â1653â,âlocationâ:{},âfrequency_planâ:âUS_902_928â,âgpsâ:{},âtimeâ:â1597930247178148912â,ârx_okâ:1749,âtx_inâ:1653}
How can i get the online status value connected/not connected?
The timestamp value is when the gateway was online last time. I can decide the online status based on timestamp. Is there any document which provides the list of all APIs to fetch Gateway status?
âconnected/not connectedâ is effectively a timeout value determined as some period from last âtimestampâ when seenâŚmost GWâs âupdateâ on 30sec interval timeline, others longer. Typically I find the Console can take anything from 2min to >30mins to âchangeâ to not connected if I shutdown or disconnect the netwroek connectionâŚ(similarly when coming back on line though I have seen it take many hiurs depending on Console Data Display scrape activity timingâŚ
For a modest investment, you could have a canary device that uplinks a small payload at what ever interval fits your downtime notification needs (but obviously respects the fair use policy).
By doing this, your gateway stats will tick up and the timestamp will be updated AND as a bonus, you can check the uplink has arrived at your application so you know that the gateway is alive & well and that the infrastructure is passing on messages.
But obviously, donât hammer the gateway status.
What downtime can you cope with - I havenât got anything running that couldnât go a few hours without issues - maybe an irritating gap in data, but all alerts should have boundaries set - âhey, there may be a issueâ, âouch, that hurtâ and âbyeeeeeeeâ - which the server should also be able to extrapolate - and maybe one day, Iâll figure out enough ML to get it to auto-guess for me.
Iâve got into the habit of always installing such a canary typically 50-250m away from any new GW deployment if I can get a good site for just such a purpose - most on 20min update some longer/slower - critical application locations might be as low as 5mins - proximity means canary chirps on SF7 with no significant payload to worry about so its low time on air (might send canary battery level but usually try for a powered location if poss). If I have to get closer to GW I set Tx power v low so as to minimise battery use and minimise near/far problems for remote sensors, as well as helping ensure GW is running with ability to pick up low sensitivity signals - have seen some GWâs in past go partially deaf - I suspect due to latent failure due to static damage or near miss with lightning strikes⌠Always keep canary at least 3m, pref >5m away from GW ant and behind an absorber if possâŚ
With the v2 â v3 in mind, I am trying to figure out how to retrieve that status of v3 gateways?
Currently I am using NodeRed (node-red-contrib-ttn module) to fetch v2 gateways.
Hello everybody
I could not find the https adress i have to use for the eu1 server?
With the http://noc.thethingsnetwork.org:8085⌠it does not work.
Thanks for your help!
If that is the url you used then not surprised it didnât work, as incomplete. Also if/when you get the correct one you will see it is actually a V2 noc (as called out in the url) so wonât work with V3.
I do have the API key belonging to the specific gateway, and get the result (the GW is indeed offline)
{âcodeâ:5,âmessageâ:âerror:pkg/gatewayserver:not_connected (gateway eui-0000024b080605f0@ttn not connected)â,âdetailsâ:[{â@typeâ:âtype.googleapis.com/ttn.lorawan.v3.ErrorDetails",ânamespaceâ:âpkg/gatewayserverâ,ânameâ:ânot_connectedâ,âmessage_formatâ:"gateway{gateway_uid} not connectedâ,âattributesâ:{âgateway_uidâ:âeui-0000024b080605f0@ttnâ},âcorrelation_idâ:â2b7bc0cc621440258c72834b9aa95941â,âcauseâ:{ânamespaceâ:âpkg/redisâ,ânameâ:ânot_foundâ,âmessage_formatâ:âentity not foundâ,âcodeâ:5},âcodeâ:5}]}
I am still a bit puzzled by the âlast_status_receivedâ elementâŚ
My GW is online, and the uplink/downlink counts show increasing but the timestamp on last_received_status is almost the same as the connected_at timestamp:
As discussions evolve here we get more insights in to the infrastructure - to stop the database(s) melting, some data is cold - ie itâs not updated live - which makes sense.
The wording and the structures imply that the timestamp is when the gateway last sent a status message - the question being is, what is that status message!
@htdvisser, can you tell us how the last_status_received field is defined / updated please.
This depends on the type of gateway. The UDP packet forwarder, as well as the MQTT forwarder of The Things Kickstarter gateway regularly send status messages with information about the gateway. The Basic Station protocol doesnât send regular status messages, and the only status we get is when it sends the station, firmware, package, model, protocol and features fields when it connects.
Many thanks for the clear feedback. It explains why there is a difference between de gateways. In my case I use the âBasic Stationâ.
As I am trying to monitor my gateways in a simple NodeRed flow, is there a query possible, which basically shows the same status, as is visible the new console?
In other words, where is the console Gateway status retrieved from, and can we do that via any API?
The lack of status messages was opened on Basics Station Github back in November 2019. It includes a response âWe have this feature on our roadmap and it will be included in future releases.â
@htdvisser you are a bit closer to the action, Any idea when that might occur?