DEVICE_GROUP_NOT_FOUND in iotagent-ul

吃可爱长大的小学妹 提交于 2019-12-11 06:35:42

问题


I'm trying to send measurements using IoT Agent UL2.0.

First, I created a device as follows:

POST /iot/devices HTTP/1.1
Host: localhost:4061
Fiware-Service: Empresa1
Fiware-ServicePath: /empresa1
Content-Type: application/json
Cache-Control: no-cache
{ 
"devices": [ 
    { 
        "device_id": "A6", 
        "entity_name": "A6", 
        "entity_type": "E6", 
        "attributes": [ 
              { "object_id": "a", "name": "aaa", "type": "text" },
              { "object_id": "b", "name": "bbb", "type": "text" },
              { "object_id": "c", "name": "ccc", "type": "text" }
        ]
    }
]
}

Then I'm trying to send measurements as follows:

POST /iot/d?i=A6&k=A6&d=a|7|b|7|c|7 HTTP/1.1
Host: localhost:7896
Fiware-Service: Empresa1
Fiware-ServicePath: /empresa1
Content-Type: text/plain
Cache-Control: no-cache

But I'm getting the following error:

{
    "name": "DEVICE_GROUP_NOT_FOUND",
    "message": "Couldn\t find device group"
}

What the device group is?

Thanks!


回答1:


I figured out how to solve it.

I just changed config.defaultTransport to HTTP in config.js and used TEF as apikey.

The request that effectively sent measures to Orion was the following:

POST /iot/d?i=A6&k=TEF&d=a|7|b|7|c|7 HTTP/1.1
Host: localhost:7896
Fiware-Service: Empresa1
Fiware-ServicePath: /empresa1
Content-Type: text/plain
Cache-Control: no-cache

I hope this helps somebody.




回答2:


be careful, you need to configure a service, so that you can use your own API KEY, and that can be done by issuing an HTTP request like this


    POST http://130.206.80.40:5371/iot/services

    Headers:

    {
      'Content-Type':       'application/json',
      'X-Auth-Token' :      '[TOKEN]',
      'Fiware-Service':     'openiot',
      'Fiware-ServicePath': '/'
    }

    Payload:

    {
      "services": [
        {
          "apikey":      "4jggokgpepnvsb2uv4s40d59ov",
          "cbroker":     "http://0.0.0.0:1026",
          "entity_type": "thing",
          "resource":    "/iot/d"
        }
      ]
    }


来源:https://stackoverflow.com/questions/42281731/device-group-not-found-in-iotagent-ul

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!