簡體   English   中英

Fiware IoT Agent Json 拒絕 POST 到 /v2/op/update

[英]Fiware IoT Agent Json refused to POST to /v2/op/update

我對固件物聯網代理 JSON 感興趣,我試圖解決問題。 我已經使用教程安裝了 IoT 代理 JSON。 本教程參考 IoT Actuator Connection 並檢查我們必須 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",
            "ring" : {
                "type": "command",
                "value": ""
            }
        }
    ]
}'

我的物聯網代理版本是:

{
    "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",
                "id": "urn:ngsi-ld:Bell:001",
                "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。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM