You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/iot-central/core/concepts-device-templates.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,7 +39,7 @@ For a device to interact with IoT Central, it must be assigned to a device templ
39
39
IoT Central can automatically assign a device to a device template when the device connects. A device should send a [model ID](../../iot/iot-glossary.md?toc=/azure/iot-central/toc.json&bc=/azure/iot-central/breadcrumb/toc.json#model-id) when it connects. IoT Central uses the model ID to identify the device template for that specific device model. The discovery process works as follows:
40
40
41
41
1. If the device template is already published in the IoT Central application, the device is assigned to the device template.
42
-
1. If the device template isn't already published in the IoT Central application, IoT Central looks for the device model in the [public model repository](https://github.com/Azure/iot-plugandplay-models). If IoT Central finds the model, it uses it to generate a basic device template.
42
+
1. If the device template isn't already published in the IoT Central application, IoT Central looks for the device model in the public device model repository. If IoT Central finds the model, it uses it to generate a basic device template.
43
43
1. If IoT Central doesn't find the model in the public model repository, the device is marked as **Unassigned**. An operator can:
44
44
45
45
- Create a device template for the device and then migrate the unassigned device to the new device template.
Copy file name to clipboardExpand all lines: articles/iot/concepts-architecture.md
+2-5Lines changed: 2 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,11 +25,9 @@ The following diagram shows the key elements of an IoT Plug and Play solution:
25
25
26
26
## Model repository
27
27
28
-
The [model repository](./concepts-model-repository.md) is a store for model and interface definitions. You define models and interfaces using the [Digital Twins Definition Language (DTDL)](https://github.com/Azure/opendigitaltwins-dtdl/blob/master/README.md).
28
+
The [model repository](./concepts-model-discovery.md) is a store for curated model and interface definitions. Models and interfaces are defined using the [Digital Twins Definition Language (DTDL)](https://github.com/Azure/opendigitaltwins-dtdl/blob/master/README.md).
29
29
30
-
The web UI lets you manage the models and interfaces.
31
-
32
-
The model repository has built-in role-based access controls that let you manage access to interface definitions.
30
+
The web UI lets you search for and retrieve the models and interfaces.
33
31
34
32
## Devices
35
33
@@ -89,6 +87,5 @@ The backend solution can use the information from the interface definitions to:
89
87
90
88
Now that you have an overview of the architecture of an IoT Plug and Play solution, the next steps are to learn more about:
91
89
92
-
-[The model repository](./concepts-model-repository.md)
93
90
-[Digital twin model integration](./concepts-model-discovery.md)
94
91
-[Developing for IoT Plug and Play](./concepts-developer-guide-device.md)
Copy file name to clipboardExpand all lines: articles/iot/concepts-model-discovery.md
+56-3Lines changed: 56 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title: Use IoT Plug and Play models in a solution | Microsoft Docs
3
3
description: As a solution builder, learn about how you can use IoT Plug and Play models in your IoT solution.
4
4
author: dominicbetts
5
5
ms.author: dobett
6
-
ms.date: 1/23/2024
6
+
ms.date: 03/13/2024
7
7
ms.topic: conceptual
8
8
ms.service: iot
9
9
---
@@ -111,16 +111,69 @@ A solution can get the model definition by using one of the following options:
111
111
112
112
### Model repository
113
113
114
-
Solutions can use the [model repository](concepts-model-repository.md) to retrieve models. Either the device builders or the solution builders must upload their models to the repository beforehand so the solution can retrieve them.
114
+
Solutions can retrieve DTDL models from the device model repository (DMR). The DMR is a public repository, hosted by Microsoft, that contains a collection of curated DTDL models. The public device models stored in the DMR are available for everyone to consume and integrate in their applications from the public endpoint [https://devicemodels.azure.com](https://devicemodels.azure.com).
115
115
116
116
After you identify the model ID for a new device connection, follow these steps:
117
117
118
-
1. Retrieve the model definition using the model ID from the model repository. For more information, see [Device model repository](concepts-model-repository.md).
118
+
1. Retrieve the model definition using the model ID from the model repository. For more information, see [Resolve models](#resolve-models).
119
119
120
120
1. Using the model definition of the connected device, you can enumerate the capabilities of the device.
121
121
122
122
1. Using the enumerated capabilities of the device, you can enable users to [interact with the device](tutorial-service.md).
123
123
124
+
### Resolve models
125
+
126
+
The DMR conventions include other artifacts for simplifying consumption of hosted models. These features are *optional* for custom or private repositories.
127
+
128
+
-*Index*. All available DTMIs are exposed through an *index* composed by a sequence of json files, for example: [https://devicemodels.azure.com/index.page.2.json](https://devicemodels.azure.com/index.page.2.json)
129
+
-*Expanded*. A file with all the dependencies is available for each interface, for example: [https://devicemodels.azure.com/dtmi/com/example/temperaturecontroller-1.expanded.json](https://devicemodels.azure.com/dtmi/com/example/temperaturecontroller-1.expanded.json)
130
+
-*Metadata*. This file exposes key attributes of a repository and is refreshed periodically with the latest published models snapshot. It includes features that a repository implements such as whether the model index or expanded model files are available. You can access the DMR metadata at [https://devicemodels.azure.com/metadata.json](https://devicemodels.azure.com/metadata.json)
131
+
132
+
To programmatically access the public DTDL models in the DMR, you can use the `ModelsRepositoryClient` available in the NuGet package [Azure.IoT.ModelsRepository](https://www.nuget.org/packages/Azure.IoT.ModelsRepository). This client is configured by default to query the public DMR available at [devicemodels.azure.com](https://devicemodels.azure.com/) and can be configured to any custom repository.
133
+
134
+
The client accepts a `DTMI` as input and returns a dictionary with all required interfaces:
The expected output displays the `DTMI` of the three interfaces found in the dependency chain:
145
+
146
+
```txt
147
+
dtmi:com:example:TemperatureController;1
148
+
dtmi:com:example:Thermostat;1
149
+
dtmi:azure:DeviceManagement:DeviceInformation;1
150
+
```
151
+
152
+
The `ModelsRepositoryClient` can be configured to query a custom DMR -available through http(s)- and to specify the dependency resolution by using the `ModelDependencyResolution` flag:
153
+
154
+
- Disabled. Returns the specified interface only, without any dependency.
155
+
- Enabled. Returns all the interfaces in the dependency chain
156
+
157
+
> [!TIP]
158
+
> Custom repositories might not expose the `.expanded.json` file. When this file isn't available, the client will fallback to process each dependency locally.
159
+
160
+
The following sample code shows how to initialize the `ModelsRepositoryClient` by using a custom repository base URL, in this case using the `raw` URLs from the GitHub API without using the `expanded` form since it's not available in the `raw` endpoint. The `AzureEventSourceListener` is initialized to inspect the HTTP request performed by the client:
There are more samples available in the Azure SDK GitHub repository: [Azure.Iot.ModelsRepository/samples](https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/modelsrepository/Azure.IoT.ModelsRepository/samples).
176
+
124
177
### Custom store
125
178
126
179
Solutions can store these model definitions in a local file system, in a public file store, or use a custom implementation.
0 commit comments