This article explains how device vendors can let their end-users rollout IP connected devices (WiFi/LAN/LTE-M) using activation codes.
Activations enable device manufacturers to pre-provision rollout process of their devices. As soon as end-users rollout the device on Maker they will start using the data, without having to exchange device credentials.
Besides LPWAN devices, activations are supported for IP connected devices (WiFi/LAN/LTE-M etc).
To follow the article you’ll need a partner account on Maker, while the implementation on the edge device is explained using cURL.
Here’s the example partner account we’re using in the article:
Partner Id: tension
Partner Token: maker:4UChHyoERJytO0Nw7y0SbviqzXUlJMzDxvW21th1
Device type: tension/slm
The diagram above explains the complete flow:
SECRET
To create an activation, sign in to Maker with your partner account.
In the Device types page, select +NEW DEVICE TYPE
.
When configuring the activation option, from the Connectivity dropdown, select IP connected device
.
Now you need to provide a SECRET
, which the device client will use to retrieve the device credentials once the device is rolled out on Maker.
You can generate any secret, or you can use an identifier which is already on-device, e.g, MAC address, IMEI etc.
Once that’s done, click CREATE
to generate the activation code for the SLM.
You can provide the activation code to the end-user, either printed on a packaging, or any other way.
Once the end-user receives the device, she’ll use the activation code to activate their SLM device on Maker.
From then on, they’ll boot up the device and it will send data to Maker. Let’s see how you’re gonna enable that.
As seen in the flow, once the device boots, it should register on Maker, using secret, to retrieve the device resource credentials.
Here’s how the Register device API request should look like:
curl -X POST \
https://api.allthingstalk.io/partner/tension/register \
-H 'Authorization: Bearer maker:4UChHyoERJytO0Nw7y0SbviqzXUlJMzDxvW21th1' \
-H 'Content-Type: application/json' \
-d '{
"secret": "secret"
}'
If the device has been rolled out by the user, the cloud will response:
{
"id": "M7a6sbjHXLPB5h66Ler8bmUV",
"type": "device",
"token": "spicy:4RxzaaDiEb8LG0lqFy6refytYorNFZlJBCfpiaI0",
"status": "approved"
}
Now the device client have credentials it needs to start sending data to Maker, e.g:
M7a6sbjHXLPB5h66Ler8bmUV
maker:4RxzaaDiEb8LG0lqFy6refytYorNFZlJBCfpiaI0
From now on, device client can send device data normally, e.g.
curl -X PUT \
https://api.allthingstalk.io/device/M7a6sbjHXLPB5h66Ler8bmUV/state \
-H 'Authorization: Bearer maker:4RxzaaDiEb8LG0lqFy6refytYorNFZlJBCfpiaI0' \
-H 'Content-Type: application/json' \
-d '{
"loudness": {
"value": 42
}
}'