question

DarrenWainwright-4153 avatar image
0 Votes"
DarrenWainwright-4153 asked dominicbetts answered

Data Export against specific device template seems to not work as expected..

Hey folks,

I'm attempting to use the Data Export feature in IoT Central and facing an issue trying to limit messages based on the device template.

Here's the skinny...

I have create a webhook destination; currently NGROKing to my local machine.

I have created a data export that applies 2 filters

1) Where a particular telemetry value contains a string 00:0
2) Where a device template equals a specific template - I select the template from the drop down

When I power up my device it connects into IoT Central and begins sending telemetry.

If i exclude the filter #2 above then my webhook is called.

As soon as i include the template filter, i no longer receive webhook data.

When i inspect the payload received in my webhook (without the template filter) I see a template Id that looks nothing like the template Id that the device is actually using. In fact, everything after dtmi: looks random.

I've exported all templates from IoT Central to see their ID's and find nothing that matches the template Id being fed through.

Am I doing something wrong here?


azure-iot-central
· 6
5 |1600 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 @DarrenWainwright-4153 Could you please include any screenshot or any logs without any sensitive data? if possible.

Is this issue only with a particular IoT Central application or with all other applications as well, where we use filters more than 2?

0 Votes 0 ·

Hey there,

Sure thing, lets see. Does this lot help?

Happy to share other items too. Have no sharable log right now.

1) only have a single IoT app right now, with 2 data exports.

Here is a screenshot of a function app that is consuming the data - I've highlighted the templateId that comes in:

82780-image.png

Here is a screenshot of IoT Central , the device page, showing the template:

82867-image.png

Here is a screenshot of the template when exported:


82868-image.png


1 Vote 1 ·
image.png (116.8 KiB)
image.png (58.9 KiB)
image.png (14.8 KiB)

Hello @DarrenWainwright-4153 thanks for sharing the information, this is very helpful, we are looking into this issue.

1 Vote 1 ·

So I noticed something interesting. If i call the IoT Central Api /devices/{myDeviceId} the response carries the property "instanceOf" as shown below.

That instanceOf is what is coming through in the data export.

Seems perhaps there is a breakdown between the template you can select on the data export screen vs the instance being used.


hope this helps:

IoT Central API:

83667-image.png


Iot Central
;83733-image.png


1 Vote 1 ·
image.png (22.8 KiB)
image.png (46.3 KiB)

Hello @DarrenWainwright-4153 requesting you to try the filter enable condition one more time, as we see it may work, or please let us know if that is still an issue/

1 Vote 1 ·
Show more comments

1 Answer

dominicbetts avatar image
0 Votes"
dominicbetts answered

In IoT Central, a device template contains a device model (and other information such as cloud property definitions).

On the device template definition screens, if you select Edit DTDL you see the device model ID at the top of the DTDL. The device model ID looks like "@id": "dtmi:com:example:Thermostat;1". The model ID is unique ID for the model that's being used and is included if you chose to import a device model. You can find a repository of these models here: https://github.com/Azure/iot-plugandplay-models. You can find a definition of the device model ID here: https://github.com/Azure/opendigitaltwins-dtdl/blob/master/DTDL/v2/dtdlv2.md#digital-twin-model-identifier

Internal to your IoT Central application, each device template is assigned an ID that's used just by this application. You see this identifier in the card that appears if you hover over a device in the device list:
241404-image.png


When a device connects to IoT Central, it should include the device model ID so that IoT Central can identify the correct model to use. IoT Central then locates the device template that incudes this device model.

When IoT Central exports data, it includes the device template id in the export payload - it's this value that the export definition uses to filter.



image.png (50.6 KiB)
5 |1600 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.