Your online gateway inside the The Things Network can be monitored. A predefined url including the gateway ID/name can be loaded into an url. The output will be in the JSON format.

All registered gateways can be found on a map: https://www.thethingsnetwork.org/map. Use the zoom buttons on the left to locate for example your gateway or find a gateway nearby. You may click on the blue balloons in to map itself a swell to go to the desired location.

Gateway ID’s or names are unique, but not hidden or secret. Instead of monitoring your own gateway, you can do the same with a random one (in your neighbourhood for example). In case you own a gateway I suggest to get your ID/name from the The Things Network console.

The predefined url to monitor a gateway is “http://noc.thethingsnetwork.org:8085/api/v2/gateways/”. At the end of the url, the gateway ID/name should be entered. My personal gateway ID/name is “rutg3rttngw”, so in the end the url will be “http://noc.thethingsnetwork.org:8085/api/v2/gateways/rutg3rttngw”. When you load this url in a browser, the output will be shown in JSON format:

{

  • timestamp2018-12-04T23:35:25.676950209Z,
  • authenticatedtrue,
  • uplink2118,
  • location
    {

    • latitude51.37195,
    • longitude6.1703496,
    • altitude20,
    • source“REGISTRY”

    },

  • frequency_planEU_863_870,
  • platformThe Things Gateway v1BL r2-c463e87e (2018-02-23T14:42:40Z)Firmware v1.0.5-fa89b993 (2018-07-17T08:11:52Z),
  • gps
    {

    • latitude51.37195,
    • longitude6.1703496,
    • altitude20,
    • source“REGISTRY”

    },

  • time“1543966525676950209”,
  • rx_ok2118

}

 

Every object in the JSON output can be retrieved. The uplink” in the 3rd row means how many messages are received by the gateway, in this case 2118.

The red marked values are retrieved in the script. With the first run of the script the object names and values are retrieved and virtual devices are created in Homeseer. When every other update, only the virtual devices are updated when necessary.

When the url is not able to retrieve the data from the gateway, the following JSON output is generated:

{

  • error“status not found”,
  • code5

}

 

No extra checks are added yet for “Online/Offline” status, or for example a “Last seen” timespan.

Create an recurring event in Homeseer and run the script script which can be downloaded at the bottom of this page.

When the gateway url is valid, the following virtual devices will be created automatically:

TTN_HS-devices11

Release Notes

07-12-2018v1.1
  • Gateway status (Offline/Online) added as virtual device.
05-12-2018v1.0
  • First release

 

 

Downloads: