Mike Lenart
Mike Lenart

Reputation: 939

How do you update a Cloud Property for an IoT Device in Azure IoT Hub using the SDKs?

Is there a way to update a Cloud Property for an IoT Device in Azure IoT Hub?

The DTDL for the device Cloud Property is:

{
    "@id": "dtmi:solutionModel:modelDefinition:rkkkbmsz:brcdv6wcme:DeviceSerialNumber",
    "@type": [
        "Property",
        "Cloud",
        "StringValue"
    ],
    "displayName": {
        "en": "Device Serial Number"
    },
    "name": "DeviceSerialNumber",
    "schema": "string",
    "minLength": 1,
    "trimWhitespace": true
},

I am using the Azure IoT SDKs and C#.

deviceClient.UpdateReportedPropertiesAsync(reportedProperties, cancellationToken);

The property is showing up as "_unmodeleddata". The JSON is:

{
    "_unmodeleddata": {
        "DeviceSerialNumber": "dsn1i90NEW"
    },
    "_eventtype": "Property",
    "_timestamp": "2022-08-14T23:13:45.966Z"
}

Upvotes: 0

Views: 251

Answers (1)

Roman Kiss
Roman Kiss

Reputation: 8235

The Cloud Property declared in the DTDL model is visible only on the cloud facing side, in other words, there is no either any message exchange pattern between the device and IoT Hub or visibilities.

It based on the IoT Solution, where and how the Cloud Property is stored and managed. In the Azure IoT Hub the Cloud Property can be stored in the device twins such as the property tags.

In the Azure IoT Central, the Cloud Property is using own underlying storage (not the device twin tags) and the REST APIs for handling their values.

Note, that the IoT PnP Device should not send the Cloud Property to the IoT Hub, that's the reason why you are receiving _unmodeleddata for property DeviceSerialNumber

Upvotes: 2

Related Questions