AVNET's iotconnect.io cloud platform is an online service that you can use to send data to, and then show it on a dashboard*. In this blog series I'm learning how to talk to it with Node-RED. In this post: set up the device, rules, capabilities and security. |
Before you can connect a device, you have to register it.
It can be done in a few ways: in the portal, using a (mass) upload file or with an API.
I'm registering my thing via the portal.
There are 2 steps:
- create a template. This is a description of the data that can be exchanged, the commands that can be sent, and the security options
- register the device and assign the template to it.
That's it.
Create a Template and define what can be exchanged between the device and cloud
In the portal, select the Device menu.
Then prepare to creat a straightforward device (there are several other types, such as edge and gateway, that I'll review later).
Do that by clicking on the Device hyperlink marked with the arrow in the capture above.
Then select the Templates menu, and create a template.
The template will be used for the Node-RED series, so I name it for that.
You can define
- the attributes that the device will be able to send to you (data, telemetry)
- the commands you can send to the device (notifications, enable/disable, set a parameter, firmware upgrade, ...)
- the security model.
Security:
In this part of the blog, I'm using Key security. Later I'll review certificate based access.
I've set it in the screen capture above.
Attributes:
Attributes define the data that the cloud will accept from the device. Only the ones listed in the template are allowed.
I'm using an attribute that's easy to get or to fake: Temperature.
Additional advantage is that it's a numerical value. A template must have at least one numerical attribute (for a reason not known to me).
If you set more than one attribute, it does not mean you have to exchange them all at the same time.
You can send them as single combinations, or in any combination that fits the flow.
Commands:
Commands define the interface between cloud and your device.
When working in the portal later, you can only select and send commands that you define here.
I'm going to create two functions that both do the same: tell the device what the desired temperature is.
But one command will "send and forget". The second one will ask a confirmation (receipt).
Here is the one that does not request a receipt.
And here is a version that expects a receipt. You can report on the missing confirmations.
That's it for now. The template is now good as a starter.
Create your Device
Now let's register the device.
Enter name and description.
The entitiy is the company you created when you signed on to iotconnect.io.
Select the template that we just created.
Notice that creating a device is way faster than creating a template. That's good.
Because you typically have a few templates in the real world, but many things. If your business is successful.
The device is now acquired. All is ready for the next post, where we'll create a Node-RED flow and connect.
Until that happened, the device will show a red dot next to it (see the image at the top of this post). Let's work to get it green...