Orion CB使用' entity_name'价值在' id'领域

时间:2018-01-21 09:37:41

标签: fiware fiware-orion

我试图用懒惰属性开发IoTA。并发现Context Broker保存了设备' entity_name'在' id'中的字段,因此当CB请求延迟属性时,IoTA无法找到具有此类ID的设备。

为了创建设备实体,我向IoTA提出了这个请求:

'devices': [{
    'device_id': 'idSensor14',
    'entity_name': 'nameSensor14',
    'entity_type': 'anysensor',
    'attributes': [
        {
            'name': 't',
            'type': 'celsius'
        }
    ],
    'lazy': [
        {
            'name': 'b',
            'type': 'mybits'
        }
    ]                 
}]

然后,如果我们在CB(' v2 / entities /')中请求授权列表,我们会发现:

{ "id":"nameSensor15",
    "type":"anysensor",
    "t":{"type":"celsius","value":"","metadata":{}}}

似乎CB使用错误的ID保存设备。这是对延迟属性的请求:

data = {
    "entities": [{
        "isPattern": "false",
        "id": myid,
        "type": entity_type
    },
    "attributes": ["b"]
]}

这是IoA日志中的错误:

op = IoTAgentNGSI.ContextServer | srv = myhome | subsrv = / sensors | msg =查询错误[DEVICE_NOT_FOUND]处理请求:未找到包含id的设备:nameSensor15

如果从注册请求中删除entity_name,则CB将使用device id =' anysensors:idSensor14'。我的Orion版本是1.7.0,iotagent-node-lib版本是2.5.1。

2 个答案:

答案 0 :(得分:1)

原因是在设备注册标题和iota配置的fiware服务名称中使用大写字母,因此我应该使用myhome代替myHome。内存和mongo设备注册表类型相同。

答案 1 :(得分:0)

IOTAgent应使用entity_name作为id在CB中创建实体。在您的情况下,这意味着nameSensor14

您看到的nameSensor15可能与其他一些配置操作相对应。

我建议做一个干净的测试。我的意思是:

  1. 停止所有流程(包括IOTA和CB)。
  2. 清理所有数据库(在Mongo shell中查找以orioniot开头的数据库)
  3. 启动CB
  4. 启动IOTAgent
  5. 运行创建设备请求
  6. 在运行任何其他请求之前,请检查CB上的实体(GET /v2/entities)和注册(GET v1/registry/contextEntities/<entity_id>),以便查看实体是否使用正确的ID创建,以及与懒惰的属性。
相关问题