Fiware:通过IDAS UltraLight注册/发送时,Orion CB中没有观察属性

时间:2015-10-04 13:06:03

标签: fiware fiware-orion

这个问题与Missing attributes on Orion CB Entity when registering device through 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模板,添加了'协议' field(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

我可以发送像

这样的观察
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"服务,但也失败了。

任何帮助表示赞赏。

1 个答案:

答案 0 :(得分:0)

你应该运行" python SendObservation.py NexusPro' otemp | 17'"而不是" python SendObservation.py Temp-Otterlo' otemp | 17'"。

原因是你在南行提供观察,然后应该使用DEV_ID。

在收到观察结果之前,实体不包含属性,因此您无法看到它。一旦你尝试了上面的一个,它应该都可以工作。

干杯,