Milesight is an IoT company that leverages the top trending technologies to simplify the process of data collection, storage, and retrieval in order to accomplish the goal: connecting "things" to the Cloud. They provide a variety of products with long-range communication technologies (cellular and LPWAN solutions), allowing an easy IoT deployment for different verticals such as Agriculture, Smart Cities, Energy, Retail, Transportation, Medical, and Industrial automation.
This article will take the AM107 indoor ambiance sensor as an example to guide you on how to integrate Milesight IoT sensors to Ubidots via The Things Industries (TTI). The steps below can be applied to all Milesight IoT LoRaWAN sensors.
TTI: The Things Industries
Step by Step
Add Payload Formatters
TTI WebHook Setup
1. TTN Device Registration
Step 1: Go to the TTN console and enter the Gateway section to add a new LoRaWAN gateway.
Step 2: Enter the Application section to add a new application and assign the parameters below:
Owner: Application owner
Application ID: The unique identifier of your application on the network.
Application name (optional)
Description (optional): a human-readable description.
Step 3: Select “Add application” to continue.
Step 4: Register the device, go to the End Device tab. Then press + Add End Device to register the AM107 sensor. You can select the device under From The LoRaWAN Device Repository tab.
If you need to add other sensors or customize your parameters, go to Manually tab to select the parameters.
Step 5: Fill in the information to register the device.
Step 6: Save all the configurations. You can check real-time data under the Live data tab.
2. Add Payload Formatters
You can also add the decoder under Payload formatters -> Uplink of this application.
Step 2: Click Save changes to save the decoder.
Step 3: Go to Live data tab, then decoded data will show in the details.
3. UbiFunctions Setup
Follow the below steps to create and launch the UbiFunction which will handle TTI’s native JSON format conversion into an Ubidots’ compatible one:
Step 1: Go to Devices->Functions tab to create an integration.
Name: Customize your UbiFunction. For example, “TTI Integration”
Method: Select POST
Runtime: Select Python 3.6
Time-base trigger: disable
Step 2: Copy the code from Integrate your The Things Industries data with Ubidots using UbiFunctions and enter your Ubidots account token into the code.
Step 3: Click “Make it live” and copy the HTTP Endpoint URL.
4. TTI Webhook Setup
Step 1: Go to Integration->Webhooks tab and click + Add webhook to add a new WebHook. Then select Ubidots as a template:
Step 2: Fill in the information of webhook:
Webhook ID: Alphanumerical characters and dashes only
Ubidots username: Your Ubidots account username
UbiFunction name: function-name of your UbiFunction URL.
Step 3: Click on “Create ubidots webhook” to save the configurations. Once a new value is received to TTI from the device, a new device will be automatically created into your Ubidots account.
5. Data Visualization
Step 1: Select the device created to verify all the variables received:
Step 2: Click on each variable to check historical data and add the correspondent unit.
Step 3: Go to the Data -> Dashboard section of your Ubidots account to create a dashboard.
Step 4: Select the plus (+) icon located at the upper right side of the page to add widgets to display your data.Learn more about Ubidots’ Dashboards.