0

the property ledState property does not update for the digital twin when a button is pressed and the device sends the packet patch to IoT Hub for property LedState to true or false.

  1. Device sends packet (MQTT function _nxd_mqtt_client_publish_packet_send) and I can see this logged in Termite: $iothub/twin/PATCH/properties/reported/?$rid=1121{"ledState":true} . The hub successfully responds with 204.

  2. This is my device as shown in IoT hub and the device's ledState (reported) property is updated when I press button A in mxchip:

enter image description here

{
    "deviceId": "mxchip",
    "etag": "AAAAAAAAAF8=",
    "deviceEtag": "NDY5NTIxODE1",
    "status": "enabled",
    "statusUpdateTime": "0001-01-01T00:00:00Z",
    "connectionState": "Connected",
    "lastActivityTime": "2022-09-16T14:51:32.9293466Z",
    "cloudToDeviceMessageCount": 0,
    "authenticationType": "sas",
    "x509Thumbprint": {
        "primaryThumbprint": null,
        "secondaryThumbprint": null
    },
    "modelId": "dtmi:azurertos:devkit:gsgmxchip;2",
    "version": 5310,
    "properties": {
        "desired": {
            "telemetryInterval": 5,
            "$metadata": {
                "$lastUpdated": "2022-09-16T12:44:24.4494023Z",
                "$lastUpdatedVersion": 95,
                "telemetryInterval": {
                    "$lastUpdated": "2022-09-16T12:44:24.4494023Z",
                    "$lastUpdatedVersion": 95
                }
            },
            "$version": 95
        },
        "reported": {
            "deviceInformation": {
                "__t": "c",
                "manufacturer": "MXCHIP",
                "model": "AZ3166",
                "swVersion": "1.0.0",
                "osName": "Azure RTOS",
                "processorArchitecture": "Arm Cortex M4",
                "processorManufacturer": "STMicroelectronics",
                "totalStorage": 1024,
                "totalMemory": 128
            },
            "ledState": true,
            "telemetryInterval": {
                "ac": 200,
                "av": 1,
                "value": 5
            },
            "$metadata": {
                "$lastUpdated": "2022-09-16T14:55:52.6321409Z",
                "deviceInformation": {
                    "$lastUpdated": "2022-09-16T13:54:57.5894378Z",
                    "__t": {
                        "$lastUpdated": "2022-09-16T13:54:57.5894378Z"
                    },
                    "manufacturer": {
                        "$lastUpdated": "2022-09-16T13:54:57.5894378Z"
                    },
                    "model": {
                        "$lastUpdated": "2022-09-16T13:54:57.5894378Z"
                    },
                    "swVersion": {
                        "$lastUpdated": "2022-09-16T13:54:57.5894378Z"
                    },
                    "osName": {
                        "$lastUpdated": "2022-09-16T13:54:57.5894378Z"
                    },
                    "processorArchitecture": {
                        "$lastUpdated": "2022-09-16T13:54:57.5894378Z"
                    },
                    "processorManufacturer": {
                        "$lastUpdated": "2022-09-16T13:54:57.5894378Z"
                    },
                    "totalStorage": {
                        "$lastUpdated": "2022-09-16T13:54:57.5894378Z"
                    },
                    "totalMemory": {
                        "$lastUpdated": "2022-09-16T13:54:57.5894378Z"
                    }
                },
                "ledState": {
                    "$lastUpdated": "2022-09-16T14:55:52.6321409Z"
                },
                "telemetryInterval": {
                    "$lastUpdated": "2022-09-16T13:54:58.1675571Z",
                    "ac": {
                        "$lastUpdated": "2022-09-16T13:54:58.1675571Z"
                    },
                    "av": {
                        "$lastUpdated": "2022-09-16T13:54:58.1675571Z"
                    },
                    "value": {
                        "$lastUpdated": "2022-09-16T13:54:58.1675571Z"
                    }
                }
            },
            "$version": 5215
        }
    },
    "capabilities": {
        "iotEdge": false
    }
}

However the digital twin ledState property does not update when I refresh a query: enter image description here

I can see any other telemetry messages (temperature, humidity, etc) in Termite and these update correctly for the digital twin as shown in Azure IoT Explorer:

enter image description here

This is my digital twin model as shown in Azure Digital Twins Explorer:

{
 "@id": "dtmi:digitaltwins:Basic:MachinePart;1",
 "@type": "Interface",
 "@context": [
  "dtmi:dtdl:context;2"
 ],
 "displayName": "Machine Part -v1",
 "description": "Machine Part data",
 "contents": [
  {
   "@type": "Property",
   "name": "PartId",
   "displayName": "PartId",
   "description": "The unique id of the machine part",
   "writable": true,
   "schema": "string"
  },
  {
   "@type": "Property",
   "name": "Alert",
   "displayName": "Alert",
   "description": "whether or not this machine part needs maintenance",
   "writable": true,
   "schema": "boolean"
  },
  {
   "@type": "Property",
   "name": "ledState",
   "displayName": "LED state",
   "description": "Returns the current state of the onboard LED.",
   "writable": true,
   "schema": "boolean"
  },
  {
   "@type": "Telemetry",
   "name": "telemetryInterval",
   "description": "The time interval of this data",
   "schema": "integer"
  },
  {
   "@type": "Telemetry",
   "name": "Description",
   "schema": "string"
  },
  {
   "@type": "Telemetry",
   "name": "Code",
   "schema": "integer"
  },
  {
   "@type": "Telemetry",
   "name": "Temperature",
   "displayName": "Temperature",
   "schema": "double"
  },
  {
   "@type": "Telemetry",
   "name": "Humidity",
   "displayName": "Humidity",
   "schema": "double"
  },
  {
   "@type": "Telemetry",
   "name": "pressure",
   "displayName": "Pressure",
   "schema": "double"
  },
  {
   "@type": "Telemetry",
   "name": "magnetometerX",
   "displayName": "Magnetometer X / mgauss",
   "schema": "double"
  },
  {
   "@type": "Telemetry",
   "name": "magnetometerY",
   "displayName": "Magnetometer Y / mgauss",
   "schema": "double"
  },
  {
   "@type": "Telemetry",
   "name": "magnetometerZ",
   "displayName": "Magnetometer Z / mgauss",
   "schema": "double"
  },
  {
   "@type": "Telemetry",
   "name": "accelerometerX",
   "displayName": "Accelerometer X",
   "schema": "double"
  },
  {
   "@type": "Telemetry",
   "name": "accelerometerY",
   "displayName": "Accelerometer Y",
   "schema": "double"
  },
  {
   "@type": "Telemetry",
   "name": "accelerometerZ",
   "displayName": "Accelerometer Z",
   "schema": "double"
  },
  {
   "@type": "Telemetry",
   "name": "gyroscopeX",
   "displayName": "Gyroscope X",
   "schema": "double"
  },
  {
   "@type": "Telemetry",
   "name": "gyroscopeY",
   "displayName": "Gyroscope Y",
   "schema": "double"
  },
  {
   "@type": "Telemetry",
   "name": "gyroscopeZ",
   "displayName": "Gyroscope Z",
   "schema": "double"
  }
 ]
}
Sergio Solorzano
  • 476
  • 9
  • 29
  • If you are still blocked, For a deeper investigation and immediate assistance on this issue, please file a support request @ https://aka.ms/azsupt? – AshokPeddakotla Dec 05 '22 at 13:56

0 Answers0