Description
The Things Network, a leading provider of LoRaWAN networks and services, is upgrading its stack to v3 (TTS v3). As a leading LoRaWAN end-devices and gateways provider, Milesight IoT’s gateway can be easily connected to TTS, no matter it’s via ‘Semtech Packet forwarder’ or TTN(v2) or the Basic Station. This document will guide you how to connect to TTI/TTS v3 via Basic Station in Milesight LoRaWAN gateway UG65.
If you prefer using Semtech Packet forwarder, please click here.
Requirement
\1. TTS Subscription
\2. Milesight IoT Gateway (UG65, UG67, UG85, UG87)
\3. Any Linux distribution
Configuration
2. Prepare the CA File and the Client Key File
Step1. Prepare the CA File (*. trust)
Step2. Prepare the Client Key file (*.key)
3. Configure the Basic Configuration in Gateway
Step1. Login the gateway and disable the default local server connection.
Step2. Create new Basic Station connection to TTS
1. Login TTS and Add Gateway
Step1. Login TTS
Login TTS using the TTS account/the things ID subscripted from TTN. In this example, the address is https://eu1.cloud.thethings.network. You can also select server areas here.
This is the login page, choose Login with The Things ID
Input the credentials and click Submit
When done, you will see this console page successfully.
Step2. Add Gateway
Login the web interface of the gateway to check frequency plan in Packet Forwarder -> Radio page. In this example, the frequency plan is EU868.
You will need to take a note of the Gateway ID and Gateway EUI, which is needed when Register a device in TTS.
You can change the Gateway ID to yours. In this example, Gateway ID= milesightug65, Gateway EUI= 24E124FFFEF1272B.
Click Register a Gateway and input the items like this,
Since this Gateway is EU868 type, we need to choose Europe 863-870Mhz in the Frequency Plan; if your gateway is other brands like AU915, you need to choose the corresponding value here.
When done, the gateway is created well.
Note:
\1. The Gateway ID cannot be reuse if you delete it in TTS
\2. The default Gateway ID in Milesight gateway is the same as Gateway EUI
Step3. Create API Key
To connect to TTS v3, we need to create the API key, which will be used to generate lns.key to upload to Milesight Gateway.
Click API Keys -> Add API Key
Input any name you like, tick Grant Individual rights and Link as Gateway to a Gateway Server for traffic exchange, i.e., write uplink and read downlink, then click Create API Key.
There will be a window pop-up to let you know copy the API Key.
In this example, the key is: NNSXS.KDSXSAHLASC6REZDI3RV3ZTU27FDTNQVSRT7TYQ.MD7XXFD5D7ZOJW7XT2G3IV3QSVCTMVKJLKB2RF7HPPQOJPRUH6LQ
This API key will be used to create the *.key file in next step.
Note: The Key is unique for the application created for each device.
2. Prepare the CA File and the Client Key File
Step1. Prepare the CA File (*. trust)
This is the CA certificate which secures your domain. Which contains links to common root SSL certificates used in The Things Stack, issued by trusted certificate authorities (CAs), in Milesight Gateway, we can just download the ISRG Root X1 Trust file to deploy, you will get a CA file named isrgrootx1.pem, we should rename it to *.trust.
Step2. Prepare the Client Key file (*.key)
Access any linux distribution, then execute the following command to generate the lns.key file.
$ export LNS_KEY="your-lns-api-key" $ echo "Authorization: Bearer $LNS_KEY" | perl -p -e 's/\r\n|\n|\r/\r\n/g' > lns.key
In this example, here are the details:
harry@ubuntu:~$ export LNS_KEY="NNSXS.KDSXSAHLASC6REZDI3RV3ZTU27FDTNQVSRT7TYQ.MD7XXFD5D7ZOJW7XT2G3IV3QSVCTMVKJLKB2RF7HPPQOJPRUH6LQ"
harry@ubuntu:~$ echo "Authorization: Bearer $LNS_KEY" | perl -p -e 's/\r\n|\n|\r/\r\n/g' > lns.key
when done, we can check the content inside:
harry@ubuntu:~$ cat lns.key
Authorization: Bearer NNSXS.KDSXSAHLASC6REZDI3RV3ZTU27FDTNQVSRT7TYQ.MD7XXFD5D7ZOJW7XT2G3IV3QSVCTMVKJLKB2RF7HPPQOJPRUH6LQ
Try to download it from linux to your desktop. It will be used to upload in Milesight Gateway.
3. Configure the Basic Configuration in Gateway
Step1. Login the gateway and disable the default local server connection.
Step2. Create new Basic Station connection to TTS
Click + to create a new destination
Select the type as Basic Station
For the URI, the format is wss://your-url:8887,
In this example, it’s *wss://eu1.cloud.thethings.network:8887*
Click Browse to uplink the CA File and Client Key
Click Import for both CA file and Client Key, then click Save.
Click Save & Apply to take effect.
Then we can find it’s Connected status in Gateway side.
We can also check the gateway status in TTS side. It’s online successfully.
In the above screenshots, we can see the packets from the gateway.
END