简体   繁体   English

FIWARE - IDAS:注册设备问题

[英]FIWARE - IDAS: Issue with registered device

I'm having problems with the IDAS Iotagent.我在使用 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.使用 MQTT Ultralight 代理时,根据我注册设备的方式,当代理收到读取时,iotagent 服务崩溃并且上下文代理中的相关实体未更新。

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).当我注册一个新的 DEVICE 并且我使用与“object_id”相同的值作为属性的名称(传入 MQTT 数据中的属性名称。当然在这种情况下,没有必要注册一个设备)时会出现问题。 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.在这种情况下,上下文代理中也会创建一个新实体,但是当读数到达时,实体不会更新并且 IoTAgent 服务崩溃。 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).如果我没有事先注册设备,实体将被自动创建,并且属性的名称将是“object_id”字段的值(这是我在第二个示例中尝试做的)。

¿Can it be due to an issue on the agent or manager installation? ¿ 可能是由于代理或管理器安装的问题吗?

Actually this is a bug, when you associate a parameter "t" to be translated to the same ("t") then it results in a infinite loop.实际上这是一个错误,当您将参数“t”关联为相同的(“t”)时,它会导致无限循环。

The best solution is not to ask for any translation and then it will be kept as the original ("t").最好的解决方案是不要要求任何翻译,然后将其保留为原始(“t”)。

In the next versions, this bug will be fixed.在下一个版本中,此错误将被修复。

Thanks for using IDAS and sorry for our late reply!感谢您使用 IDAS,对于我们迟到的回复深表歉意!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM