Integrating Ubidots with Helium's LNS in one place simplifies user experience, streamlining device management and data analysis. This consolidation offers users enhanced control and clarity over their IoT solutions, reducing complexity. With support for AU915_1 and US915_1 regions, CLASS A, B, C, and key ChirpStack features, the service not only simplifies operations but also ensures robust functionality and flexibility, catering to a wide range of IoT applications and needs.
This plugin costs $100 per month. It includes 100 devices and 1M Data Credits. |
Requirements
An active Ubidots account.
1. Creating the plugin
Navigate to Ubidots, click on Devices → Plugins and click on the "+" button, located at the upper right corner, to create a new plugin. Find and select the Helium - ChirpStack LNS plugin. After reviewing the provided "README", click the icon to initiate the plugin's setup. You will be prompted to choose a Ubidots token and, if desired, add a description for your LNS tenant:
Once finished with the plugin, your LNS account will be created. Your username will be the email address of your Ubidots account and the password will be sent to you in an email (see the following chapter of this guide).
Note: The Ubidots token is solely used to gather necessary information from Ubidots to create a tenant on the LNS. It doesn't link or associate directly with the LNS tenant in any other way.
2. Getting the login credentials
Upon creating the plugin, you'll receive an email from service@ubidots.com with the subject "Your Helium LNS activation". It contains your LNS credentials and a button to continue the process. Your username will be the email address of your Ubidots account and the password is randomly generated by the plugin.
Click on the green button to go to the LNS.
3. Logging in to the LNS
Use the provided email as username and the password, then, you'll have access to Ubidots LNS:
4. First steps in the LNS
In ChirpStack, the organization and management of devices is carried out through "devices", "device profiles", and "applications". Understanding these components is fundamental to deploying and managing your IoT solutions on ChirpStack.
4.1. Create an application
In ChirpStack, an Application organizes end-devices (LoRaWAN devices) with shared functionalities into groups for easier management. It acts as a container, streamlining data management, security, and service integration. Applications allow for payload decoding to convert raw data into insights and support external integrations like webhooks or MQTT for data communication.
To create an Application head to Applications → Add Application:
Give a name to the Application and then save by clicking on the "submit" button.
After creating the application, you'll need to create a device profile.
4.2. Create a Device Profile
Device Profiles in ChirpStack set the operational parameters and capabilities of LoRaWAN devices, detailing their LoRaWAN version, activation methods (OTAA or ABP), operation class (A, B, or C), and other settings.
Associating devices with Profiles ensures they operate within specified parameters for compatibility and performance, and links them to Applications for structured management.
To create a Device Profile head to Device Profiles → Add Device Profiles:
Fill the fields accordingly to your device settings and LoRaWAN regional parameters in your location. Then hit the Submit button to save it.
Note: Remember that the currently supported regions are AU915_1
and US915_1
4.3. Create a Device
Go to the application created earlier, click on it and then click on the "add device" button:
Enter your device's details, including the DevEUI and JoinEUI, select the previously created Device Profile, and click on "submit".
After that, you'll need to enter your application key (look for it on the device itself, its packaging or in a mobile app used to configure it):
After this, you'll be able to see your device on the LNS' dashboard:
5. Creating an HTTP integration to Ubidots
In order to visualize your devices on Ubidots, you must create an integration that sends the data to Ubidots whenever a device performs an uplink.
First, go to Ubidots → Devices → Plugins and click on the plugin created on step #1, then go to the Decoder section and copy the plugin's "HTTPs Endpoint URL":
Scroll down and paste the following code in the decoder section:
import base64
import struct
def format_payload(args: str) -> dict:
# Args is probably a base64 string
print(args)
bytes_data = base64_to_bytes(args)
# The 'decoded_data' dictionary must comply with Ubidots schema.
# You can check this in the following link -> https://docs.ubidots.com/v1.6/reference/send-data-to-a-device
decoded_data = device_decoder(bytes_data)
return decoded_data
# This is a dummy function, replace here your device decoder
def device_decoder(bytes_data) -> dict:
# Unpack first two bytes to integers
temperature, humidity = struct.unpack(">BB", bytes_data[:2])
# This is a dummy function, replace here your device decoder
# This object must comply with Ubidots schema
return {"temperature": temperature, "humidity": humidity}
# Helper function
# Don't modify it!
def base64_to_bytes(base64_string):
"""
Converts a base64 encoded string to bytes.
Parameters:
- base64_string (str): The base64 encoded string to be converted.
Returns:
- bytes: The decoded bytes from the base64 string.
"""
byte_content = base64.b64decode(base64_string)
return byte_content
Then click on the "SAVE & MAKE LIVE" button to save the changes.
A couple of comments on the decoder above:
The device's label is set to its DevEui in order for it to be unique.
You must change the
device_decoder
function to actually match your device's schema and return an object compatible with Ubidots, which you can check here.If the event triggering the plugin's execution is not an uplink, the decoder does nothing and simply returns a dictionary with a status message.
Now, head back to Helium - Chirpstack LNS and, once there, go to the Application created earlier, and then to the Integrations tab:
Search the HTTP integration and click on the little plus button under its description:
Fill the following fields according to:
Payload encoding: JSON
Event endpoint URL(s): Your plugin's endpoint URL
Headers: Add the
X-Auth-Token
header and use one of your Ubidots tokens as its value.
Then, click on the "submit" button to save this configuration.
After performing this steps, you'll be able to see your device on Ubidots:
6. LNS alternative without Helium
If you prefer using your own gateways, without using Helium's connectivity, we can provide dedicated Chirpstack deployments on demand. Please contact us at support@ubidots.com to learn more.