I develop IoT Agent with node.js library. And register device with this through IoTA:
'devices': [{
'device_id': 'ULSensor',
'entity_name': 'Sensor01',
'entity_type': 'BasicULSensor',
'attributes': [
{
'name': 't',
'type': 'celsius'
},
{
'name': 'l',
'type': 'meters'
}
],
'lazy': [
{
'name': 'p',
'type': 'pascal'
},
{
'name': 'c',
'type': 'curiosity'
}
]
}]
Then make request to http://orion:1026/v1/queryContext with this payload:
data = {
"entities": [{
"isPattern": "false",
"id": 'Sensor01',
"type": entity_type
}]
, "attributes": [
'c'
]
}
And got this:
"errorCode" : {
"code" : "404",
"reasonPhrase" : "No context element found",
"details" : "error forwarding query"
}
But when set 't' in attributes - orion sends correct response. I wrote queryContextHandler and updateContextHandler in IoTA, but they were not called. Orion is a docker image, and node-lib from npm.
IoTA log shows that were two register requests:
"url": "http://orion:1026/NGSI9/registerContext",
"method": "POST",
"json": {
"contextRegistrations": [
{
"entities": [
{
"type": "BasicULSensor",
"isPattern": "false",
"id": "Sensor01"
}
],
"attributes": [
{
"name": "p",
"type": "pascal",
"isDomain": "false"
},
{
"name": "c",
"type": "curiosity",
"isDomain": "false"
}
],
"providingApplication": "http://myiotagent:4042"
}
],
"duration": "P1M"
}
"url": "http://orion:1026/v1/updateContext",
"method": "POST",
"json": {
"contextElements": [
{
"type": "BasicULSensor",
"isPattern": "false",
"id": "Sensor01",
"attributes": [
{
"name": "t",
"type": "celsius",
"value": " "
},
{
"name": "l",
"type": "meters",
"value": " "
}
]
}
],
"updateAction": "APPEND"
}
How to register device correctly or send query to orion to get lazy attributes?
Thanks!
EDIT1
contextBroker --version
output:
1.7.0-next (git version: bd9f08cf86a631efe6dc1b078ac4c54648860aae)
and iotagent-node-lib version is 2.5.1
Orion returns "error forwarding query"
when it has tried to forward the request to the Context Provider (in your case, the IOTA plays the role of Context Provider) but have failed to do so. The tipical reason for this is a connection problem, e.g. Context Provider is down, network problems, etc.
Looking to your post, it seems you are using the following Context Provider endpoint:
"providingApplication": "http://myiotagent:4042"
That URL doesn't seem to be valid and could explain the problem.