Details
-
Type:
Monitor
-
Status: Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: FIWARE-TECH-HELP
-
Labels:
Description
Created question in FIWARE Q/A platform on 21-06-2021 at 07:06
Please, ANSWER this question AT https://stackoverflow.com/questions/68064277/can-not-access-lazy-attribute-in-fiware-opc-ua-agent
Question:
Can not access Lazy attribute in FIWARE OPC-UA Agent
Description:
Context
Used code base and tutorial: FIWARE IoT Agent for OPC-UA tutorial
Target
To access all available attributes both from IoT Agent and Orion Context Broker
To modify attributes via commands sent to Orion Context Broker then passed down to IoT Agent
Replicate steps
Clone repo and start containers
git clone "https://github.com/Engineering-Research-and-Development/iotagent-opcua"
cd iotagent-opcua
docker-compose up -d
#
I found this error from the log which related to DEVICE_GROUP_NOT_FOUND
time=2021-06-21T06:52:38.105Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.MongoDBGroupRegister | srv=n/a | subsrv=n/a | msg=Device group for fields [["type"]] not found: [
]
time=2021-06-21T06:52:38.105Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.NGSIService | srv=opcua_car | subsrv=/demo | msg=error {"name":"DEVICE_GROUP_NOT_FOUND","message":"Couldn\t find device group for fields: [\"type\"] and values:
","code":404} in get group device
Provision device
curl http://localhost:4001/iot/devices \
-H "fiware-service: opcua_car" \
-H "fiware-servicepath: /demo" \
-H "Content-Type: application/json" \
-d @./testCommands/add_device.json
Successfully provision new device
Send accelerate commands to both entities
curl -X PUT \
'http://localhost:1026/v2/entities/age01_Car/attrs/Accelerate?type=Device' \
-H 'content-type: application/json' \
-H 'fiware-service: opcua_car' \
-H 'fiware-servicepath: /demo' \
-d '{
"value": [2],
"type": "command"
}'
curl -X PUT \
'http://localhost:1026/v2/entities/age02_Car/attrs/Accelerate?type=Device' \
-H 'content-type: application/json' \
-H 'fiware-service: opcua_car' \
-H 'fiware-servicepath: /demo' \
-d '{
"value": [2],
"type": "command"
}'
Logs from Orion
INFO@07:08:37 logTracing.cpp[130]: Request received: PUT /v2/entities/age01_Car/attrs/Accelerate?type=Device, request payload (39 bytes): {
"value": [2],
"type": "command"
}, response code: 204
Logs from Agent
time=2021-06-21T07:12:49.845Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.GenericMiddlewares | msg=Request for path //op/update from [iotage:4001]
time=2021-06-21T07:12:49.845Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.GenericMiddlewares | msg=Body:
{
"entities": [
{
"id": "age02_Car",
"type": "Device",
"Accelerate": {
"type": "command",
"value": [
2
],
"metadata": {}
}
}
],
"actionType": "update"
}
time=2021-06-21T07:12:49.851Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.ContextServer-v2 | msg=Handling v2 update from [iotage:4001]
time=2021-06-21T07:12:49.851Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.ContextServer-v2 | msg={
"entities": [
{
"id": "age02_Car",
"type": "Device",
"Accelerate": {
"type": "command",
"value": [
2
],
"metadata": {}
}
}
],
"actionType": "update"
}
time=2021-06-21T07:12:49.854Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.MongoDBDeviceRegister | srv=opcua_car | subsrv=/demo | msg=Looking for device with name [age02_Car].
time=2021-06-21T07:12:49.858Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.MongoDBGroupRegister | srv=n/a | subsrv=n/a | msg=Looking for group params ["service","subservice","type","apikey"] with queryObj
time=2021-06-21T07:12:49.861Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.MongoDBGroupRegister | srv=opcua_car | subsrv=/demo | msg=Device group data found: {"commands":[
{"object_id":"ns=3;s=Stop","name":"Stop","type":"command"},
{"object_id":"ns=3;s=Accelerate","name":"Accelerate","type":"command"}],"staticAttributes":[],"lazy":[
{"object_id":"ns=3;s=Speed","name":"Speed","type":"Number"}],"attributes":[
{"object_id":"ns=3;s=Acceleration","name":"Acceleration","type":"Number"},
{"object_id":"ns=3;s=EngineStopped","name":"EngineStopped","type":"Boolean"},
{"object_id":"ns=3;s=Temperature","name":"Temperature","type":"Number"},
{"object_id":"ns=3;s=Oxigen","name":"Oxigen","type":"Number"}],"internalAttributes":[],"_id":"60d03a34fae871939ee2b880","resource":"/Device","apikey":"801230BJKL23Y9090DSFL123HJK09H324HV8732","type":"Device","service":"opcua_car","subservice":"/demo","cbHost":"orion:1026"}
time=2021-06-21T07:12:49.861Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.DeviceService | msg=deviceData before merge with conf: {"lazy":[
],"active":[
{"object_id":"ns=3;s=Acceleration","name":"Acceleration","type":"Number"},
{"object_id":"ns=3;s=EngineStopped","name":"EngineStopped","type":"Boolean"},
{"object_id":"ns=3;s=Temperature","name":"Temperature","type":"Number"},
{"object_id":"ns=3;s=Oxigen","name":"Oxigen","type":"Number"}],"commands":[
{"object_id":"ns=3;s=Stop","name":"Stop","type":"command"},
{"object_id":"ns=3;s=Accelerate","name":"Accelerate","type":"command"}],"staticAttributes":[],"subscriptions":[],"_id":"60d03a34fae8716b1fe2b881","creationDate":"2021-06-21T07:05:24.254Z","id":"age02_Car","type":"Device","name":"age02_Car","service":"opcua_car","subservice":"/demo","registrationId":"60d03a3436be993abd6fa505","internalId":null}
time=2021-06-21T07:12:49.862Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.DeviceService | msg=deviceData after merge with conf: {"lazy":[
],"active":[
{"object_id":"ns=3;s=Acceleration","name":"Acceleration","type":"Number"},
{"object_id":"ns=3;s=EngineStopped","name":"EngineStopped","type":"Boolean"},
{"object_id":"ns=3;s=Temperature","name":"Temperature","type":"Number"},
{"object_id":"ns=3;s=Oxigen","name":"Oxigen","type":"Number"}],"commands":[
{"object_id":"ns=3;s=Stop","name":"Stop","type":"command"},
{"object_id":"ns=3;s=Accelerate","name":"Accelerate","type":"command"}],"staticAttributes":[],"subscriptions":[],"_id":"60d03a34fae8716b1fe2b881","creationDate":"2021-06-21T07:05:24.254Z","id":"age02_Car","type":"Device","name":"age02_Car","service":"opcua_car","subservice":"/demo","registrationId":"60d03a3436be993abd6fa505","internalId":null,"internalAttributes":[],"cbHost":"orion:1026"}
time=2021-06-21T07:12:49.886Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.Entities-v2 | msg=Updating device value in the Context Broker at http://orion:1026/v2/entities/age02_Car/attrs?type=Device
time=2021-06-21T07:12:49.886Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.Entities-v2 | msg=Using the following NGSI v2 request:
{
"url": "http://orion:1026/v2/entities/age02_Car/attrs?type=Device",
"method": "POST",
"headers":
,
"json": {
"Accelerate_status":
}
}
time=2021-06-21T07:12:49.897Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.MongoDBDeviceRegister | srv=opcua_car | subsrv=/demo | msg=Device data found: {"lazy":[],"active":[
{"name":"Acceleration","type":"Number","object_id":"Acceleration"},
{"name":"EngineStopped","type":"Boolean","object_id":"EngineStopped"},
{"name":"Engine_Temperature","type":"Number","object_id":"Engine_Temperature"},
{"name":"Engine_Oxigen","type":"Number","object_id":"Engine_Oxigen"},
{"name":"DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xBusy","type":"String","object_id":"DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xBusy"},
{"name":"DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xBusyStatus","type":"Boolean","object_id":"DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xBusyStatus"},
{"name":"DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xDone","type":"String","object_id":"DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xDone"},
{"name":"DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xDoneStatus","type":"Boolean","object_id":"DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xDoneStatus"}],"commands":[
{"name":"Error","type":"command","object_id":"Error"},
{"name":"Stop","type":"command","object_id":"Stop"},
{"name":"Accelerate","type":"command","object_id":"Accelerate"},
{"name":"ActivateSensor","type":"command","object_id":"ActivateSensor"},
{"name":"DeactivateSensor","type":"command","object_id":"DeactivateSensor"},
{"name":"ToggleSensorActivation","type":"command","object_id":"ToggleSensorActivation"}],"staticAttributes":[],"subscriptions":[],"_id":"60d03735fae8717b05e2b87f","creationDate":"2021-06-21T06:52:37.486Z","id":"age01_Car","type":"Device","name":"age01_Car","service":"opcua_car","subservice":"/demo","registrationId":"60d0373536be993abd6fa504","endpoint":"opc.tcp://iotcarsrv:5001/UA/CarServer","polling":false}
time=2021-06-21T07:12:49.898Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.NGSIService | srv=opcua_car | subsrv=/demo | msg=executeWithDeviceInfo entityName age01_Car type undefined apikey undefined attributes [
,
{"name":"Accelerate_info","value":"Accelerated from 150"}] deviceInformation {"lazy":[],"active":[
{"name":"Acceleration","type":"Number","object_id":"Acceleration"},
{"name":"EngineStopped","type":"Boolean","object_id":"EngineStopped"},
{"name":"Engine_Temperature","type":"Number","object_id":"Engine_Temperature"},
{"name":"Engine_Oxigen","type":"Number","object_id":"Engine_Oxigen"},
{"name":"DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xBusy","type":"String","object_id":"DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xBusy"},
{"name":"DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xBusyStatus","type":"Boolean","object_id":"DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xBusyStatus"},
{"name":"DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xDone","type":"String","object_id":"DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xDone"},
{"name":"DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xDoneStatus","type":"Boolean","object_id":"DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xDoneStatus"}],"commands":[
{"name":"Error","type":"command","object_id":"Error"},
{"name":"Stop","type":"command","object_id":"Stop"},
{"name":"Accelerate","type":"command","object_id":"Accelerate"},
{"name":"ActivateSensor","type":"command","object_id":"ActivateSensor"},
{"name":"DeactivateSensor","type":"command","object_id":"DeactivateSensor"},
{"name":"ToggleSensorActivation","type":"command","object_id":"ToggleSensorActivation"}],"staticAttributes":[],"subscriptions":[],"_id":"60d03735fae8717b05e2b87f","creationDate":"2021-06-21T06:52:37.486Z","id":"age01_Car","type":"Device","name":"age01_Car","service":"opcua_car","subservice":"/demo","registrationId":"60d0373536be993abd6fa504","endpoint":"opc.tcp://iotcarsrv:5001/UA/CarServer","polling":false}
time=2021-06-21T07:12:49.898Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.MongoDBGroupRegister | srv=n/a | subsrv=n/a | msg=Looking for group params ["type"] with queryObj {}
time=2021-06-21T07:12:49.904Z | lvl=INFO | corr=n/a | trans=n/a | op=Index.Monitoring | comp=iotAgent-OPCUA | srv=opcua_car | subsrv=/demo | msg=ns=3;s=Acceleration value has changed to 2
time=2021-06-21T07:12:49.904Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.MongoDBDeviceRegister | srv=opcua_car | subsrv=/demo | msg=Looking for device with id [age01_Car].
time=2021-06-21T07:12:49.907Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.MongoDBGroupRegister | srv=opcua_car | subsrv=/demo | msg=Device group data found: {"commands":[
,
{"object_id":"ns=3;s=Accelerate","name":"Accelerate","type":"command"}],"staticAttributes":[],"lazy":[
{"object_id":"ns=3;s=Speed","name":"Speed","type":"Number"}],"attributes":[
{"object_id":"ns=3;s=Acceleration","name":"Acceleration","type":"Number"},
{"object_id":"ns=3;s=EngineStopped","name":"EngineStopped","type":"Boolean"},
{"object_id":"ns=3;s=Temperature","name":"Temperature","type":"Number"},
{"object_id":"ns=3;s=Oxigen","name":"Oxigen","type":"Number"}],"internalAttributes":[],"_id":"60d03a34fae871939ee2b880","resource":"/Device","apikey":"801230BJKL23Y9090DSFL123HJK09H324HV8732","type":"Device","service":"opcua_car","subservice":"/demo","cbHost":"orion:1026"}
time=2021-06-21T07:12:49.908Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.NGSIUtils | msg=typeInformation {"lazy":[],"active":[
,
{"name":"EngineStopped","type":"Boolean","object_id":"EngineStopped"},
{"name":"Engine_Temperature","type":"Number","object_id":"Engine_Temperature"},
{"name":"Engine_Oxigen","type":"Number","object_id":"Engine_Oxigen"},
{"name":"DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xBusy","type":"String","object_id":"DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xBusy"},
{"name":"DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xBusyStatus","type":"Boolean","object_id":"DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xBusyStatus"},
{"name":"DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xDone","type":"String","object_id":"DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xDone"},
{"name":"DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xDoneStatus","type":"Boolean","object_id":"DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xDoneStatus"}],"commands":[
{"name":"Error","type":"command","object_id":"Error"},
{"name":"Stop","type":"command","object_id":"Stop"},
{"name":"Accelerate","type":"command","object_id":"Accelerate"},
{"name":"ActivateSensor","type":"command","object_id":"ActivateSensor"},
{"name":"DeactivateSensor","type":"command","object_id":"DeactivateSensor"},
{"name":"ToggleSensorActivation","type":"command","object_id":"ToggleSensorActivation"}],"staticAttributes":[],"subscriptions":[],"_id":"60d03735fae8717b05e2b87f","creationDate":"2021-06-21T06:52:37.486Z","id":"age01_Car","type":"Device","name":"age01_Car","service":"opcua_car","subservice":"/demo","registrationId":"60d0373536be993abd6fa504","endpoint":"opc.tcp://iotcarsrv:5001/UA/CarServer","polling":false,"cbHost":"orion:1026"}
time=2021-06-21T07:12:49.917Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.MongoDBDeviceRegister | srv=opcua_car | subsrv=/demo | msg=Device data found: {"lazy":[],"active":[
,
{"name":"EngineStopped","type":"Boolean","object_id":"EngineStopped"},
{"name":"Engine_Temperature","type":"Number","object_id":"Engine_Temperature"},
{"name":"Engine_Oxigen","type":"Number","object_id":"Engine_Oxigen"},
{"name":"DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xBusy","type":"String","object_id":"DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xBusy"},
{"name":"DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xBusyStatus","type":"Boolean","object_id":"DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xBusyStatus"},
{"name":"DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xDone","type":"String","object_id":"DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xDone"},
{"name":"DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xDoneStatus","type":"Boolean","object_id":"DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xDoneStatus"}],"commands":[
{"name":"Error","type":"command","object_id":"Error"},
{"name":"Stop","type":"command","object_id":"Stop"},
{"name":"Accelerate","type":"command","object_id":"Accelerate"},
{"name":"ActivateSensor","type":"command","object_id":"ActivateSensor"},
{"name":"DeactivateSensor","type":"command","object_id":"DeactivateSensor"},
{"name":"ToggleSensorActivation","type":"command","object_id":"ToggleSensorActivation"}],"staticAttributes":[],"subscriptions":[],"_id":"60d03735fae8717b05e2b87f","creationDate":"2021-06-21T06:52:37.486Z","id":"age01_Car","type":"Device","name":"age01_Car","service":"opcua_car","subservice":"/demo","registrationId":"60d0373536be993abd6fa504","endpoint":"opc.tcp://iotcarsrv:5001/UA/CarServer","polling":false}
time=2021-06-21T07:12:49.918Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.NGSIService | srv=opcua_car | subsrv=/demo | msg=executeWithDeviceInfo entityName age01_Car type Device apikey attributes [{"name":"Acceleration","type":"Number","value":"2","metadatas":[
,
{"name":"ServerTimestamp","type":"ISO8601","value":"2021-06-21T07:12:49.892Z"}]}] deviceInformation {"lazy":[],"active":[
{"name":"Acceleration","type":"Number","object_id":"Acceleration"},
{"name":"EngineStopped","type":"Boolean","object_id":"EngineStopped"},
{"name":"Engine_Temperature","type":"Number","object_id":"Engine_Temperature"},
{"name":"Engine_Oxigen","type":"Number","object_id":"Engine_Oxigen"},
{"name":"DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xBusy","type":"String","object_id":"DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xBusy"},
{"name":"DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xBusyStatus","type":"Boolean","object_id":"DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xBusyStatus"},
{"name":"DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xDone","type":"String","object_id":"DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xDone"},
{"name":"DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xDoneStatus","type":"Boolean","object_id":"DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xDoneStatus"}],"commands":[
{"name":"Error","type":"command","object_id":"Error"},
{"name":"Stop","type":"command","object_id":"Stop"},
{"name":"Accelerate","type":"command","object_id":"Accelerate"},
{"name":"ActivateSensor","type":"command","object_id":"ActivateSensor"},
{"name":"DeactivateSensor","type":"command","object_id":"DeactivateSensor"},
{"name":"ToggleSensorActivation","type":"command","object_id":"ToggleSensorActivation"}],"staticAttributes":[],"subscriptions":[],"_id":"60d03735fae8717b05e2b87f","creationDate":"2021-06-21T06:52:37.486Z","id":"age01_Car","type":"Device","name":"age01_Car","service":"opcua_car","subservice":"/demo","registrationId":"60d0373536be993abd6fa504","endpoint":"opc.tcp://iotcarsrv:5001/UA/CarServer","polling":false}
time=2021-06-21T07:12:49.918Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.MongoDBGroupRegister | srv=n/a | subsrv=n/a | msg=Looking for group params ["type"] with queryObj
time=2021-06-21T07:12:49.922Z | lvl=INFO | corr=n/a | trans=n/a | op=IoTAgentNGSI.Entities-v2 | msg=Received the following response from the CB: Value updated successfully
Commands seem to be sent.
Get lazy attribute (named Speed)
curl -X GET \
http://localhost:1026/v2/entities/age01_Car/attrs/Speed \
-H 'fiware-service: opcua_car' \
-H 'fiware-servicepath: /demo'
I got this response
{"error":"NotFound","description":"The entity does not have such an attribute"}Logs from IoT Agent
time=2021-06-21T07:21:10.886Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.GenericMiddlewares | msg=Request for path //op/query from [iotage:4001]
time=2021-06-21T07:21:10.888Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.GenericMiddlewares | msg=Body:
{
"entities": [
],
"attrs": [
"Speed",
"Error",
"Stop",
"Accelerate",
"ActivateSensor",
"DeactivateSensor",
"ToggleSensorActivation"
]
}
time=2021-06-21T07:21:10.891Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.ContextServer-v2 | msg=Handling query from [iotage:4001]
time=2021-06-21T07:21:10.892Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.ContextServer-v2 | msg={
"entities": [
],
"attrs": [
"Speed",
"Error",
"Stop",
"Accelerate",
"ActivateSensor",
"DeactivateSensor",
"ToggleSensorActivation"
]
}
time=2021-06-21T07:21:10.893Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.MongoDBDeviceRegister | srv=opcua_car | subsrv=/demo | msg=Looking for device with name [age01_Car].
time=2021-06-21T07:21:10.905Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.MongoDBGroupRegister | srv=n/a | subsrv=n/a | msg=Looking for group params ["service","subservice","type","apikey"] with queryObj
time=2021-06-21T07:21:10.911Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.MongoDBGroupRegister | srv=opcua_car | subsrv=/demo | msg=Device group data found: {"commands":[
{"object_id":"ns=3;s=Stop","name":"Stop","type":"command"},
{"object_id":"ns=3;s=Accelerate","name":"Accelerate","type":"command"}],"staticAttributes":[],"lazy":[
{"object_id":"ns=3;s=Speed","name":"Speed","type":"Number"}],"attributes":[
{"object_id":"ns=3;s=Acceleration","name":"Acceleration","type":"Number"},
{"object_id":"ns=3;s=EngineStopped","name":"EngineStopped","type":"Boolean"},
{"object_id":"ns=3;s=Temperature","name":"Temperature","type":"Number"},
{"object_id":"ns=3;s=Oxigen","name":"Oxigen","type":"Number"}],"internalAttributes":[],"_id":"60d03a34fae871939ee2b880","resource":"/Device","apikey":"801230BJKL23Y9090DSFL123HJK09H324HV8732","type":"Device","service":"opcua_car","subservice":"/demo","cbHost":"orion:1026"}
time=2021-06-21T07:21:10.921Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.ContextServer-v2 | msg=Handling received set of attributes: ["Speed","Error","Stop","Accelerate","ActivateSensor","DeactivateSensor","ToggleSensorActivation"]
time=2021-06-21T07:21:10.934Z | lvl=INFO | corr=n/a | trans=n/a | op=Index.QueryContextHandler | comp=iotAgent-OPCUA | srv=opcua_car | subsrv=/demo | msg=dataValue.value.value=150
time=2021-06-21T07:21:10.934Z | lvl=INFO | corr=n/a | trans=n/a | op=Index.QueryContextHandler | comp=iotAgent-OPCUA | srv=opcua_car | subsrv=/demo | msg= read variable % = { /* DataValue */
value: Variant(Scalar<Double>, value: 150)
statusCode: Good (0x00000)
serverTimestamp: null
sourceTimestamp: null
}
time=2021-06-21T07:21:10.935Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.ContextServer-v2 | msg=Query from [iotage:4001] handled successfully.
time=2021-06-21T07:21:10.939Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.DomainControl | msg=response-time: 63
Logs from OCB
WARN@07:24:19 AlarmManager.cpp[432]: Releasing alarm BadInput 192.168.208.1
INFO@07:24:19 logTracing.cpp[146]: Starting forwarding for GET /v2/entities/age01_Car/attrs/Speed
INFO@07:24:19 logTracing.cpp[212]: Request forwarded (regId: 60d0373536be993abd6fa504): POST http://iotage:4001/op/query, request payload (156 bytes): {"entities":[
],"attrs":["Speed","Error","Stop","Accelerate","ActivateSensor","DeactivateSensor","ToggleSensorActivation"]}, response payload (226 bytes): [{"id":"age01_Car","type":"Device","attributes":[{"name":"Speed","type":"string","value":"150","metadatas":[
{"name":"SourceTimestamp","type":"ISO8601","value":null},
{"name":"ServerTimestamp","type":"ISO8601","value":null}]}]}], response code: 200
WARN@07:24:19 AlarmManager.cpp[405]: Raising alarm BadInput 192.168.208.1: attribute must be a JSON object, unless keyValues option is used
WARN@07:24:19 postQueryContext.cpp[369]: Internal Error (error parsing reply from context provider: attribute must be a JSON object, unless keyValues option is used)
INFO@07:24:19 logTracing.cpp[79]: Request received: GET /v2/entities/age01_Car/attrs/Speed, response code: 404
docker-compose.yml
The file has been modified from the original
version: "3"
services:
iotcarsrv:
hostname: iotcarsrv
image: iotagent4fiware/opcuacarsrv:latest
volumes:
- ./CARCONF/car_config.json:/opt/opc-ua-car-server/Car/Car1/config/car_config.json
networks: - hostnet
ports: - "5001:5001"
iotage:
hostname: iotage
image: iotagent4fiware/iotagent-opcua:latest
networks:
- hostnet
- iotnet
ports: - "4001:4001"
- "4081:8080"
depends_on: - iotcarsrv
- iotmongo
- orion
volumes: - ./AGECONF:/opt/iotagent-opcua/conf
- ./certificates:/opt/iotagent-opcua/certificates
command: node index.js
environment: - IOTA_REGISTRY_TYPE=mongodb #Whether to hold IoT device info in memory or in a database
- IOTA_LOG_LEVEL=DEBUG # The log level of the IoT Agent
- IOTA_MONGO_HOST=iot_mongo # The host name of MongoDB
- IOTA_MONGO_DB=iotagent_opcua # The name of the database used in mongoDB
- IOTA_CB_NGSI_VERSION=v2 # use NGSI-v2 when sending updates for active attributes
- IOTA_FALLBACK_TENANT=opcua_car
- IOTA_RELAX_TEMPLATE_VALIDATION=true
iotmongo:
hostname: iot_mongo
image: mongo:4.4
networks:
- iotnet
volumes: - iot_mongo_data:/data/db
- iot_mongo_conf:/data/configdb
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- OCB ################
-
-
-
-
-
-
-
-
-
-
-
-
-
-
orion:
hostname: orion
image: fiware/orion:latest # Change to orion-ld if IOTA_CB_NGSI_VERSION=ld
networks:
- hostnet
- ocbnet
ports: - "1026:1026"
depends_on: - orion_mongo
command: -statCounters -dbhost orion_mongo -logForHumans -logLevel DEBUG -t 255
orion_mongo:
hostname: orion_mongo
image: mongo:4.4
networks:
- ocbnet
ports: - "27017:27017"
volumes: - orion_mongo_data:/data/db
- orion_mongo_conf:/data/configdb
command: --nojournal # add a buffer for changes made in mongodb with the cost of doubling the memory
volumes:
iot_mongo_data:
iot_mongo_conf:
orion_mongo_data:
orion_mongo_conf:
networks:
hostnet:
iotnet:
ocbnet:
Issue
Not allow to retrieve lazy attribute as in the tutorial
Unknown Error in IoT Agent's log
I can however access other attributes.
Activity
- All
- Comments
- History
- Activity
- Transitions
2021-06-22 05:31|CREATED monitor | # answers= 0, accepted answer= False