簡體   English   中英

Fiware:通過IDAS UltraLight注冊/發送時,Orion CB中沒有觀察屬性

[英]Fiware: No observation attributes in Orion CB when registered/sent via IDAS UltraLight

這個問題非常類似於Orion CB Entity在通過IDAS注冊設備時的缺失屬性,但在那里沒有找到明確的答案。

我一直在嘗試使用IDWare通過IDAS將UL2.0送到在Fiware-Lab環境中工作的Orion CB:

我有一個FI-WARE Lab帳戶,生成了令牌。 修改了config.ini文件:

[user]
# Please, configure here your username at FIWARE Cloud and a valid Oauth2.0 TOKEN for your user (you can use get_token.py to obtain a valid TOKEN).
username=MY_USERNAME
token=MY_TOKEN

[contextbroker]
host=130.206.80.40
port=1026
OAuth=no
# Here you need to specify the ContextBroker database you are querying.
# Leave it blank if you want the general database or the IDAS service if you are looking for IoT devices connected by you.
# fiware_service=
fiware_service=bus_auto
fiware-service-path=/

[idas]
host=130.206.80.40
adminport=5371
ul20port=5371
OAuth=no
# Here you need to configure the IDAS service your devices will be sending data to.
# By default the OpenIoT service is provided.
# fiware-service=fiwareiot
fiware-service=bus_auto
fiware-service-path=/
#apikey=4jggokgpepnvsb2uv4s40d59ov
apikey=4jggokgpepnvsb2uv4s40d59ov

[local]
#Choose here your System type. Examples: RaspberryPI, MACOSX, Linux, ...
host_type=MACOSX
# Here please add a unique identifier for you. Suggestion: the 3 lower hexa bytes of your Ethernet MAC. E.g. 79:ed:af
# Also you may use your e-mail address.
host_id=a0:11:00

我使用了SENSOR_TEMP模板,添加了'protocol'字段(PDI-IoTA-UltraLight,這是我偶然發現的第一個問題):

{
 "devices": [
    { "device_id": "DEV_ID",
      "entity_name": "ENTITY_ID",
      "entity_type": "thing",
      "protocol": "PDI-IoTA-UltraLight",
      "timezone": "Europe/Amsterdam",
"attributes": [
        { "object_id": "otemp",
          "name": "temperature",
          "type": "int"
        } ],
 "static_attributes": [
        { "name": "att_name",
          "type": "string",
          "value": "value"
        }
       ]
      }
     ]
    }

現在我可以注冊設備了。 喜歡

python RegisterDevice.py SENSOR_TEMP NexusPro Temp-Otterlo

並在設備列表中看到它:

python ListDevices.py

我可以像發送Observations一樣發送

python SendObservation.py Temp-Otterlo 'otemp|17'

但是在ContextBroker中我看到實體但從未進行過測量,例如

python GetEntity.py Temp-Otterlo

* Asking to http://130.206.80.40:1026/ngsi10/queryContext
* Headers: {'Fiware-Service': 'bus_auto', 'content-type': 'application/json', 'accept': 'application/json', 'X-Auth-Token': 'NULL'}
* Sending PAYLOAD:
{
    "entities": [
        {
            "type": "",
            "id": "Temp-Otterlo",
            "isPattern": "false"
        }
    ],
    "attributes": []
}

...

* Status Code: 200
* Response:
{
  "contextResponses" : [
    {
      "contextElement" : {
        "type" : "thing",
        "isPattern" : "false",
        "id" : "Temp-Otterlo",
        "attributes" : [
          {
            "name" : "TimeInstant",
            "type" : "ISO8601",
            "value" : "2015-10-03T14:04:44.663133Z"
          },
          {
            "name" : "att_name",
            "type" : "string",
            "value" : "value",
            "metadatas" : [
              {
                "name" : "TimeInstant",
                "type" : "ISO8601",
                "value" : "2015-10-03T14:04:44.663500Z"
              }
            ]
          }
        ]
      },
      "statusCode" : {
        "code" : "200",
        "reasonPhrase" : "OK"
      }
    }
  ]
}

我奇怪地得到了一個TimeInstant屬性。 我嘗試使用.ini的設置,如fiware-service = fiwareiot,但無濟於事。 我沒有想法。 目錄中的文檔。 IDAS4正在討論要發送到端口8002並設置“OpenIoT”服務的觀察,但也失敗了。

任何幫助贊賞。

你應該運行“python SendObservation.py NexusPro'otemp | 17'”而不是“python SendObservation.py Temp-Otterlo'otemp | 17'”。

原因是您在南行提供觀察,然后應使用DEV_ID。

在收到觀察結果之前,實體不包含屬性,因此您無法看到它。 一旦你嘗試了上面的那個,它應該都可以工作。

干杯,

暫無
暫無

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

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