IMPORTANT: The Things Network is moving to The Things Stack (V3). The Things Network V2 clusters will shut down in December 2021. For connecting Milesight nodes to TTN v3 please refer to article How to Connect Milesight End Devices to The Things Stack v3.
This article will take AM107 indoor ambiance sensor as example to guide you how to integrate Milesight IoT sensors to The Things Network(TTN). Following steps can be applied to all Milesight
IoT LoRaWAN sensors/controllers. Before adding device, refer to How to Connect Milesight Gateway to TTN v2 to add Milesight IoT LoRaWAN gateways to TTN.
Step 1. Create an Application
1. Enter the Application section to add a new application. To create the application, just press Add application.
- Application ID: user-defined
- Description: user-defined
- Application EUI: TTN will generate a App EUI for this application randomly. If you need to use your App EUI, please follow Step 2.
- Handler Registration: the same as gateway
Step 2. Add App EUI
Click the application you created and go to Settings->EUIs tab to add your App EUI.
Step 3. Add a Device
Go to the Device tab and press Register Device to register the AM107 sensor.
Device ID: user-defined, unique
Device EUI: this can be found on the label of Milesight LoRaWAN nodes or by Toolbox
App Key: default App Key of sensors/nodes can be found on user guide
App EUI: select the App EUI you add. If you use the TTN App EUI, please also change the App EUI of devices.
After registration, you can check the real-time data in Data tab.
Step 4. Add Decoder to TTN
1. Go to Application->Payload Formatsection to add an AM10x decoder for this application.
Note: For more devices, please check out the decoders provided by Milesight IoT.
2. Fill in the example Payload and click Test to show the JSON output.
3. Click Save payload functions to save the decoder.
4. Go to Data tab, then decoded data will show in the TTN.
Step 5. Send Downlinks
1. Go to Device tab to send downlink commands to control the device. The format should be HEX. Fport is 85 by default for Milesight LoRaWAN sensors.
2. After clicking Send, the downlink will be added to queue and wait to send to sensors. If sent, the sensor will reply the confirmed package.