This article will take AM107 indoor ambiance sensor as exmple to guide you how to integrate Milesight IoT sensors to Ubidots via The Thing Stack. Following steps can be applied to all Milesight IoT LoRaWAN sensors.




Step 1. Device Registration

Step 2. Add Payload Formatters

Step 3. UbiFunctions Setup

Step 4. The Thing Stack Webhook Setup

Step 5. Data Visualization



Step 1. Device Registration

1. Go to the The Thing Stack console and enter the Gateway section to add a new LoRaWAN gateway.  

2. Enter the Application section to add a new application.

3. To register a device, go to the End Device .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.

4. Fill in the information to register the device.

5. Save all configurations. You can check the real-time data under Live data.

Step 2. Add Payload Formatters

1. Go to Payload formatters to add an AM10x decoder for this end device.

Note: For more devices, please check out the decoders provided by Milesight IoT.

You can also add the decoder under Payload formatters->Uplink of this application.

2. Click Save changes to save the decoder.

3. Go to Live data tab, then decoded data will show in the details.

Step 3. UbiFunctions Setup

Follow the below steps to create and launch the UbiFunction which will handle The Thing Stack’s native JSON format conversion into an Ubidots’ compatible one:

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

Copy the code from Integrate your The Things Industries data with Ubidots using UbiFunctions and enter your Ubidots account token into the code.

2. Click “Make it live”and copy the HTTPs Endpoint URL.

Step 4. The Thing Stack Webhook Setup

1. Go to Integration->Webhooks tab and click +Add webhook to add a new webhook. Then select Ubidots as template:

2. Fill in the information of webhook:

3. Click Create ubidots webhook to save the configurations. Once a new value is received to The Thing Stack from the device, a new device will be automatically created into your Ubidots account.

Step 5. Data Visualization

1. Select the device created to verify all the variables received:

2. Click every item to check history data and add the unit.

3. Go to the Data -> Dashboardsection of your Ubidots account to create a dashboard.

4. Selectthe plus (+) icon located a the upper right side of the page to add widgets to display your data.