添加嵌套的 OPC-UA 变量结果 "String cannot be coerced to a nodeId"

adding nested OPC-UA Variable results in "String cannot be coerced to a nodeId"

错误:无法将字符串强制转换为 nodeId

你好, 我正忙于使用 opcua iotagent 代理在 Orion Broker 和带有 OPC-UA 服务器的 PLC 之间建立连接。 我设法设置了所有部分并且我能够接收(测试)数据,但是我无法按照教程使用 json 文件向 Orion-Broker 添加实体:

curl http://localhost:4001/iot/devices      -H "fiware-service: plcservice"      -H "fiware-servicepath: /demo"      -H "Content-Type: application/json"      -d @add_device.json

预期结果是使用提供的数据将实体添加到 OrionBroker,但这只会导致错误消息:

{"name":"Error","message":"String cannot be coerced to a nodeId : ns*4:s*MAIN.mainVar"}

疑似错误

iotagent 是否可能无法很好地与嵌套变量一起使用?

采取的步骤


补充信息:

add_device.json 文件:

{ 
"devices": [
    {
        "device_id": "plc1",
        "entity_name": "PLC1",
        "entity_type": "plc",
        "attributes": [
            
            {
                "object_id": "ns*4:s*MAIN.mainVar",
                "name": "main",
                "type": "Number"
            }
        ],
        "lazy": [
        ],
        "commands" : []
  }
]

}


IOT 代理的配置(来自 localhost:4081/config):

{
  "config": {
    "logLevel": "DEBUG",
    "contextBroker": {
      "host": "orion",
      "port": 1026
    },
    "server": {
      "port": 4001,
      "baseRoot": "/"
    },
    "deviceRegistry": {
      "type": "memory"
    },
    "mongodb": {
      "host": "iotmongo",
      "port": "27017",
      "db": "iotagent",
      "retries": 5,
      "retryTime": 5
    },
    "types": {
      "plc": {
        "service": "plcservice",
        "subservice": "/demo",
        "active": [
          {
            "name": "main",
            "type": "Int16"
          },
          {
            "name": "test1",
            "type": "Int16"
          },
          {
            "name": "test2",
            "type": "Int16"
          }
        ],
        "lazy": [],
        "commands": []
      }
    },
    "browseServerOptions": null,
    "service": "plc",
    "subservice": "/demo",
    "providerUrl": "http://iotage:4001",
    "pollingExpiration": "200000",
    "pollingDaemonFrequency": "20000",
    "deviceRegistrationDuration": "P1M",
    "defaultType": null,
    "contexts": [
      {
        "id": "plc_1",
        "type": "plc",
        "service": "plcservice",
        "subservice": "/demo",
        "polling": false,
        "mappings": [
          {
            "ocb_id": "test1",
            "opcua_id": "ns=4;s=test.TestVar.test1",
            "object_id": null,
            "inputArguments": []
          },
          {
            "ocb_id": "test2",
            "opcua_id": "ns=4;s=test.TestVar.test2",
            "object_id": null,
            "inputArguments": []
          },
          {
            "ocb_id": "main",
            "opcua_id": "ns=4;s=MAIN.mainVar",
            "object_id": null,
            "inputArguments": []
          }
        ]
      }
    ]
  }
}

我是 iotagent-opcua 存储库的维护者之一,我们已经识别并修复了您所解决的错误,请将您的代理更新到最新版本 (1.4.0)

如果您从未听说过,从 1.3.8 开始,我们引入了一个名为“relaxTemplateValidation”的新配置 属性,它允许您使用以前禁止使用的字符(例如 = 和 ; )。我建议你看看它提供的配置示例。