Creating Azure IoT Device Template

Imagine you have two kinds of IoT devices. The first group is sending temperature and humidity readings, and the other group is sending ambient light and UV Index readings to the Azure IoT Central. In this case, you need to separate the devices according to their technical capabilities.

Device Templates make separating devices easier. For the environmental sensor device, you can create an "Environmental Sensor" device template, set which data the device sends, and then generate as much as devices you need.

To create a device template, first, log in to your azureiotcentral.com account, find the "Device Templates" link from the left menu, and click "+ New" from the top right corner. Select "Custom," and give your template a name, such as "Environmental Sensor."

From the Measurements tab, click "+ New Measurement," select "Telemetry."

"Create Telemetry" page includes all the details for just one reading of your device. If your device sends multiple sensor readings, you can add each of them one by one.

Here are the parameters on the page:

  • Display Name: The name of this measurement displayed throughout your app.
  • Field Name: The identifier used in your device code to refer to this measurement. For example, "temp."
  • Unit: Units used for the reading.
  • Minimum Value: The lowest value you expect to observe for this measurement. It is used to scale the chart to show meaningful data.
  • Maximum Value: The highest amount you expect to see for this measurement.
  • Decimal Places: Number of decimal places used to round this telemetry value.
  • Color: Color is used to denote this state across Azure IoT Central.

After adding the first telemetry type, click save, and do the same for the humidity reading, for example. When you complete adding telemetry types, wait a few minutes. You'll see some random data on the graph. Its because IoT Central adds a simulated device as you create the device template.

To add or modify real and simulated devices, go to "Device Explorer" from the left menu. You'll see a few templates here. To add a real device, click "+" icon from the top menu, and select real. In the Create New Device window, enter a device ID and device name, and create it. To get the device connection data, go to the device you created, and click the "Connect" button. You can copy the Scope ID, Device ID, and Credentials from this window.