New API for gateway mapping, status and info

Yep, Gateway Server updates the gateway statistics every 4 to 6 minutes (random to distribute load). The RX and TX rates indicate the packets per hour. This is only indicative for the busyness and liveness of gateways. Although you can, I would discourage polling these values and converting them back to actual numbers (based on consecutive updatedAt timestamps), because you’ll be missing updates and with many gateways you’ll be hitting the API rate limiter.

We are working on a separate API for routing statistics, including per-gateway aggregates over time.

1 Like

Very useful API, thanks. My gateway moved (Antenna location changed thanks to GPS + Location correctly set in console). How long will it take to get the new value through the API ? (Is it minutes, hours, days? )

That should be minutes, up to 6 minutes roughly.

First of all: Great to have this API !

You mention that people should cache the results when they query the API.
→ Would it be possible to add an ETag header in the HTTP response?
This way a client cache can verify if certain data/content has changed without overloading the API by doing a simple HEAD request and not af full GET request.

ETag is a bit tricky, but Last-Modified can be used so you can pass If-Modified-Since instead. I’ll file an internal issue.

1 Like

A Node-red tool around the TTN Gateway Radius and Gateway API

image

4 Likes

Added an new table calculating and displaying the distance and azimuth from the new node to gateways.

image

Also add a window calling on @avbentem airtime-calculator for TTN and a window calling on The Things Network Status Page

Hiya, this works nicely for the community edition, but I can’t get it working for our private instance. I assumed I just needed to change tenantID from ttn to our instance name, but that just returns an empty array. Is there some kind of authentication step I am missing?
Many thanks

You will have to change the url’s as well.

Thanks Nick - any idea what the url ought to be? I have made many guesses…

Doh, replied too fast, it’s not on the instances so it’s not a TTS API call.

Do you have packet broker turned on for your instance?

Yes I believe we do - our gateways forward stuff to community apps and our apps receive messages from community gateways via packetbroker

I’ll have a look at mine, if you get my drift.

1 Like

Which TTS version are you running?

Are the gateway locations and statuses public? See gateway settings in the Console.

You should be using your NetID and tenant ID with which you connect to Packet Broker.

Otherwise reach out privately and we’ll get this fixed.

Hi @johan - sure, I’ll log a support call.
It is TTS Cloud edition and yes the gateway locations and statuses are public.

Hi Johan. I have the same problem with my gateway. Also not on community edition, but the free tier cloud.
Have packetbroker allowing to route traffic. Set gateway to public. Etc, etc.

I thought it has something to do with the fact that I registered my gateway before on the V2 network. Then switched to V3 (community edition) and then switched to V3 (cloud) that it kinda messes up with id’s or something. Maybe didnt deregister the gateway in V2 the right way.
When I use the url’s from first post and try to query the individual gateway info I can query the gateway on the V2 network, stating it’s offline.
But V3, changing net id, etc… nothing.

https://mapper.packetbroker.net/api/v2/gateways/netID=0013,tenantID=ttnv2,id=solidminds-gw-001

{"netID":"000013","tenantID":"ttnv2","id":"solidminds-gw-001","updatedAt":"2020-07-01T12:55:05Z","location":{"latitude":51.28542709350586,"longitude":5.739286422729492,"altitude":32},"online":false,"frequencyPlan":{"region":"EU_863_870"}}

When I change the tenantID to ‘solidminds’, which is the name of my network, it shows:

{"message":"store: not found: get gateway"}

Should I also change the netID?

Configured gateway visibility for solidminds. Please check. We’re adding a switch for this in TTS, please subscribe to Configure gateway visibility in Packet Broker (Console) · Issue #4409 · TheThingsNetwork/lorawan-stack · GitHub

1 Like

Thank you Johan. It works now.
Was I able to do this using the CLI yet?

And should this also show my gateway on the map at https://www.thethingsnetwork.org/map ?

Edit: Nvm, it took a couple of minutes. It’s on the map now.

I have tried to follow this procedure to hide my develop gateway location. However, in the api response the “location” is still present. How can I remove it?

Good point. I’ll file an ~internal~ issue to see if we can remove the location. You can subscribe to the issue to follow updates.

1 Like