TwinMaker:使用Lambda获取非时间序列属性的数据。

0

【以下的问题经过翻译处理】 你好! 我一直在尝试使用IoT RoboRunner + IoT TwinMaker + AWS Grafana创建仪表板。 其中最基本的要求是显示当前工人/机器人的列表。

考虑以下“组件类型”: (父项,要从中继承,以保持lambda函数的通用性) 理想情况下,Lambda函数能够看到事件和关联的“遥测资产ID”,并回复适当的有效载荷。

{ "componentTypeId": "com.example.lambda_reader", "workspaceId": "MyWorkspace", "functions": { "dataReader": { "implementedBy": { "lambda": { "arn": "arn:aws:lambda:us-east-1:<account>:function:RoboRunnerWorkerInfo" } } } }, "propertyDefinitions": { "telemetryAssetId": { "dataType": { "type": "STRING" }, "isExternalId": true, "isStoredExternally": false, "isTimeSeries": false, "isRequiredInEntity": true } } }

还有子项,继承自上述项

{
    "componentTypeId": "com.example.myworkspace.worker_list",
    "extendsFrom": [
        "com.example.lambda_reader"
    ],
    "propertyDefinitions": {
        "telemetryAssetId": {
            "defaultValue" : { "stringValue": "WorkerList" }
        },
        "workerList": {
            "dataType": {
              "type": "LIST",
              "netstedType": {
                "type": "STRING"
              }
            },
            "isTimeSeries": false,
            "isStoredExternally": true
        }
    }
}

当添加这两个“组件类型”时,除非将isTimeSeries设置为true,否则后者将显示为抽象。这是正常行的吗?这似乎应该是可以做到的? 感谢任何帮助!

profile picture
专家
已提问 5 个月前26 查看次数
1 回答
0

【以下的回答经过翻译处理】 我可以通过在不与dataReader同名的函数下指定函数来获取非时间序列属性。

因此,对于非时间序列属性,应该是:

  "functions": {
    "attributePropertyValueReaderByEntity": {
      "implementedBy": {
        "lambda": {
          "arn": "arn:aws:lambda:us-east-1:<account>:function:RoboRunnerWorkerInfo"
        }
      }
    }

这在文档中绝对没有提到。我通过在github中查找并找到https://github.com/aws-samples/aws-iot-twinmaker-samples/blob/main/src/modules/s3/component-types/s3_component_type.json来到达这一点。

profile picture
专家
已回答 5 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则