IoT Central Device template for iot-edge-modbus module

Hinrich Framcke 96 Reputation points
2021-12-08T14:33:07.003+00:00

Hi

I do not really know if I have an issue on the IoT central side or the json messages from the iot-edge-modbus module are incompatible with IoT central.

I Receive the below message in IoT central and struggle to model as needed. Would be great if somebody can shed some light on this?

{
"_unmodeleddata": {
"Modbus": {
"__t": "m",
"PublishTimestamp": "2021-12-08T08:43:30.0000000Z",
"Content": [
{
"HwId": "CerboGX",
"Data": [
{
"CorrelationId": "DefaultCorrelationId",
"SourceTimestamp": "2021-12-08T08:43:22.0000000Z",
"Values": [
{
"DisplayName": "Power supplied by system to loads.",
"Address": "300818",
"Value": "2230"
},
{
"DisplayName": "Power supplied by Grid to system.",
"Address": "300821",
"Value": "35"
}
]
},
{
"CorrelationId": "DefaultCorrelationId",
"SourceTimestamp": "2021-12-08T08:43:27.0000000Z",
"Values": [
{
"DisplayName": "Power supplied by system to loads.",
"Address": "300818",
"Value": "2220"
},
{
"DisplayName": "Power supplied by Grid to system.",
"Address": "300821",
"Value": "68"
}
]
}
]
}
]
}
},
"_eventtype": "Telemetry",
"_timestamp": "2021-12-08T08:43:30.451Z"
}

Regards

Hinrich

Azure IoT Central
Azure IoT Central
An Azure hosted internet of things (IoT) application platform.
331 questions
0 comments No comments
{count} votes

Accepted answer
  1. Hinrich Framcke 96 Reputation points
    2021-12-13T06:57:50.407+00:00

    Thanks @Sander van de Velde ! You are confirming what I suspected. Thank you for the recommendation on how take this forward too. Much appreciated!


1 additional answer

Sort by: Most helpful
  1. Sander van de Velde 26,811 Reputation points MVP
    2021-12-10T10:59:11.65+00:00

    Hello @Hinrich Framcke ,

    the message you receive from the IoT Edge device in Azure IoT Central is well-formed JSON.

    Unfortunately, apart from the array, these properties with the '_' are not supported:

    156691-image.png

    I have worked with the Modbus module in the past and it's a time saver to get both Modbus TCP and RTU connected.

    The raw output format is a bit complex though.

    I recommend writing an extra module with custom code to ingest the raw modbus message and simplify the output message.

    Take a look at the C# ExpandoObject. This makes it possible to loop through the array and add custom properties on the fly (inside the custom module).

    This is the easiest way to and more flexible towards the future (add one layer of abstraction so the actual device message format can be changed).