Azure / iot-edge-v1

Azure IoT Edge
http://azure.github.io/iot-edge/
Other
524 stars 258 forks source link

Device Management support (e.g. Device Twins?) #102

Open obsoleted opened 7 years ago

obsoleted commented 7 years ago

Is there support for the device management features in the gateway sdk?

I'm specifically wondering how to add device twin functionality to my solution. I would have thought there would be some way for the iothub module to report state and get desired state and message accordingly to/from other modules. But this doesn't appear to be wired up (yet?). I suppose I could augment the iothub module or create a new one but that might make it difficult to update to newer versions of the sdk in the future.

According to https://azure.microsoft.com/en-us/blog/introducing-azure-iot-hub-device-management/

Device management is also a key part of the Azure IoT Gateway SDK...

But unfortunately I haven't found the best way to get at it yet.

Any pointers or suggestions would be appreciated.

chipalost commented 7 years ago

Device management through the gateway is a key part of our strategy; however it is not available yet. Device management was in the private preview 1 stage when that blog post was written. We had the original solution plumbed through the gateway; however due to customer feedback we expanded the scope of our device management infrastructure. That resulted in DM private preview 2 and the bits we recently GAed. Unfortunately that change in course effected the gateway work we had done. We are now working to make sure our new twins have a great story with gateways.

damonbarry commented 7 years ago

@obsoleted Like @chipalost said, that work is in our backlog. We've added the enhancement label, and we'll keep this issue open until DM work in the gateway is completed.

arkuhn commented 7 years ago

@chipalost @damonbarry @darobs I'm not exactly sure of the status of these operations. Since the "IoT Edge SDK" release are there still plans to add device management? I'm personally interested in Device Twin and Direct Method gateway capabilities. Thanks in advance for your time and consideration.

sympthom commented 7 years ago

What's the update on this, since Device Twin is a great feature we all are looking for? :)

Thanks for an amazing work/project!

damonbarry commented 6 years ago

Version 2 of IoT Edge, which is available for public preview as of last week, has first-class support for device management—both for the edge device itself as well as things that connect to it. More info here.

The challenge with v1 is translating the service API for DM into the custom messages that get passed around the broker. Not difficult work to do, but there’s a maintenance cost to us maintaining our own version of the DM APIs just for v1.

kiranpradeep commented 6 years ago

@damonbarry Surprised by the term "first-class" support and so wanted to confirm I am missing any thing here. With V2 preview, as it is now, I see 3 issues which might make it unusable for most. Please correct me if I am wrong.

  1. The service SDK is missing ways to create/modify module twins programatically. Currently user needs to use Azure portal(manual actions) to perform all V2 actions manually. In C# Service SDK(0) I see a module-preview branch with out any real code. All we have is a NuGet preview module(1) with out any docs/tutorials. Who ever relied on Node.JS service SDK for V1 are left out.

  2. C/C++ modules in modules-preview(2) branch are yet to have ways to get JSON fields from module twins. Only C# modules can do that. Who ever relied on C++ for developing there V1 modules are left out.

  3. Even with C#, there are no source samples for creating transparent gateways. What ever examples available are for opaque gateways only.

damonbarry commented 6 years ago

Being a preview, you can expect more features and documentation to show up in the v2 offering over time. To address specific comments:

The service SDK is missing ways to create/modify module twins programatically.

If you have a look at the NuGet package or the source code (the URLs you gave are the right ones), you'll see that the class which allows you to manage device identities today, Microsoft.Azure.Devices.RegistryManager, has been augmented with methods that allow you to do the same for modules: AddModuleAsync, GetTwinAsync(deviceId, moduleId, ...), etc.

Currently user needs to use Azure portal(manual actions) to perform all V2 actions manually.

The service SDK has all the primitives in place for doing deployments and other v2 stuff. I agree that there's a lack of documentation about service-oriented tasks, and that the portal is your best bet for trying out the new features quickly and easily. CLI support is progressing, and will be made available when it is ready.

In C# Service SDK(0) I see a module-preview branch with out any real code.

I'm not sure what you mean. If you compare the modules-preview branch to master in the C# SDK repo, today there are 146 changed files, and fully one third of them are under the service/ folder. The Azure portal uses this SDK for everything it does.

All we have is a NuGet preview module(1) with out any docs/tutorials.

True enough, although you can expect to see expanded documentation and tutorials over time.

Who ever relied on Node.JS service SDK for V1 are left out.

The C# and C SDKs are currently available (modules-preview branches in both repos). The Node.js SDK is being worked on, and will be available as soon as it's ready.

C/C++ modules in modules-preview(2) branch are yet to have ways to get JSON fields from module twins.

I don't think we've implemented "get twin" for the C SDK yet--I need to confirm that with the SDK team, but that's what I'm seeing. If that's the case, then that feature will roll out in the preview branch when it's ready.

Even with C#, there are no source samples for creating transparent gateways.

What do you mean by transparent vs. opaque gateways?

Thanks for the questions!

kiranpradeep commented 6 years ago

@damonbarry Thanks a lot for the replies. So the understanding is that, we have full support for V2 modules in C# SDKs. Who ever relied on other languages needs to wait for update.

In C# Service SDK(0) I see a module-preview branch with out any real code.

My bad. I am sorry. That was a failing GitHub search. I wasn't aware that GitHub indexes only master (even if select the branch explicitly in web interface). Now I cloned the branch and a local machine search lists all code.

What do you mean by transparent vs. opaque gateways?

This is documented in Azure iot-edge docs(1). Basically transparent gateway allows you to identify all end devices individually.

I understand the following is not the right question. Please ignore if you cannot answer it.

  1. Approximate timelines for C SDK with "get twin" access.
mar1a commented 6 years ago

Our development environment involves iot-edge's azure-iot-sdk-c to connect/communicate to the IoT Hub(Our device runs C/C++ application). We would like to utilize the tags of the device twin from our device.

Hence we would like to know the timeline for the complete C SDK Device twin feature availability.

darobs commented 6 years ago

The C SDK is tracking this issue with https://github.com/Azure/azure-iot-sdk-c/issues/154

Yes, the plan is to report the full Twin to the user, similar to GetTwinAsync() on the C# client.

The work is coming, and the current plan is to start the work within the month.

arkuhn commented 6 years ago

@darobs Thanks so much for the update on this.

Senthamizhgp commented 6 years ago

Any update on the probable completion timeline for the C SDK Device twin feature?

darobs commented 6 years ago

This is still recognized as a needed feature, but it looks like this was delayed. I talked to the developer, and the feature is "happy path" working, but not tested and validated.