繁体   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