gpt4 book ai didi

Azure IoT Explorer 无法将该设备识别为 IoT 即插即用设备

转载 作者:行者123 更新时间:2023-12-03 06:49:42 30 4
gpt4 key购买 nike

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

DTDL 模型使用 DTDLValidator 进行验证 enter image description here

我错过了什么,我检查了这个tutorial举个例子,看不出哪里出了问题?

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

enter image description here

  • 我在 IoT Explorer 中添加了 IoT 中心连接,并从用于创建数字孪生的同一模型存储库创建了设备。
  • enter image description here

    enter image description here

    enter image description here

    我的 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"
    }
    ]
    }

    最佳答案

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

    以下屏幕片段显示您的 DTDL 正在 Azure IoT Explorer 中运行:

    1. 您的情况,设备孪生没有 modelId 属性:

    enter image description here

  • 下图显示设备已分配了 modelId:
  • enter image description here

  • 现在,我们可以看到设备 mymxchip 是基于 DTDL 模型 (modelId) 建模的:
  • enter image description here

  • 下图显示了可写属性的示例:
  • enter image description here

  • 本次演示使用了我的 Azure IoT Hub Tester允许我使用连接到 Azure IoT 中心的 MQTT 直接协议(protocol)创建虚拟 PnP 设备,并基于 DTDL 模型模拟遥测数据、属性、命令等:
  • enter image description here

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

    enter image description here

    关于Azure IoT Explorer 无法将该设备识别为 IoT 即插即用设备,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73815008/

    30 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com