Skip to content

Commit

Permalink
doc: Merge pull request #961 from dominicbetts/onboard-pnp-samples
Browse files Browse the repository at this point in the history
Update readme for PnP samples
  • Loading branch information
cartertinney authored May 3, 2021
2 parents 94d973d + 920f4b1 commit 91553ee
Showing 1 changed file with 30 additions and 6 deletions.
36 changes: 30 additions & 6 deletions device/samples/pnp/readme.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,38 @@
# Samples to demonstrate Azure IoT Plug and Play
---
page_type: sample
description: "A set of JavaScript samples that show how a device that uses the IoT Plug and Play conventions interacts with either IoT Hub or IoT Central."
languages:
- javascript
products:
- azure-iot-hub
- azure-iot-central
- azure-iot-pnp
urlFragment: azure-iot-pnp-device-samples-for-javascript
---

The samples in this directory demonstrate how to implement an Azure IoT Plug and Play device. Azure IoT Plug and Play is documented [here](aka.ms/iotpnp). The samples assume basic familiarity with Plug and Play concepts, though not in depth knowledge of the Plug and Play "convention". The "convention" is a set of rules for serializing and de-serialing data that uses IoTHub primitives for transport which the samples themselves implement.
# IoT Plug And Play device samples

## Directory structure
These samples demonstrate how a device that follows the [IoT Plug and Play conventions](https://docs.microsoft.com/azure/iot-pnp/concepts-convention) interacts with IoT Hub or IoT Central, to:

The directory contains the following samples:
- Send telemetry.
- Update read-only and read-write properties.
- Respond to command invocation.

* [simple_thermostat](./simple_thermostat) A simple thermostat that implements the model [dtmi:com:example:Thermostat;1](https://github.com/Azure/opendigitaltwins-dtdl/blob/master/DTDL/v2/samples/Thermostat.json). This sample is considered simple because it only implements one component, the thermostat itself. **You should begin with this sample.**
The samples demonstrate two scenarios:

* [pnpTemperatureController](./pnpTemperatureController) A temperature controller that implements the model [dtmi:com:example:TemperatureController;1](https://github.com/Azure/opendigitaltwins-dtdl/blob/master/DTDL/v2/samples/TemperatureController.json). This is considerably more complex than the [simple_thermostat](./simple_thermostat) and demonstrates the use of subcomponents. **You should move onto this sample only after fully understanding simple_thermostat.**
- An IoT Plug and Play device that implements the [Thermostat](https://devicemodels.azure.com/dtmi/com/example/thermostat-1.json) model. This model has a single interface that defines telemetry, read-only and read-write properties, and commands.
- An IoT Plug and Play device that implements the [Temperature controller](https://devicemodels.azure.com/dtmi/com/example/temperaturecontroller-2.json) model. This model uses multiple components:
- The top-level interface defines telemetry, read-only property and commands.
- The model includes two [Thermostat](https://devicemodels.azure.com/dtmi/com/example/thermostat-1.json) components, and a [device information](https://devicemodels.azure.com/dtmi/azure/devicemanagement/deviceinformation-1.json) component.

## Quickstarts and tutorials

To learn more about how to configure and run the Thermostat device sample with IoT Hub, see [Quickstart: Connect a sample IoT Plug and Play device application running on Linux or Windows to IoT Hub](https://docs.microsoft.com/azure/iot-pnp/quickstart-connect-device?pivots=programming-language-javascript).

To learn more about how to configure and run the Temperature Controller device sample with:

- IoT Hub, see [Tutorial: Connect an IoT Plug and Play multiple component device application running on Linux or Windows to IoT Hub](https://docs.microsoft.com/azure/iot-pnp/tutorial-multiple-components?pivots=programming-language-javascript)
- IoT Central, see [Tutorial: Create and connect a client application to your Azure IoT Central application](https://docs.microsoft.com/azure/iot-central/core/tutorial-connect-device?pivots=programming-language-javascript)

## Configuring the samples

Expand Down

0 comments on commit 91553ee

Please sign in to comment.