Device data not mapped to custom component, only to default component

Matthias Alliet 21 Reputation points
2020-12-07T15:40:44.963+00:00

Hello,

I built a device template and mapped it to a device that I connected to Azure IoT Central.
The default component contains basic information such as status, MAC address and so on.
A second component (a custom one, created through the IoT Central GUI) holds information of a sensor module that is connected to the device. There, I defined two Telemetry properties with names 'LevelUnfilled' and 'LevelUnfilledPercentage'.

When data is sent to IoT central, it seems that it is not able to model payload data for the custom component that I created.
When I define the telemetery properties in the default component of the device template, IoT Central is able to model that telemetry property.

In visual below you can see the raw incoming data.

45832-rawvalues.png

'LevelUnfilledPercentage' telemetry property is being mapped to the default model (where it is defined), but the 'LevelUnfilled' telemetry property is not mapped to the custom component where it is defined.

Payload of incoming message is defined as follow:

{  
	"s": 6,  
	"t": "2020-12-07T14:54:24Z",  
	"q": 192,  
	"c": 0,  
	"ai1": 18.559,  
	"ai_st1": 1,  
	"LevelUnfilled": 0.18012499999999988,  
	"LevelUnfilledPercentage": 90.99375  
}  

Also, there is nog Model ID passed in the message as the device template is manually assigned in the IoT Central GUI.

Following the troubleshoot page, I executed following command to see the issues related to incoming messages from the device:

az iot central diagnostics validate-messages --app-id <APP ID> --device-id <DEVICE ID>  

This results in following warning message:

[WARNING] [DeviceId: <DEVICE ID>] [TemplateId: dtmi:modelDefinition:ljoar7ke:tsrm4ukrlv] Device is sending data that has not been defined in the device template. Following capabilities have NOT been defined in the device template '['s', 't', 'q', 'c', 'ai1', 'ai_st1', 'LevelUnfilled', 'LevelUnfilledPercentage']'. Following capabilities have been defined in the device template (grouped by interface) '{}'.

The strange thing here is that de TemplateId mentioned in warning above does not correspond to the template ID I can find in the Device Template when I look at the default component interface ID in IoT Central. I tried to pass the interface ID from my model template with my device message, but a warning is recieved that the template id is nog known either.

Any idea why custom component data is not modeled correctly but only data that is defined in the default component interface?

Thanks in advance.

Best regards

Azure IoT Central
Azure IoT Central
An Azure hosted internet of things (IoT) application platform.
354 questions
{count} votes

Accepted answer
  1. Roman Kiss 2,246 Reputation points
    2020-12-07T16:32:33.16+00:00

    Hi @Matthias Alliet ,

    have a look at my answer here for handling a writable properties in multiple components.

    In the case of telemetry data located in the multiple components, the message systemproperty ComponentName (dt-subject) must be populated with the name of the component.

    If your device is connected using the MQTT directly to the IoT Hub (IoT Central App) you can use the property on the topic such as $.sub=myComponentName

    Note, that based on the above, the telemetry message must be sent for each component separately, in other words, there is no way to send the message for multiple components like we can do it for properties. I hope, the IoT Central Team will consider this option for next release.

    The following example shows a test for sending two telemetry messages, the first one to the component (test37h) and the second one to the default component:

    1. Device template
      45807-capture4.png
    2. Send the telemetry message to the component:
      45901-capture1.png
    3. Send the telemetry message to the default component:
      45798-capture2.png
    4. Raw data received by IoT Central App:
      45785-capture3.png

    Thanks
    Roman

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful