微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Fiware IoT代理Json拒绝发布到/ v2 / op / update

如何解决Fiware IoT代理Json拒绝发布到/ v2 / op / update

我对fiware IoT Agent JSON感兴趣,我试图解决问题。 我想使用this教程来安装IoT Agent JSON。 本教程介绍了IoT执行器连接,要检查连接,我们必须POST到{IoTAgentIP:Port} / v2 / op / update。 当我发布到该端点时,我得到:

<html lang="en">

<head>
   <Meta charset="utf-8">
   <title>Error</title>
</head>

<body>
   <pre>Cannot POST /v2/op/update</pre>
</body>

</html>

我的发布命令是:

curl -iX POST \
  http://localhost:4041/v2/op/update \
  -H 'Content-Type: application/json' \
  -H 'fiware-service: openiot' \
  -H 'fiware-servicepath: /' \
  -d '{
    "actionType": "update","entities": [
        {
            "type": "Alarm","id": "urn:ngsi-ld:Alarm:001","ring" : {
                "type": "command","value": ""
            }
        }
    ]
}'

curl -iX POST \
  http://localhost:4041/v2/op/update \
  -H 'Content-Type: application/json' \
  -H 'fiware-service: openiot' \
  -H 'fiware-servicepath: /' \
  -d '{
    "actionType": "update","entities": [
        {
            "type": "Bell","id": "urn:ngsi-ld:Bell:001","value": ""
            }
        }
    ]
}'

我的IoT代理版本为:

{
    "libVersion": "2.12.0-next","port": 4041,"baseRoot": "/","version": "1.14.0-next"
}

更新-使用IoTA和Orion的最新版本,我在以下IoTA日志文件中获得了

time=2020-10-22T20:46:49.063Z | lvl=DEBUG | corr=7c9fba8d-9262-4f81-9b4e-f71ab57953ff | trans=7c9fba8d-9262-4f81-9b4e-f71ab57953ff | op=IoTAgentNGSI.DeviceService | srv=n/a | subsrv=n/a | msg=Creating initial entity in the Context broker:
 {
    "url": "http://localhost:1026/v1/updateContext","method": "POST","json": {
        "contextElements": [
            {
                "type": "Bell","isPattern": "false","attributes": [
                    {
                        "name": "refStore","type": "Relationship","value": "urn:ngsi-ld:Store:001"
                    },{
                        "name": "ring_status","type": "commandStatus","value": "UNKNowN"
                    },{
                        "name": "ring_info","type": "commandResult","value": " "
                    },{
                        "name": "TimeInstant","type": "ISO8601","value": " "
                    }
                ]
            }
        ],"updateAction": "APPEND"
    },"headers": {
        "fiware-service": "openiot","fiware-servicepath": "/","fiware-correlator": "7c9fba8d-9262-4f81-9b4e-f71ab57953ff"
    }
} | comp=IoTAgent
time=2020-10-22T20:46:49.063Z | lvl=DEBUG | corr=7c9fba8d-9262-4f81-9b4e-f71ab57953ff | trans=7c9fba8d-9262-4f81-9b4e-f71ab57953ff | op=IoTAgentNGSI.DeviceService | srv=n/a | subsrv=n/a | msg=executeWithSecurity | comp=IoTAgent
time=2020-10-22T20:46:49.063Z | lvl=DEBUG | corr=7c9fba8d-9262-4f81-9b4e-f71ab57953ff | trans=7c9fba8d-9262-4f81-9b4e-f71ab57953ff | op=IoTAgentNGSI.MongoDBGroupRegister | srv=n/a | subsrv=n/a | msg=Looking for group params ["type"] with queryObj {"type":"Bell"} | comp=IoTAgent
time=2020-10-22T20:46:49.069Z | lvl=DEBUG | corr=7c9fba8d-9262-4f81-9b4e-f71ab57953ff | trans=7c9fba8d-9262-4f81-9b4e-f71ab57953ff | op=IoTAgentNGSI.MongoDBGroupRegister | srv=n/a | subsrv=n/a | msg=Device group for fields [["type"]] not found: [{"type":"Bell"}] | comp=IoTAgent
time=2020-10-22T20:46:49.069Z | lvl=DEBUG | corr=7c9fba8d-9262-4f81-9b4e-f71ab57953ff | trans=7c9fba8d-9262-4f81-9b4e-f71ab57953ff | op=IoTAgentNGSI.DeviceService | srv=n/a | subsrv=n/a | msg=error {"name":"DEVICE_GROUP_NOT_FOUND","message":"Couldn\t find device group for fields: [\"type\"] and values: {\"type\":\"Bell\"}","code":404} in get group device | comp=IoTAgent
time=2020-10-22T20:46:49.097Z | lvl=DEBUG | corr=7c9fba8d-9262-4f81-9b4e-f71ab57953ff | trans=7c9fba8d-9262-4f81-9b4e-f71ab57953ff | op=IoTAgentNGSI.DeviceService | srv=n/a | subsrv=n/a | msg=Initial entity created successfully. | comp=IoTAgent

解决方法

我设法使其可以与一个服务组(/ iot / d)一起使用。因此,Post附加传感器的请求来自/ iot / d服务组。 我使用docker映像(与docker compose编译,如示例所示)。 我还在docker文件中修改了IOTA_DEFAULT_RESOURCE,以防万一: IOTA_DEFAULT_RESOURCE= 我使用了最新的IoT Agent JSON 1.15.0和以前的Orion版本2.4.0。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。