JooGomes-1123 avatar image
1 Vote"
JooGomes-1123 asked ·

[Technical Question] Azure Edge solution on python can't create multiple device twins?

The objective of the project is to have a mesh network connected to the edge device (Raspberry PI) and this edge connected to the IoT Hub and azure portal.

Because our Mesh module is already in python, we wanted to try to be coherent if possible and develop all other modules in python as well. The problem is:

I want to create multiple twins, one for each device in the mesh network, but the python sdk, contrary to the java one, doesn't seem to have a devicetwin class, for which we can start multiple twins depending on the object used.

I tried passing the devices as a json array in the normal device twin reporter properties, but it doesn't support arrays.

Anyone as any experience with this or a different solution? Or should I just give up and have a java module if I want to mess around with multiple device twins?

So I think I misunderstood something, the java code I analyzed as base is acting as a identity translation gateway, it opens multiple device clients that I think are signed with different keys, therefore not creating an error.

I didn't notice this and in python tried to open 2 device clients but with same keys, and that's probably why it didn't work.

So my question now is another one, lets imagine I scan the mesh network and find 2 devices, I want to automatically add them to the IoTHub from the edge, is this possible? Do I have to manually add devices if I want to have a device twin on the Hub? These devices would probably have to keep their own keys stored in their memory?

· 2
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @JooGomes-1123 Welcome to Microsoft Q&A Platform and thanks for your query. Let me check on the python SDK,

0 Votes 0 ·

Hello @JooGomes-1123 we have escalated this issue internally with our team and are working on it.

0 Votes 0 ·

1 Answer

SatishBoddu-MSFT avatar image
0 Votes"
SatishBoddu-MSFT answered ·

Hello @JooGomes-1123 You may be interested in the below content. There are many helping tutorials in the public forums, I just wanted to make sure that you get the best one without boring stuff, so please go through these and let me know your feedback in the below comment section.

So first things of 'How Azure DPS is helping us' can be summarized in the below steps: Borrowed from the Blog written by @KevinSaye-6088 , Click this link to read more.

  1. Establish a “trust” where DPS trust the verified issuing cert and add a group enrollment. [The root CA is not needed].

  2. Create a “device” certificate issued by the Issuing CA and get the certificate to the device

  3. Via the SDK, the device attempts authentication to with a unique scope id and the certificate.

  4. DPS verifies the cert was issued by the Issuing CA and creates / updates the identity in IoT Hub with the thumbprint of the certificate.

  5. DPS returns deviceId and fully qualified host name of the IoT Hub to the IoT device. [Related to your query-->This is how my device(s) know the connection string]

  6. The IoT device authenticates to the fully qualified host name of the IoT Hub with the certificate and the device id.

The below image is borrowed from the blog post by 'Kevin Saye' : @KevinSaye-6088


Device provisioning at scale : Published April 30, 2020 | 2:00 PM ET / 11:00 AM PT

This portion of the workshop scenario walks through a hypothetical asset-monitoring solution that requires an IoT device with sensors for tracking location, temperature, and pressure included in product transport boxes. You’ll learn how you can use Azure Device Provisioning Service to enroll many devices automatically and securely.

Automatically provision IoT devices securely and at scale with DPS : From Microsoft Learning Labs.

Enrollment Groups with Azure Device Provisioning Service : Youtube From 'TheTurkishDeveloper' a great demo by @johnadali

Getting Started with Azure Device Provisioning Service

How to provisioning IoT devices at scale with IoT Hub Device Provisioning Service

IoT Edge DPS demo

View a demo of an IoT Edge device being automatically provisioned, in a secure way, with IoT Hub Device Provisioning Service. You’ll understand how youcan provision thousands of IoT Edge devices with zero-touch.

image.png (199.0 KiB)
image.png (26.7 KiB)
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.