我是Fiware用户,我在云上的不同VM中部署了orion上下文代理GE、cepheus GE和iotagent-ul实例。我已经在物联网代理中注册了一个设备,在注册请求中指定了一个命令属性,并在注册过程的上下文代理中创建了相应的实体。现在,当我用它的属性注册一个设备,用它的名称和类型注册一个命令属性时,这个设备在物联网代理上注册,它的实体也在上下文代理中创建。但奇怪的是,命令属性只被转换成它的特殊属性,即commandName_info和commandName_status,但是在注册结果中没有显示命令属性本身,因为物联网代理记录了.In加法,当我对Orion中的命令属性执行更新操作时,该属性不被识别,更新失败,因为在实体本身中缺少命令属性。登记程序如下:
(curl -v -H 'content-type: application/json‘-H 'fiware-service: ourservicename’-H‘fiware: /ourservicpath’-X POST 'http://iotagentULaddress:8080/iot/devices‘-d @- ) << EOF
{
"`devices`": [
{
"device_id": "controller12",
"entity_name": "labcontroller12",
"entity_type": "Controller",
"isPattern" :"false",
"protocol": "IoTA-UL",
"timezone": "Egypt/Cairo",
"endpoint": "http://iotagentULaddress:8080",
"attributes": [
{
"object_id": "n",
"name": "number",
"type": "string"
}],
"commands": [{
"name": "play",
"type": "string"
}]
}]
}
EOF这是物联网代理日志中的注册结果,显示注册实体以及如何在上下文代理中创建该实体:
time=2017-03-06T18:10:56.335Z | lvl=DEBUG | corr=dee16709-4b99-4336-b23a-722878a8b628 | trans=dee16709-4b99-4336-b23a-722878a8b628 | op=IoTAgentNGSI.ContextServer | srv=n/a | subsrv=n/a | msg=Successfully subscribed to the following topics:
["/+/+/attrs/+","/+/+/attrs","/+/+/cmdexe"]
| comp=IoTAgent
{"op":"IOTAUL.Executable","time":"2017-03-06T18:10:56.427Z","lvl":"INFO","msg":"Ultralight 2.0 IoT Agent started"}
time=2017-03-06T18:12:14.459Z | lvl=DEBUG | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.GenericMiddlewares | srv=hi | subsrv=/hi | msg=Request for path [/iot/devices] from [217.172.12.190:8080] | comp=IoTAgent
time=2017-03-06T18:12:14.460Z | lvl=DEBUG | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.GenericMiddlewares | srv=hi | subsrv=/hi | msg=Body:
{
"devices": [
{
"device_id": "controller12",
"entity_name": "labcontroller12",
"entity_type": "Controller",
"isPattern": "false",
"protocol": "IoTA-UL",
"timezone": "Egypt/Cairo",
"endpoint": "http://217.172.12.190:8080",
"attributes": [
{
"object_id": "n",
"name": "number",
"type": "string"
}
],
"commands": [
{
"object_id": "s",
"name": "play",
"type": "string"
}
]
}
]
}
| comp=IoTAgent
time=2017-03-06T18:12:14.463Z | lvl=DEBUG | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.DeviceProvisioning | srv=hi | subsrv=/hi | msg=Handling device provisioning request. | comp=IoTAgent
time=2017-03-06T18:12:14.464Z | lvl=DEBUG | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.MongoDBGroupRegister | srv=hi | subsrv=/hi | msg=Looking for entity params undefined | comp=IoTAgent
Mongoose: mpromise (mongoose's default promise library) is deprecated, plug in your own promise library instead: http://mongoosejs.com/docs/promises.html
time=2017-03-06T18:12:14.473Z | lvl=DEBUG | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.MongoDBGroupRegister | srv=hi | subsrv=/hi | msg=Device group for fields [undefined] not found: [{"undefined":"Controller"}] | comp=IoTAgent
time=2017-03-06T18:12:14.473Z | lvl=DEBUG | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.BidirectionalPlugin | srv=hi | subsrv=/hi | msg=Extracting attribute list | comp=IoTAgent
time=2017-03-06T18:12:14.473Z | lvl=DEBUG | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.BidirectionalPlugin | srv=hi | subsrv=/hi | msg=Sending bidirectionality subscriptions for device [controller12] | comp=IoTAgent
time=2017-03-06T18:12:14.474Z | lvl=DEBUG | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.MongoDBGroupRegister | srv=hi | subsrv=/hi | msg=Looking for bindings for the function [deviceProvisioningHandler] and protocol [null] | comp=IoTAgent
time=2017-03-06T18:12:14.474Z | lvl=DEBUG | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.MongoDBGroupRegister | srv=hi | subsrv=/hi | msg=Binding found for function [deviceProvisioningHandler] and protocol [null] | comp=IoTAgent
time=2017-03-06T18:12:14.475Z | lvl=DEBUG | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.MongoDBDeviceRegister | srv=hi | subsrv=/hi | msg=Looking for entity with id [controller12]. | comp=IoTAgent
time=2017-03-06T18:12:14.476Z | lvl=DEBUG | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.MongoDBDeviceRegister | srv=hi | subsrv=/hi | msg=Entity [controller12] not found. | comp=IoTAgent
time=2017-03-06T18:12:14.477Z | lvl=ERROR | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.Alarms | srv=hi | subsrv=/hi | msg=Raising [MONGO-ALARM]: undefined | comp=IoTAgent
time=2017-03-06T18:12:14.477Z | lvl=DEBUG | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.MongoDBGroupRegister | srv=hi | subsrv=/hi | msg=Looking for entity params undefined | comp=IoTAgent
time=2017-03-06T18:12:14.478Z | lvl=DEBUG | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.MongoDBGroupRegister | srv=hi | subsrv=/hi | msg=Device group for fields [undefined] not found: [{"undefined":"Controller"}] | comp=IoTAgent
time=2017-03-06T18:12:14.479Z | lvl=DEBUG | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.DeviceService | srv=hi | subsrv=/hi | msg=Registering device into NGSI Service:
{
"id": "controller12",
"type": "Controller",
"name": "labcontroller12",
"service": "hi",
"subservice": "/hi",
"active": [
{
"object_id": "n",
"name": "number",
"type": "string"
}
],
"staticAttributes": [],
"lazy": null,
"commands": [
{
"object_id": "s",
"name": "play",
"type": "string"
}
],
"timezone": "Egypt/Cairo",
"endpoint": "http://217.172.12.190:8080",
"protocol": "IoTA-UL",
"transport": "HTTP",
"internalId": null,
"subscriptions": [],
"polling": false
} | comp=IoTAgent
time=2017-03-06T18:12:14.480Z | lvl=DEBUG | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.DeviceService | srv=hi | subsrv=/hi | msg=Sending device registrations to Context Broker at [http://147.27.60.58:1026/NGSI9/registerContext] | comp=IoTAgent
time=2017-03-06T18:12:14.480Z | lvl=DEBUG | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.DeviceService | srv=hi | subsrv=/hi | msg=Using the following request:
{
"url": "http://147.27.60.58:1026/NGSI9/registerContext",
"method": "POST",
"json": {
"contextRegistrations": [
{
"entities": [
{
"type": "Controller",
"isPattern": "false",
"id": "labcontroller12"
}
],
"attributes": [
{
"name": "play",
"type": "string",
"isDomain": "false"
}
],
"providingApplication": "http://localhost:4061"
}
],
"duration": "P1Y"
},
"headers": {
"fiware-service": "hi",
"fiware-servicepath": "/hi"
}
}
| comp=IoTAgent
time=2017-03-06T18:12:14.701Z | lvl=DEBUG | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.DeviceService | srv=hi | subsrv=/hi | msg=Registration success. | comp=IoTAgent
time=2017-03-06T18:12:14.702Z | lvl=DEBUG | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.DeviceService | srv=hi | subsrv=/hi | msg=Creating initial entity in the Context Broker:
{
"url": "http://147.27.60.58:1026/v1/updateContext",
"method": "POST",
"json": {
"contextElements": [
{
"type": "Controller",
"isPattern": "false",
"id": "labcontroller12",
"attributes": [
{
"name": "number",
"type": "string",
"value": " "
},
{
"name": "play_status",
"type": "commandStatus",
"value": "UNKNOWN"
},
{
"name": "play_info",
"type": "commandResult",
"value": " "
},
{
"name": "TimeInstant",
"type": "ISO8601",
"value": " "
}
]
}
],
"updateAction": "APPEND"
},
"headers": {
"fiware-service": "hi",
"fiware-servicepath": "/hi",
"fiware-correlator": "2d54c696-7c62-454a-bdf2-5fb289f53e28"
}
} | comp=IoTAgent
time=2017-03-06T18:12:14.915Z | lvl=DEBUG | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.DeviceService | srv=hi | subsrv=/hi | msg=Initial entity created successfully. | comp=IoTAgent
time=2017-03-06T18:12:14.920Z | lvl=DEBUG | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.MongoDBDeviceRegister | srv=hi | subsrv=/hi | msg=Storing device with id [controller12] and type [Controller] | comp=IoTAgent
time=2017-03-06T18:12:14.930Z | lvl=ERROR | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.Alarms | srv=hi | subsrv=/hi | msg=Releasing [MONGO-ALARM] | comp=IoTAgent
time=2017-03-06T18:12:14.931Z | lvl=DEBUG | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.DeviceProvisioning | srv=hi | subsrv=/hi | msg=Device provisioning request succeeded | comp=IoTAgent
time=2017-03-06T18:12:14.933Z | lvl=DEBUG | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.DomainControl | srv=hi | subsrv=/hi | msg=response-time: 486 | comp=IoTAgent现在很清楚的是,命令属性不是创建的,而是它描述命令状态本身的特殊属性,但是没有要更新的命令。那么,我的注册请求是否正确地合成,以适应iotagen-ul的情况,特别是它对命令的解释?我怎样才能验证注册的正确性?我只想知道问题到底在哪里。非常感谢。
发布于 2017-03-07 08:30:55
正如您在日志中所看到的,您必须查询的命令是作为上下文提供程序注册创建的(对下面的url“http://147.27.60.58:1026/NGSI9/registerContext”的请求)。命令属性不是注册为NGSI属性,而是定义为由另一个上下文提供程序(本例中的IoTAgent )提供的属性。这就是为什么在创建初始实体的请求中没有提到命令属性:这是预期的行为。
https://stackoverflow.com/questions/42633821
复制相似问题