I'm trying to develop IoTA with lazy attributes. And found that Context Broker saves device 'entity_name' field in 'id', so when CB makes request for lazy attributes, IoTA can't found device with such id.
With purpose to create device entity I make this request to IoTA:
'devices': [{
'device_id': 'idSensor14',
'entity_name': 'nameSensor14',
'entity_type': 'anysensor',
'attributes': [
{
'name': 't',
'type': 'celsius'
}
],
'lazy': [
{
'name': 'b',
'type': 'mybits'
}
]
}]
Then if we request entitites list in CB ('v2/entities/') we discover:
{ "id":"nameSensor15",
"type":"anysensor",
"t":{"type":"celsius","value":"","metadata":{}}}
It seems that CB saves device with wrong id. This is request for lazy attributes:
data = {
"entities": [{
"isPattern": "false",
"id": myid,
"type": entity_type
},
"attributes": ["b"]
]}
And this is error in IoA log:
op=IoTAgentNGSI.ContextServer | srv=myhome | subsrv=/sensors | msg=Query error [DEVICE_NOT_FOUND] handling request: No device was found with id:nameSensor15
If delete entity_name from registration request, then CB will use device id = 'anysensors:idSensor14'. My Orion version is 1.7.0, and iotagent-node-lib version is 2.5.1.
The reason was in using upper case letters in fiware service name for device registration headers and iota config, so I should use myhome
instead of myHome
, for example. It's same for memory and mongo device registry types.