【问题标题】:Azure IoT Explorer does not recognize the device as a IoT Plug and Play deviceAzure IoT Explorer 无法将该设备识别为 IoT 即插即用设备
【发布时间】:2022-09-23 04:34:38
【问题描述】:

在使用与 Azure IoT Explorer 中输入的相同 DTDL 模型创建 Azure IoT 中心和数字孪生资源后,Explorer 说设备未被识别为 IoT P&P 设备。

DTDL 模型使用 DTDLValidator 进行验证

我错过了什么,我以tutorial 为例进行了检查,但看不出有什么问题?

  1. 使用相同模型创建的数字孪生:

    1. 我在 IoT Explorer 中添加 IoT Hub 连接,并从用于创建数字孪生的同一模型存储库创建设备。

    我的 DTDL 模型 json 文件:

    {
        \"@id\": \"dtmi:com:sergio:devkit;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\"
            }
        ]
    }

    标签: azure azure-iot-hub azure-digital-twins


    【解决方案1】:

    您的 DTDL 模型是正确的。问题是设备型号ID设备孪生中的属性不存在,并且在设备连接到 IoT 中心期间填充了 must

    以下屏幕 sn-ps 显示您的 DTDL 在 Azure IoT Explorer 中运行:

    1. 您的情况,设备孪生没有型号ID财产:

      1. 下图显示,设备已经分配了一个modelId:

      1. 现在,我们可以看到设备 mymxchip 是基于 DTDL 模型(modelId)建模的:

      1. 下图显示了可写属性的示例:

      1. 此演示使用了我的Azure IoT Hub Tester,它允许我使用 MQTT 直接协议创建一个虚拟 PnP 设备到 Azure IoT 中心,并基于 DTDL 模型模拟遥测数据、属性、命令等:

      下面最后一张图片显示了门户上的设备孪生中的 modelId 属性:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-08-29
      • 1970-01-01
      • 2018-06-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-02-26
      • 2020-02-18
      相关资源
      最近更新 更多