0

I am wondering if it is possible to include information if device is an edge device in Microsoft.Devices.DeviceCreated event data? I receive those events for both type of devices but I am not able to distinguish them and say oh yeah this one is an edge device.

I can see that device twin which I receive is a little bit different than the one I can see in portal. In portal twin contains information about capabilities which say iotEdge: true for edge and false for directly connected devices.

majewka
  • 111
  • 1
  • 10

1 Answers1

1

Basically, there are two ways to handle this issue:

  1. The subscriber event handler (EventGridTrigger function) will pull up the full device twins info like you can see on the portal.

  2. Using the Bulk Create or Update REST API call for creating devices with an additional information in the tags. I do recommend this way and based on my answer here, the following is an example of the payload POST:

    [
      {
        "id":"TD_0001",
        "importMode":"create",
        "status":"enabled",
        "tags":{
          "capabilities":{
             "iotEdge":false
          }
        }
      },
      {
        "id":"TD_0002",
        "importMode":"create",
        "status":"enabled",
        "tags":{
          "capabilities":{
            "iotEdge":true
          }
        },
        "capabilities":{
          "iotEdge":true
        }
      }
    ]
    

As you can see, the capabilities property has been added in the tags. Basically, you can initialized any device twins properties included a reported property.

The Azure IoT Hub Notification to the AEG is almost immediately and the following screen snippet shows an example of the event message:

enter image description here

and the azure portal screen:

enter image description here

Roman Kiss
  • 7,925
  • 1
  • 8
  • 21