I'm trying to follow Robot's example:
https://fiware-iotagent-lwm2m.readthedocs.io/en/latest/deviceProvisioning/
Using dynamic provisioning in the latest stable version of Fiware/Orion.
Virtual Device data: (following this: https://github.com/telefonicaid/lwm2m-node-lib)
create /7392/0
set /7392/0 1 79
set /7392/0 2 "First robot here"
set /7392/0 3 "[0, 0]"
connect 127.0.0.1 5683 robot1 /
list
Here I show the Dockerfile:
volumes:
mongodb:
services:
iotagent:
image: fiware/lightweightm2m-iotagent
depends_on:
- mongodb
ports:
- "4041:4041"
- "5683:5683/udp"
environment:
- "IOTA_CB_HOST=orion"
- "IOTA_CB_PORT=1026"
- "IOTA_NORTH_PORT=4041"
- "IOTA_REGISTRY_TYPE=mongodb"
- "IOTA_MONGO_HOST=mongodb"
- "IOTA_MONGO_PORT=27017"
- "IOTA_MONGO_DB=iotagent-lwm2m"
volumes:
- "./config.js:/opt/iota-lwm2m/config.js"
- "./omaInverseRegistry.json:/opt/iota-lwm2m/omaInverseRegistry.json"
- "./omaRegistry.json:/opt/iota-lwm2m/omaRegistry.json"
mongodb:
image: mongo:3.6
ports:
- "27017:27017"
command: --bind_ip_all --smallfiles
volumes:
- mongodb:/data
orion:
image: fiware/orion
depends_on:
- mongodb
expose:
- "1026"
ports:
- "1026:1026"
command: -dbhost mongodb
Here I show the config.js file:
var config = {};
config.lwm2m = {
logLevel: 'DEBUG',
port: '5683',
defaultType: 'Robot',
ipProtocol: 'udp4',
serverProtocol: 'udp4',
delayedObservationTimeout: 50,
formats: [
{
name: 'application-vnd-oma-lwm2m/tlv',
value: 11542
},
{
name: 'application-vnd-oma-lwm2m/json',
value: 11543
},
{
name: 'application-vnd-oma-lwm2m/opaque',
value: 11544
}
],
writeFormat: 'application-vnd-oma-lwm2m/opaque',
types: []
};
config.ngsi = {
logLevel: 'DEBUG',
contextBroker: {
host: 'orion',
port: '1026'
},
server: {port: '4041'},
deviceRegistry: {type: 'mongo'},
mongodb: {
host: 'mongo',
port: '27017',
db: 'mongo-iotagent'
},
types: {},
service: 'Default',
subservice: '/default',
providerUrl: 'http://iotagent:4041',
deviceRegistrationDuration: 'P1M'
};
module.exports = config;
retrieve devices provisioning returns:
"count": 1,
"devices": [
{
"device_id": "robot1",
"service": "Factory",
"service_path": "/robots",
"entity_name": "robot1",
"entity_type": "Robot",
"attributes": [
{
"object_id": "Battery",
"name": "Battery",
"type": "number"
}
],
"lazy": [
{
"object_id": "Message",
"name": "Message",
"type": "string"
}
],
"commands": [
{
"object_id": "Position",
"name": "Position",
"type": "location"
}
],
"static_attributes": [],
"internal_attributes": {
"lwm2mResourceMapping": {
"Battery": {
"objectType": 7392,
"objectInstance": 0,
"objectResource": 1
},
"Message": {
"objectType": 7392,
"objectInstance": 0,
"objectResource": 2
},
"Position": {
"objectType": 7392,
"objectInstance": 0,
"objectResource": 3
}
}
}
}
]
}
retrieve entities v2:
'http://192.168.1.32:1026/v2/entities?limit=50' \
-H 'Postman-Token: 4195a240-4eab-4698-b9f2-200490f59514' \
-H 'cache-control: no-cache' \
-H 'fiware-service: Factory' \
-H 'fiware-servicepath: /robots'
returns me:
[
{
"id": "robot1",
"type": "Robot",
"Battery": {
"type": "number",
"value": "79",
"metadata": {}
},
"Position_info": {
"type": "commandResult",
"value": " ",
"metadata": {}
},
"Position_status": {
"type": "commandStatus",
"value": "UNKNOWN",
"metadata": {}
}
}
]
Well, now i cant access to lazy values or modify them
curl -X POST \
http://192.168.1.32:1026/v1/queryContext \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Postman-Token: 5ea5ae61-6367-46d0-864c-027e153d2d28' \
-H 'cache-control: no-cache' \
-H 'fiware-service: Factory' \
-H 'fiware-servicepath: /robots' \
-d '{
"entities": [
{
"type": "Robot",
"isPattern": "false",
"id": "robot1"
}
],
"attributes": [
"Message"
]
}'
returns:
{
"errorCode": {
"code": "404",
"reasonPhrase": "No context element found",
"details": "No device was found with id:robot1"
}
}
Server log when i try to get a lazy value :
iotagent_1 | time=2019-02-07T15:45:24.412Z | lvl=DEBUG | corr=622b203e-2aef-11e9-9039-0242ac130004 | trans=6f5738c9-ef56-4a40-ac1b-92c4a1592987 | op=IoTAgentNGSI.GenericMiddlewares | srv=factory | subsrv=/robots | msg=Request for path [//queryContext] from [iotagent:4041] | comp=IoTAgent
iotagent_1 | time=2019-02-07T15:45:24.412Z | lvl=DEBUG | corr=622b203e-2aef-11e9-9039-0242ac130004 | trans=6f5738c9-ef56-4a40-ac1b-92c4a1592987 | op=IoTAgentNGSI.GenericMiddlewares | srv=factory | subsrv=/robots | msg=Body:
iotagent_1 | {
iotagent_1 | "entities": [
iotagent_1 | {
iotagent_1 | "type": "Robot",
iotagent_1 | "isPattern": "false",
iotagent_1 | "id": "robot1"
iotagent_1 | }
iotagent_1 | ],
iotagent_1 | "attributes": [
iotagent_1 | "Message"
iotagent_1 | ]
iotagent_1 | }
iotagent_1 | | comp=IoTAgent
iotagent_1 | time=2019-02-07T15:45:24.412Z | lvl=DEBUG | corr=622b203e-2aef-11e9-9039-0242ac130004 | trans=6f5738c9-ef56-4a40-ac1b-92c4a1592987 | op=IoTAgentNGSI.ContextServer | srv=factory | subsrv=/robots | msg=Handling query from [iotagent:4041] | comp=IoTAgent
iotagent_1 | time=2019-02-07T15:45:24.413Z | lvl=DEBUG | corr=622b203e-2aef-11e9-9039-0242ac130004 | trans=6f5738c9-ef56-4a40-ac1b-92c4a1592987 | op=IoTAgentNGSI.MongoDBDeviceRegister | srv=factory | subsrv=/robots | msg=Looking for device with name [robot1]. | comp=IoTAgent
iotagent_1 | time=2019-02-07T15:45:24.415Z | lvl=DEBUG | corr=4fcfe24e-6c43-470d-864d-beb1b52cf383 | trans=4fcfe24e-6c43-470d-864d-beb1b52cf383 | op=IoTAgentNGSI.MongoDBDeviceRegister | srv=n/a | subsrv=n/a | msg=Device [robot1] not found. | comp=IoTAgent
iotagent_1 | time=2019-02-07T15:45:24.415Z | lvl=DEBUG | corr=4fcfe24e-6c43-470d-864d-beb1b52cf383 | trans=4fcfe24e-6c43-470d-864d-beb1b52cf383 | op=IoTAgentNGSI.ContextServer | srv=n/a | subsrv=n/a | msg=There was an error handling the query: [object Object]. | comp=IoTAgent
iotagent_1 | time=2019-02-07T15:45:24.415Z | lvl=DEBUG | corr=4fcfe24e-6c43-470d-864d-beb1b52cf383 | trans=4fcfe24e-6c43-470d-864d-beb1b52cf383 | op=IoTAgentNGSI.ContextServer | srv=n/a | subsrv=n/a | msg=Query error [DEVICE_NOT_FOUND] handling request: No device was found with id:robot1 | comp=IoTAgent
orion_1 | time=Thursday 07 Feb 15:45:24 2019.416Z | lvl=WARN | corr=622b203e-2aef-11e9-9039-0242ac130004 | trans=1549550994-444-00000000096 | from=192.168.1.32 | srv=factory | subsrv=/robots | comp=Orion | op=httpRequestSend.cpp[625]:httpRequestSendWithCurl | msg=Notification response NOT OK, http code: 404
iotagent_1 | time=2019-02-07T15:45:24.416Z | lvl=DEBUG | corr=622b203e-2aef-11e9-9039-0242ac130004 | trans=6f5738c9-ef56-4a40-ac1b-92c4a1592987 | op=IoTAgentNGSI.DomainControl | srv=factory | subsrv=/robots | msg=response-time: 5 | comp=IoTAgent
I could also show the log when I try to modify the value of the 'Message' lazy attribute. but this issue seems long enough.
It works flawless using this docker images:
iotagent: hopu/lwm2m-iotagent:observe-and-read
orion: fiware/orion:2.0.0
I'm trying to follow Robot's example:
https://fiware-iotagent-lwm2m.readthedocs.io/en/latest/deviceProvisioning/
Using dynamic provisioning in the latest stable version of Fiware/Orion.
Virtual Device data: (following this: https://github.com/telefonicaid/lwm2m-node-lib)
Here I show the Dockerfile:
Here I show the config.js file:
retrieve devices provisioning returns:
retrieve entities v2:
returns me:
Well, now i cant access to lazy values or modify them
returns:
Server log when i try to get a lazy value :
I could also show the log when I try to modify the value of the 'Message' lazy attribute. but this issue seems long enough.
It works flawless using this docker images:
iotagent: hopu/lwm2m-iotagent:observe-and-read
orion: fiware/orion:2.0.0