Giter VIP home page Giter VIP logo

device-twin-routing-demo's Introduction

Device twin routing demo

This repository contains the code of a simulated device interacting with an Azure IoT Hub.
It has been built for a blog post I have written on IoT Hub message routing for device twin change events.

How to get started with this ?

To run this on your machine follow this steps:

  1. Install the .NET 5 SDK if you don't already have it
  2. Create an Azure IoT Hub on your subscription in the Free or Standard Tier
  3. Create a device in your hub, with SAS authentication, and copy it connection string
  4. Clone the repo, go in the src/DeviceClientApp folder and set the connection string with the following command: dotnet user-secrets set "DeviceConnectionString" "<YOUR-DEVICE-CONNECTION-STRING>"
  5. You're ready to launch it using the dotnet run command !

What does it do ?

The first time the program is run for a device, it should give the following output:

$ dotnet run
DeviceClient created ! Getting current twin...
First time with this device, let's initialize it !
Done ! Exiting now...

This first run creates two reported properties:

  • propertyUsedOnlyOnce which will never be used again ๐Ÿ˜”
  • color set to Red

The next runs of the tool will change the value of the color property to Blue, then back to Red, then back to Blue, and so on...
But why ? Well, it's just for a demo, read the blog post to find out more !

device-twin-routing-demo's People

Contributors

xaviermignot avatar

Stargazers

Pavel avatar

Watchers

James Cloos avatar  avatar

device-twin-routing-demo's Issues

no event is triggered by UpdateReportedPropertiesAsync

Hi I am trying to repeat the same exercise and downloaded your repo to try against my device
I sent the update and see them on the device itlsef.

image

I set no routing
But see no events that are triggered to reported properties update only for telemetry.
Can you try from your side to check is it just my issues?
image

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.