问题
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