首页 文章

FIWARE - IDAS:已注册设备的问题

提问于
浏览
2

我在使用IDAS Iotagent时遇到了问题 . 使用MQTT Ultralight代理,取决于我如何注册设备,当代理接收到读取时,iotagent服务崩溃并且相关实体不会更新到上下文代理 .

正确的行为是下一个 . 如果创建服务:

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"
    }]}'

...和一个设备,为每个属性 Build 传入属性和名称:

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" 
    } 
]}]}'

因此,在上下文代理中创建一个新实体,并且当读数到达代理时,此实体将更新:

{
        "_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
}

当我注册一个新的DEVICE并且我使用“object_id”的相同值(属性的名称到传入的MQTT数据中)作为属性的名称时出现问题 . 当然在这种情况下,没有必要注册DEVICE) . 例如:

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" 
    } 
]}] }'

在这种情况下,也会在上下文代理中创建一个新实体,但是当读数到达时,实体不会更新,IoTAgent服务也会崩溃 . 实体状态:

{
        "_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
}

我看不出有关这种行为的任何逻辑 . 如果我没有预先注册设备,将自动创建实体,并且属性将具有“object_id”字段的值作为名称(这是我在第二个示例中尝试执行的操作) .

¿是否可能是由于代理或经理安装上的问题?

1 回答

  • 2

    实际上这是一个错误,当您将要转换的参数“t”关联到相同的(“t”)时,它会导致无限循环 .

    最好的解决方案是不要求任何翻译,然后它将保留为原始(“t”) .

    在下一个版本中,此错误将得到修复 .

    感谢您使用IDAS,抱歉我们迟到了!

相关问题