Automated Device Onboarding
Last updated
Last updated
Use Device Provisioning through Blynk Where Possible
For easier maintenance and to minimize potential errors, device provisioning through Blynk is strongly recommended over The Things Stack. This approach streamlines the device activation process, making it more efficient and user-friendly.
To enable the Automated Device Onboarding through Blynk, follow these steps:
Open the advanced settings of the application on Blynk.
Turn on the "Enable automated device onboarding" switch.
Specify the LoRaWAN version, Frequency plan, and Regional Parameter Version. Also, enable the "Support class B" and/or "Support class C" checkboxes if required.
Specify the addresses of The Things Stack components, which can be found by navigating to Home -> Admin panel -> Network information at the bottom of the page. If you are using The Things Stack Sandbox, all components share the same regional domain.
Save the changes.
At this point, Blynk creates three new metadata fields in the device template: Device EUI, Join EUI (same as App EUI), and Application Key.
Additionally, Blynk requires the "View device keys in application", "Create devices in application" and "Edit device keys in application" permissions. To provide this, generate a new API key or edit the existing one that you were using with Blynk.
Now that automated device onboarding is enabled and configured, you can onboard your first device. Blynk supports three ways to onboard a device on The Things Stack. Let's cover them separately.
Sometimes, a device requires a reboot to initiate the onboarding flow. Make sure to restart the device if it doesn't automatically start the onboarding process after following the setup steps. This can help ensure the device properly connects and begins the necessary communication with Blynk and The Things Stack.
This is the easiest, but least scalable way to onboard the device:
Start by creating the device from the template on the web dashboard.
Open "Info & Metadata" and fill out the three metadata fields: Device EUI, Join EUI (same as App EUI), and Application Key.
Once these three metadata fields are specified, Blynk will automatically create the device in The Things Stack application.
The preferred method for device provisioning is using Static Tokens. Here’s how to do it:
Create a CSV file listing the Device EUI, Join EUI (same as App EUI), and Application Key for each device.
Use this CSV file to create static tokens: open the Developer Zone -> Static Tokens -> Generate Static Tokens -> Create From File. Then select the device template and upload the file.
This process will generate a unique QR code for each device.
These QR codes can be scanned via the mobile application or on the web dashboard.
Once a QR code is scanned and the device is created, it will be automatically created on The Things Stack.
Here is an example of a CSV file that could be used for creating static tokens:
Blynk also supports LoRaWAN® Device Identification QR Codes for Automated Onboarding. To use them, follow these steps:
First, create the static tokens as described in the "Onboard using Static Tokens" section.
Construct the QR code in the LoRaWAN format using the Profile ID specified in the advanced settings of The Things Stack integration application card.
Additionally, you can change the Profile ID used in the QR code body. To do so, open the application settings on Blynk, locate to the advanced settings and edit the Profile ID field.
For LoRaWAN QR codes, Blynk requires the following:
The code must start with LW:D0
.
It must contain the Join EUI (same as App EUI), Device EUI, and the Profile ID.
Optionally, it may contain a checksum.
Any other parts of the QR code are ignored.
Here is an example of how the QR code data should be structured:
Here is an example of the QR code body with Join EUI = 70B3D57ED0000010
, Device EUI = 0018B20000000101
and Profile ID = 000AF8BE
:
Then this QR code can be scanned in the same way as Static Tokens in the mobile application or on the console. Once the device is created, it will be automatically onboarded on The Things Stack.
If you've changed your hardware or updated any LoRaWAN connection parameters (such as DevEUI, AppEUI/JoinEUI, or Application Key), you will need to create a new device in The Things Stack.
To retain the historical data, settings, or any other details for the old device in Blynk, follow these steps:
Navigate to the Device Information & Metadata tab for the old device in Blynk.
Update the TheThingsNetwork Device ID metafield.
Optionally, you can also update other related metafields like DevEUI, JoinEUI, and Application Key.
If the new device goes online in The Things Stack before updating the metafields in Blynk, it may be automatically imported into Blynk. In case of a TheThingsNetwork Device ID collision (where two devices have the same ID), Blynk will randomly select one device. To resolve this, simply delete the automatically imported device to ensure the correct one is used.