I’m having problems with the IDAS Iotagent. Using the MQTT Ultralight agent, depending on how I register a device, when the agent receives a reading the iotagent service crashes and the related entity into the context broker is not updated.
The correct behaviour is the next one. If create a service:
curl -X POST 172.21.0.23:8090/iot/services \
-i \
-H "Content-Type: application/json" \
-H "Fiware-Service: red_entrada _1" \
-H "Fiware-ServicePath: /Prueba" \
-d '{
"services": [
{
"apikey": "pass_1",
"cbroker": "http://172.21.0.23:1026",
"entity_type": "disp_entrada_1",
"resource": "/iot/mqtt"
}]}'
... and a device, establishing the incoming attributes and a name for each one of them:
curl -X POST 172.21.0.23:8090/iot/devices \
-i \
-H "Content-Type: application/json" \
-H "Fiware-Service: red_entrada _1" \
-H "Fiware-ServicePath: /Prueba" \
-d '{
"devices":[
{
"device_id": "AC_2",
"entity_name":"disp_entrada_1:AC_2",
"protocol":"PDI-IoTA-MQTT-UltraLight",
"entity_type": "disp_entrada_1",
"timezone": "Europe/Madrid",
"attributes": [
{
"object_id": "LUX",
"name": "LUX_1",
"type": "string"
},
{
"object_id": "LUM",
"name": "LUM_1",
"type": "string" },
{
"object_id": "HUMB",
"name": "HUMB_1",
"type": "string"
},
{
"object_id": "TCB",
"name": "TCB_1",
"type": "string"
},
{
"object_id": "IN_TEMP",
"name": "IN_TEMP_1",
"type": "string" },
{
"object_id": "BAT",
"name": "BAT_1",
"type": "string"
}
]}]}'
As a result, a new entity is created into the context broker, and as the readings arrive to the agent, this entity is updated:
{
"_id" : {
"id" : "disp_entrada_1:AC_2",
"type" : "disp_entrada_1",
"servicePath" : "/Prueba"
},
"attrNames" : [
"TimeInstant",
"LUX_1",
"LUM_1",
"HUMB_1",
"TCB_1",
"IN_TEMP_1",
"BAT_1"
],
"attrs" : {
"TimeInstant" : {
"value" : "2016-03-14T08:11:49.810465Z",
"type" : "ISO8601",
"creDate" : 1457943015,
"modDate" : 1457943109
},
"LUX_1" : {
"value" : "464.000",
"type" : "string",
"md" : [
{
"name" : "TimeInstant",
"type" : "ISO8601",
"value" : "2016-03-14T08:11:49.687585Z"
}
],
"creDate" : 1457943103,
"modDate" : 1457943109
},
"LUM_1" : {
"value" : "2.694",
"type" : "string",
"md" : [
{
"name" : "TimeInstant",
"type" : "ISO8601",
"value" : "2016-03-14T08:11:49.718131Z"
}
],
"creDate" : 1457943103,
"modDate" : 1457943109
},
"HUMB_1" : {
"value" : "38.7",
"type" : "string",
"md" : [
{
"name" : "TimeInstant",
"type" : "ISO8601",
"value" : "2016-03-14T08:11:49.748719Z"
}
],
"creDate" : 1457943103,
"modDate" : 1457943109
},
"TCB_1" : {
"value" : "21.31",
"type" : "string",
"md" : [
{
"name" : "TimeInstant",
"type" : "ISO8601",
"value" : "2016-03-14T08:11:49.779327Z"
}
],
"creDate" : 1457943103,
"modDate" : 1457943109
},
"IN_TEMP_1" : {
"value" : "21.00",
"type" : "string",
"md" : [
{
"name" : "TimeInstant",
"type" : "ISO8601",
"value" : "2016-03-14T08:11:49.810465Z"
}
],
"creDate" : 1457943103,
"modDate" : 1457943109
},
"BAT_1" : {
"value" : "97",
"type" : "string",
"md" : [
{
"name" : "TimeInstant",
"type" : "ISO8601",
"value" : "2016-03-14T08:11:49.230590Z"
}
],
"creDate" : 1457943103,
"modDate" : 1457943109
}
},
"creDate" : 1457943015,
"modDate" : 1457943109
}
The problem arises when I register a new DEVICE and I use as the name for the attributes the same value of the "object_id" (name of the attribute into the incoming MQTT data. Surely on this scenario it's not necessary to register a DEVICE). For example:
curl -X POST 172.21.0.23:8090/iot/devices \
-i \
-H "Content-Type: application/json" \
-H "Fiware-Service: red_entrada_2" \
-H "Fiware-ServicePath: /Prueba" \
-d '{
"devices":[
{
"device_id": "AC_2",
"entity_name":"disp_entrada_1:AC_2",
"protocol":"PDI-IoTA-MQTT-UltraLight",
"entity_type": "disp_entrada_1",
"timezone": "Europe/Madrid",
"attributes": [
{
"object_id": "LUX",
"name": "LUX",
"type": "string"
},
{
"object_id": "LUM",
"name": "LUM",
"type": "string"
},
{
"object_id": "HUMB",
"name": "HUMB",
"type": "string"
},
{
"object_id": "TCB",
"name": "TCB",
"type": "string"
},
{
"object_id": "IN_TEMP",
"name": "IN_TEMP",
"type": "string"
},
{
"object_id": "BAT",
"name": "BAT",
"type": "string"
}
]}] }'
On that case a new entity is created into the context broker too, but when the readings arrive the entity is not updated and the IoTAgent service crashes. Entity status:
{
"_id" : {
"id" : " disp_entrada_1:AC_2",
"type" : " disp_entrada_1",
"servicePath" : "/Prueba"
},
"attrNames" : [
"TimeInstant"
],
"attrs" : {
"TimeInstant" : {
"type" : "ISO8601",
"creDate" : 1457948167,
"modDate" : 1457948167,
"value" : "2016-03-14T09:36:07.432814Z"
}
},
"creDate" : 1457948167,
"modDate" : 1457948167
}
I can’t see any logic on this behaviour. If I don't register beforehand the device, the entity will be created automatically and the attributes will have as the name the value of the "object_id" field (that was what I was attempting to do on the second example).
¿Can it be due to an issue on the agent or manager installation?