我是Fiware用戶,我在雲上的不同VM上部署了orion context broker GE,cepheus GE和iotagent-ul實例。我已經在註冊過程中在註冊過程中在上下文代理中創建了在註冊請求中指定命令屬性的IOT代理中註冊了一個設備,並且它的對應實體已經創建。 現在,當我註冊一個帶有其屬性和命令屬性 及其名稱和類型的設備時,該設備在iot代理上註冊,其實體也在上下文代理中創建。但奇怪的是,命令屬性只能轉換成它的特殊屬性,它們是commandName_info和commandName_status,但命令屬性本身並沒有顯示在註冊 中,導致IOT代理日誌。另外,當我對Orion上下文代理中的命令屬性執行更新操作,則該屬性無法識別,並且更新失敗,因爲entitiy本身缺少命令屬性。和註冊過程如下:Fiware Orion上下文代理和iotagentUL命令問題
- 這是登記請求,我發送:
(捲曲-v -H '內容 - 類型:application/JSON' -H「fiware服務:ourservicename」 -H 'fiware-servicepath:/ 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
這是註冊結果在IOT代理日誌示出了註冊實體和它是如何創造泰德的背景下,券商:
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實例,尤其是它對命令的解釋?我如何驗證註冊的正確性?我只是想知道問題可能出在哪裏。並非常感謝。
據我所知,命令屬性是在註冊表進程中聲明後在上下文代理中創建的,更新上下文代理中的屬性會觸發該命令,即根據參考http:// fiware -iot-stack.readthedocs.io/en/latest/device_api/。你的意思是說,作爲一個上下文提供者,iot代理將是唯一一個負責更新命令的人,例如甚至不是cepheus或第三方。 ..如果該命令沒有註冊爲NGSI屬性,我怎麼能讓命令出現,然後更新它正確? – ahmad
該命令由IoT代理(其上下文提供者)提供。請從Orion CB用戶和程序員指南中查看有關上下文和NGSI9的文檔:https://fiware-orion.readthedocs.io/en/develop/user/context_providers/index.html –