Skip to content

Commit 96a70ca

Browse files
authored
Merge pull request #112636 from dominicbetts/central-template-versioning
Refresh template versioning article
2 parents 12c3856 + e20504d commit 96a70ca

File tree

1 file changed

+81
-26
lines changed

1 file changed

+81
-26
lines changed

articles/iot-central/core/howto-version-device-template.md

Lines changed: 81 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Understanding device template versioning for your Azure IoT Central apps
33
description: Iterate over your device templates by creating new versions and without impacting your live connected devices
44
author: sarahhubbard
55
ms.author: sahubbar
6-
ms.date: 12/09/2019
6+
ms.date: 04/24/2020
77
ms.topic: how-to
88
ms.service: iot-central
99
services: iot-central
@@ -14,58 +14,111 @@ manager: peterpr
1414

1515
*This article applies to solution builders and device developers.*
1616

17-
Azure IoT Central allows rapid development of IoT Applications. You can quickly iterate over your device template designs by adding, editing, or deleting device capabilities, views, and customizations. Once you have published your device template, the device capability model shows as **Published** with lock icons next to the model. In order to make changes to the device capability model, you will need to create a new version of the device template. Meanwhile the cloud properties, customizations, and views can all be edited at any time without needing to version the device template. Once you have saved any of these changes, you can publish the device template to make the latest changes available for the operator to view in Device Explorer.
17+
A device template includes a schema that describes how a device interacts with IoT Central. These interactions include telemetry, properties, and commands. Both the device and the IoT Central application rely on a shared understanding of this schema to exchange information. You can only make limited changes to the schema without breaking the contract, that's why most schema changes require a new version of the device template. Versioning the device template lets older devices continue with the schema version they understand, while newer or updated devices use a later schema version.
18+
19+
The schema in a device template is defined in the device capability model (DCM) and its interfaces. Device templates include other information, such as cloud properties, display customizations, and views. If you make changes to those parts of the device template that don't define how the device exchanges data with IoT Central, you don't need to version the template.
20+
21+
You must publish any device template changes, whether or not they require a version update, before an operator can use it. IoT Central stops you from publishing breaking changes to a device template without first versioning the template.
1822

1923
> [!NOTE]
2024
> To learn more about how to create a device template see [Set up and manage a device template](howto-set-up-template.md)
2125
22-
## Add customizations to the device template without versioning
26+
## Versioning rules
27+
28+
This section summarizes the versioning rules that apply to device templates. Both DCMs and interfaces have version numbers. The following snippet shows the DCM for an environmental sensor device. The DCM has two interfaces: **DeviceInformation** and **EnvironmentalSensor**. You can see the version numbers at the end of the`@id` fields. To view this information in the IoT Central UI, select **View identity** in the device template editor.
29+
30+
```json
31+
{
32+
"@id": "urn:contoso:sample_device:1",
33+
"@type": "CapabilityModel",
34+
"implements": [
35+
{
36+
"@id": "urn:contoso:sample_device:deviceinfo:1",
37+
"@type": "InterfaceInstance",
38+
"name": "deviceinfo",
39+
"schema": {
40+
"@id": "urn:azureiot:DeviceManagement:DeviceInformation:1",
41+
"@type": "Interface",
42+
"displayName": {
43+
"en": "Device Information"
44+
},
45+
"contents": [...
46+
]
47+
}
48+
},
49+
{
50+
"@id": "urn:contoso:sample_device:sensor:1",
51+
"@type": "InterfaceInstance",
52+
"name": "sensor",
53+
"schema": {
54+
"@id": "urn:contoso:EnvironmentalSensor:2",
55+
"@type": "Interface",
56+
"displayName": {
57+
"en": "Environmental Sensor"
58+
},
59+
"contents": [...
60+
]
61+
}
62+
}
63+
],
64+
"displayName": {
65+
"en": "Environment Sensor Capability Model"
66+
},
67+
"@context": [
68+
"http://azureiot.com/v1/contexts/IoTModel.json"
69+
]
70+
}
71+
```
72+
73+
* After a DCM is published, you can't remove any interfaces, even in a new version of the device template.
74+
* After a DCM is published, you can add an interface if you create a new version of the device template.
75+
* After a DCM is published, you can replace an interface with a newer version if you create a new version of the device template. For example, if the sensor v1 device template uses the EnvironmentalSensor v1 interface, you can create a sensor v2 device template that uses the EnvironmentalSensor v2 interface.
76+
* After an interface is published, you can't remove any of the interface contents, even in a new version of the device template.
77+
* After an interface is published, you can add items to the contents of an interface if you create a new version of the interface and device template. Items that you can add to the interface include telemetry, properties, and commands.
78+
* After an interface is published, you can make non-schema changes to existing items in the interface if you create a new version of the interface and device template. Non-schema parts of an interface item include the display name and the semantic type. The schema parts of an interface item that you can't change are name, capability type, and schema.
79+
80+
The following sections walk you through some examples of modifying device templates in IoT Central.
81+
82+
## Customize the device template without versioning
2383

2484
Certain elements of your device capabilities can be edited without needing to version your device template and interfaces. For example, some of these fields include display name, semantic type, minimum value, maximum value, decimal places, color, unit, display unit, comment, and description. To add one of these customizations:
2585

2686
1. Go to the **Device Templates** page.
2787
1. Select the device template you wish to customize.
2888
1. Choose the **Customize** tab.
29-
1. All of the capabilities defined in your device capability model will be listed here. All of the fields you can edit here can be saved and used across your application, without needing to version your device template. If there are fields you wish to edit that are read-only, you will need to version your device template to change these. Select a field you wish to edit and enter in any new values.
30-
1. Click **Save**. Now these values will override anything that was initially saved in your device template and will be used across the application.
89+
1. All the capabilities defined in your device capability model are listed here. You can edit, save, and use all of these fields without the need to version your device template. If there are fields you wish to edit that are read-only, you must version your device template to change them. Select a field you wish to edit and enter in any new values.
90+
1. Click **Save**. Now these values override anything that was initially saved in your device template and are used across the application.
3191

32-
## Versioning a device template
92+
## Version a device template
3393

34-
Creating a new version of your device template will create a draft version of the template where the device capability model can be edited. Any published interfaces will remain published until they are individually versioned. In order to modify a published interface, you must first create a new device template version.
94+
Creating a new version of your device template creates a draft version of the template where the device capability model can be edited. Any published interfaces remain published until they're individually versioned. To modify a published interface, first create a new device template version.
3595

36-
The device template should only be versioned when you are trying to edit a part of the device capability model that you can not edit in the customizations section of the device template.
96+
Only version the device template when you're trying to edit a part of the device capability model that you can't edit in the customizations section.
3797

38-
In order to version a device template:
98+
To version a device template:
3999

40100
1. Go to the **Device Templates** page.
41-
1. Select the device template you are trying to version.
42-
1. Click the **Version** button at the top of the page and give the template a new name. We have suggested a new name for you which can be edited.
101+
1. Select the device template you're trying to version.
102+
1. Click the **Version** button at the top of the page and give the template a new name. IoT Central suggests a new name, which you can edit.
43103
1. Click **Create**.
44-
1. Now your device template is in draft mode. You will see your interfaces are still locked and must be individually versioned to be edited.
104+
1. Now your device template is in draft mode. You can see your interfaces are still locked. Version any interfaces you want to modify.
45105

46-
### Versioning an interface
106+
## Version an interface
47107

48-
Versioning an interface allows you to add, update, and remove the capabilities inside the interface you had already created.
108+
Versioning an interface allows you to add, update, and remove the capabilities inside the interface you had already created.
49109

50-
In order to version an interface:
110+
To version an interface:
51111

52112
1. Go to the **Device Templates** page.
53113
1. Select the device template you have in a draft mode.
54114
1. Select the interface that is in published mode that you wish to version and edit.
55-
1. Click the **Version** button at the top of the interface page.
115+
1. Click the **Version** button at the top of the interface page.
56116
1. Click **Create**.
57-
1. Now your interface is in draft mode. You will be able to add or edit capabilities to your interface without breaking existing customizations and views.
58-
59-
> [!NOTE]
60-
> Standard interfaces published by Azure IoT can not be versioned or edited. These standard interfaces are used for device certification.
61-
62-
> [!NOTE]
63-
> Once the interface has been published, you can not delete any of it's capabilities even in a draft mode. Capabilities can only be edited or added to the interface in draft mode.
117+
1. Now your interface is in draft mode. You can add or edit capabilities to your interface without breaking existing customizations and views.
64118

119+
## Migrate a device across versions
65120

66-
## Migrate a device across device template versions
67-
68-
You can create multiple versions of the device template. Over time, you will have multiple connected devices using these device templates. You can migrate devices from one version of your device template to another. The following steps describe how to migrate a device:
121+
You can create multiple versions of the device template. Over time, you'll have multiple connected devices using these device templates. You can migrate devices from one version of your device template to another. The following steps describe how to migrate a device:
69122

70123
1. Go to the **Device Explorer** page.
71124
1. Select the device you need to migrate to another version.
@@ -76,4 +129,6 @@ You can create multiple versions of the device template. Over time, you will hav
76129

77130
## Next steps
78131

132+
If you're an operator or solution builder, a suggested next step is to learn [how to manage your devices](./howto-manage-devices.md).
133+
79134
If you're a device developer, a suggested next step is to read about [Azure IoT Edge devices and Azure IoT Central](./concepts-iot-edge.md).

0 commit comments

Comments
 (0)