Contents
Description
The Things Network, a leading provider of LoRaWAN networks and services, is upgrading its stack to v3. As a leading LoRaWAN end-devices and gateways provider, Milesight’s gateway and end devices can be easily connected to The Things Stack. This document will guide you how to connect Milesight LoRaWAN devices to The Things Stack.
Requirement
1. The Things Stack Sandbox Account
2. Milesight LoRaWAN End Devices (Sensors, Controllers, in this example EM300-DI is used)
3. A Milesight Gateway connected to The Things Stack by Semtech Packet Forwarder or Basic Station
Configuration
Step1. Login The Things Stack
Login The Things Stack using the credentials/The Things ID. 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 Application and Milesight Sensor in The Things Stack
Click Applications > Add application to create an application.
Input the Application ID as required. Then click the Create application button.
Select the application you have added, go to End devices page and click +Register end device in the right button side.
It is recommended to add them directly by a manual way. Then fill in the device information.
Frequency Plan: select according to sensor settings. For AU915 or US915, it is suggested to select FSB 2 if you use default Milesight gateway frequency settings.
LoRaWAN version: 1.0.2 or 1.0.3
Regional Parameters version: revision B if using 1.0.2
Activation mode: select as required, it is OTAA by default
LoRaWAN class: select as device type and settings
Join EUI: the same as App EUI, it is 24E124C0002A0112 by default
DevEUI: the unique ID of every device which can be found on the label
AppKey: it is 5572404c696e6b4c6f52613230313823 by default
End device ID: user-defined
When done, click Register end device to save it.
Step3. Check the sensor data
Power on the Sensor EM300-DI, then you will see the uplink live data here.
Click the message to get the event details, you will see the sensor data easily here.
Step4. Decode the sensor data
Select the desired device and go to Payload formatters > Uplink page to add decoder of this device.
Select Custom Javascript formatter type and add the decoders. The decoder of Milesight devices can be found here: https://github.com/Milesight-IoT/SensorDecoders
Then you can type the hex format payload to test this decoder:
Then click on the Save changes button at the bottom of the screen.
And you can see the decoded data in the Live data page.
Step5. Send Downlink to Sensor
Send Downlink Directly
Go to Messaging page to send a downlink command directly.
Insert Mode: Replace downlink queue
Fport: type as device settings, it is 85 by default
Payload type: Bytes
Payload: hex format command which can be found on user guides of devices. In this example, send command ff6900 to enable data retransmission or send ff6901 to enable data retransmission off.
Confirmed downlink: if enabled, it will ask for the device to send confirmed packets if received
After clicking Schedule downlink, you can see in the command is sent.
Note: Class A type device only receives the command when sending uplinks.
Send Downlink using Encoder
Select the desired device and go to Payload formatters > Downlink page to add decoder of this device.
Select Custom Javascript formatter type and add the encoders. In this encoder example, enter “testEncode” to encode message as hex format command ff6901.
Go to Messaging page to send a downlink command directly.
Insert Mode: Replace downlink queue
Fport: type as device settings, it is 85 by default
Payload type: JSON
Payload: json format command. In this example, the downlink command is
{ "command":"testEncode" }
Confirmed downlink: if enabled, it will ask for the device to send confirmed packets if received
After clicking Schedule downlink, you can see in the command is sent.
Note: Class A type device only receives the command when sending uplinks.
--END--