Giter Site home page Giter Site logo

iot-plugandplay-models's Introduction

Azure/iot-plugandplay-models repository

This repository includes DTDL models that are made publicly available on https://devicemodels.azure.com. These models can be used to create Azure IoT Plug and Play solutions.

Related tools, samples, and specs can be found in the Azure/iot-plugandplay-models-tools repo. The current repo only stores DTDL models.

Submit a model

  1. Fork the public GitHub repo: https://github.com/Azure/iot-plugandplay-models.
  2. Clone the forked repo. Optionally create a new branch to keep your changes isolated from the main branch.
  3. Add the new interfaces to the dtmi folder using the folder/filename convention. See the add-models tool below.
  4. Validate the models locally using the dmr-client tool to validate.
  5. Commit the changes locally and push to your fork.
  6. From your fork, create a PR that targets the main branch. See Creating an issue or pull request docs.
  7. Review the PR requirements

The PR triggers a series of GitHub actions that will validate the new submitted interfaces, and make sure your PR satisfies all the checks.

Microsoft will respond to a PR with all checks in 3 business days.

dmr-client Tool

The tools used to validate the models during the PR checks can also be used to add and validate the DTDL interfaces locally.

Note: These tools require the .NET SDK (3.1 or greater)

Install dmr-client

Linux/Bash

curl -L https://aka.ms/install-dmr-client-linux | bash

Windows/Powershell

iwr https://aka.ms/install-dmr-client-windows -UseBasicParsing | iex

Import a Model to the dtmi/ folder

If you have your model already stored in json files, you can use the dmr-client import command to add those to the dtmi/ folder with the right file name.

# from the local repo root folder
dmr-client import --model-file "MyThermostat.json"

Note: You can use the --local-repo argument to specify the local repo root folder

Validate Models

You can validate your models with the dmr-client validate command.

dmr-client validate --model-file ./my/model/file.json

Note: The validation uses the latest DTDL parser version to ensure all the interfaces are compatible with the DTDL language spec

To validate external dependencies, those must exist in the local repo. To validate those you can specify a local or remote folder to validate against.

# from the repo root folder
dmr-client validate --model-file ./my/model/file.json --repo .

Strict validation

The Device Model Repo includes additional requirements, these can be validated with the strict flag.

dmr-client validate --model-file ./my/model/file.json --repo . --strict true

Export models

Models can be exported from a given repo (local or remote) to a single file using a JSON Array.

dmr-client export --dtmi "dtmi:com:example:TemperatureController;1" -o TemperatureController.expanded.json

Consuming

Any HTTP client can consume the models by just applying the convention to translate DTMI ids to relative paths:

Eg, the interface:

dtmi:azure:DeviceManagement:DeviceInformation;1

can be retrieved from here:

https://devicemodels.azure.com/dtmi/azure/devicemanagement/deviceinformation-1.json

There are samples for .NET and Node in the Azure/iot-plugandplay-models-tools with code you can use to acquire models from your custom IoT solution.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

iot-plugandplay-models's People

Contributors

rido-min avatar montgomp avatar microsoftopensource avatar digimaun avatar paul53huang avatar allanchen1971 avatar ericmitt avatar fihlie avatar benqdisplayiot avatar gloveboxes avatar freddiechopin avatar clm6rt avatar ravichandranrajamanickam avatar rebeccaleigh avatar ryanwinter avatar matsujirushi avatar microsoft-github-operations[bot] avatar pbliss avatar uriel-kluk avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.