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 Ubidots via TTN v3 please refer to article Connect Milesight IoT sensors to Ubidots via TTI.
This article will take AM107 indoor ambiance sensor as exmple to guide you how to integrate Milesight sensors to Ubidots via The Things Network(TTN). Following steps can be applied to all Milesight IoT LoRaWAN sensors.
Step 1.TTN Device Registration
1. Go to the TTN console and enter to the Gateway section to add a new LoRaWAN gateway.
Note: Refer to How to Connect Milesight LoRaWAN gateway to TTN if you use Milesight IoT LoRaWAN gateways.
2. Enter the Application section to add a new application. To create the application, just press Add application.
App EUI can be added under Settings tab if necessary.
3. To register a device, go to the Device tab. Then press Register Device to register the AM107 sensor. Device ID and device EUI are the unique identifiers for the device. App Key and App EUI are automatically assigned by TTN or can be changed as your requirements.
After registration, you can check the real-time data in Data tab.
Step 2. Add Decoder to TTN
1. Go to Application->Payload Format section 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 3. TTN-Ubidots Integration Setup
1. Go to Integration tab to add a new integration. Then select the Ubidots as integration:
2. Fill in the information of Integration:
- Process ID: Theunique identifier desired for the integration process.
- Access Key: The app access key.
- Token: Your Ubidots account token. (How to find Ubidots account token)
Click Add Integration to save and integration will show as below:
Once a new value is received to TTN from the device, a new device will be automatically created into your Ubidots account.
Step 4. Data Visulization
1. Select the device created to verify all the variables received:
Device name can be modified as your requirements.
2. Click every item to check history data and add the unit.
3. Go to the Data -> Dashboard section of your Ubidots account to create a dashboard.
4. Select the plus (+) icon located a the upper right side of the page to add widgets to display your data.