Azure / iotedge

The IoT Edge OSS project
MIT License
1.45k stars 458 forks source link

Need a way to send device modelId #6420

Closed TahaSnoussi closed 2 years ago

TahaSnoussi commented 2 years ago

Using the SDK, the device is able to announce it's modelId. Each module is also able to announce it's modelId. Can't this be ported to device level with IoT Edge enabled devices?

varunpuranik commented 2 years ago

@TahaSnoussi : Can you please elaborate on what you mean by "Can't this be ported to device level with IoT Edge enabled devices?"? What scenario are you looking to enable?

On IoT Edge devices, the device identity is exposed by the Identity Service to applications running on the device (https://github.com/Azure/iot-identity-service/blob/main/docs/api/identity-service.md#get-iot-device-provisioning-result). But none of the IoT Edge components, or the module workloads supported by IoT Edge use the device identity - they all use their respective module identities.

TahaSnoussi commented 2 years ago

Hello @varunpuranik

The scenario I'm looking to enable is using IoT Plug & Play with an IoT Edge enabled devices. https://docs.microsoft.com/en-us/azure/iot-develop/concepts-developer-guide-device?pivots=programming-language-csharp

Is there a way for an IoT Edge device to announce it's modelId?

varunpuranik commented 2 years ago

@TahaSnoussi :

Does that answer your question?

varunpuranik commented 2 years ago

@TahaSnoussi - please let me know if you have any further questions. If not can you please close this issue?

micahl commented 2 years ago

@TahaSnoussi are you expecting the device to be connected and managed via IoT Central? Or is this for your own cloud application?

TahaSnoussi commented 2 years ago

@micahl I'm trying to use some features of Plug & Play without using IoT Central. @varunpuranik I'm still trying to find a proper solution to make an IoT Edge Device announce its modelId but from your feedback that's a no go with current implementation. So you can close this issue.

What I implemented for now is the following:

This way, a Sensor module is represented by a component of a device in digital twin. If I update a sensor to send additional telemetry, I update the model version (in the modelId) and update the device and sensor models in digital twin.

Do you think this is viable?

micahl commented 2 years ago

This way, a Sensor module is represented by a component of a device in digital twin.

@TahaSnoussi would having the Sensor module announce its own modelId not work for your scenario? I'd like to better understand why using a component on the device identity might be preferred to using the module.

micahl commented 2 years ago

@TahaSnoussi I recommend consolidating to a single IoT Edge module that is responsible for reading and transmitting the sensor data. The module could then announce its model ID. That DTDL model might contain multiple components. When/if you add/remove a sensor or change the schema for the expected telemetry then the change is to that single module which is responsible for announcing its model ID after it has been successfully deployed and (I think) avoids the need for using tags like you've described above.