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

João Gomes 26 Reputation points
2021-03-03T17:41:11.903+00:00

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?

EDIT:
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?

Azure IoT Edge
Azure IoT Edge
An Azure service that is used to deploy cloud workloads to run on internet of things (IoT) edge devices via standard containers.
543 questions
Azure IoT Hub
Azure IoT Hub
An Azure service that enables bidirectional communication between internet of things (IoT) devices and applications.
1,127 questions
Azure IoT SDK
Azure IoT SDK
An Azure software development kit that facilitates building applications that connect to Azure IoT services.
208 questions
{count} vote

Accepted answer
  1. QuantumCache 20,031 Reputation points
    2021-03-10T03:36:35.357+00:00

    Hello @João Gomes 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 @Kevin Saye , 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 global.azure-devices-provisioning.net 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' : @Kevin Saye

    76045-image.png

    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.
    75950-image.png

    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.

    0 comments No comments

0 additional answers

Sort by: Most helpful