When using IOT Central data export to Event Hub, you have a message format which is:
{
"applicationId": "A-GUID",
"component": null,
"deviceId": "AN-ID",
"enqueuedTime": "2022-02-23T20:34:11.0400000Z",
"enrichments": {},
"messageProperties": {},
"messageSource": "telemetry",
"module": null,
"schema": "default@v1",
"telemetry": [
{
"label": "temp",
"value": "33"
},
{
"label": "watts",
"value": 2183
}
...
"templateId": "A-TEMPLATE-ID",
"ts": "2022-02-23T20:26:39.0000000Z",
"EventProcessedUtcTime": "2022-02-23T20:37:53.1779856Z",
"PartitionId": 0,
"EventEnqueuedUtcTime": "2022-02-23T20:34:12.5810000Z"
}
My question is how do you unpack the Telemetry property into something which TSI can see as Types?
The Type seems to rely on a flatter naming structure, like $event.telemety.watts
, and there is no way to query for $event.telemetrty.label == "watts
.
My one thought is that I may need to transform this data before it gets to TSI by using an inbound event hub, then a function to flatten the schema and an outbound event hub which is what TSI reads from.
Figured it out. There's a new (to me) Transform feature in IoT Central Data Export.
We used the following rule to transform the telemetry.
telemetry: .telemetry | map({ (.name|tostring): .value }) | add