lightweightm2m-iotagent
lightweightm2m-iotagent copied to clipboard
Active attributes are not correctly observed
We have been doing some integration tests with real devices and the agent is not able to observe active attributes.
I think that this problem is related to https://github.com/telefonicaid/lwm2m-node-lib/issues/110 and https://github.com/telefonicaid/lwm2m-node-lib/pull/111.
@fgalan Can you tell us something about this issue? Are you guys supporting https://github.com/telefonicaid/lwm2m-node-lib? @FRDavid @jgato
Not at the present moment... but of course we will be more than happy to review any PR fixing this issue :)
If I am not wrong, there is an open PR to solve https://github.com/telefonicaid/lwm2m-node-lib/issues/110: https://github.com/telefonicaid/lwm2m-node-lib/pull/111
Thanks for pointing it out! I didn't remember that PR (maybe because if was casted before I start looking to IOTAs stuff :)
So you mean that PR telefonicaid/lwm2m-node-lib#111 solves both issues telefonicaid/lwm2m-node-lib#110 and the present one (#112) isn't it?
(Btw, I have provided feedback on PR telefonicaid/lwm2m-node-lib#111 . As soon as the comment put there gets addressed -very minor- it will be merged)
@dcalvoalonso now that PR https://github.com/telefonicaid/lwm2m-node-lib/pull/111 has been merged (and consecuently https://github.com/telefonicaid/lwm2m-node-lib/issues/110 has been closed), should the present issue be closed?
Thanks @fgalan. I will do some tests and let you know if it is working now.
What is the status of this? I tried but still CB does not read the active attributes sent by the client (device).
@letavia could you provide more detail on the test you are doing so that information can be used to reproduce and debug the issue, please?
I followed the instructions for device provisioning.
Here is my device configuration:
fiware-service: factory
fiware-servicepath: /robots
payload:
{
"devices": [
{
"device_id": "robot1",
"entity_type": "Robot",
"entity_name": "robot01",
"attributes": [
{
"name": "Battery",
"type": "number"
}
],
"lazy": [
{
"name": "Message",
"type": "string"
}
],
"commands": [
{
"name": "Position",
"type": "location"
}
],
"internal_attributes": {
"lwm2mResourceMapping": {
"Battery" : {
"objectType": 7392,
"objectInstance": 0,
"objectResource": 1
},
"Message" : {
"objectType": 7392,
"objectInstance": 0,
"objectResource": 2
},
"Position" : {
"objectType": 7392,
"objectInstance": 0,
"objectResource": 3
}
}
}
}
]
}
Then I ran iotagent-lwm2m-client.js with all the suggested commands.
I checked the result in context broker:
http://orion:1026/v2/entities/robot01
{
"id": "robot01",
"type": "Robot",
"Battery": {
"type": "number",
"value": " ",
"metadata": {}
},
"Position_info": {
"type": "commandResult",
"value": " ",
"metadata": {}
},
"Position_status": {
"type": "commandStatus",
"value": "UNKNOWN",
"metadata": {}
},
"TimeInstant": {
"type": "DateTime",
"value": "2019-04-24T01:48:14.00Z",
"metadata": {}
},
"Message": {
"type": "string",
"value": "First robot here",
"metadata": {}
},
"Position": {
"type": "string",
"value": "[0, 0]",
"metadata": {}
}
}
The value for Battery attribute was not updated.
LWM2M Client also showed only lazy and command attributes were read.
LWM2M-Client>
Value read:
--------------------------------
-> ObjectType: 7392
-> ObjectId: 0
-> ResourceId: 2
-> Read Value: First robot here
LWM2M-Client>
Value read:
--------------------------------
-> ObjectType: 7392
-> ObjectId: 0
-> ResourceId: 3
-> Read Value: [0, 0]
Whereas the "attributes" is correctly mapped to "active" in IoT Agent database:
{ "_id" : ObjectId("5cbfc05f1c422f001159da73"), "lazy" : [ { "name" : "Message", "type" : "string", "object_id" : "Message" } ], "active" : [ { "name" : "Battery", "type" : "number", "object_id" : "Battery" } ], "commands" : [ { "name" : "Position", "type" : "location", "object_id" : "Position" } ], "subscriptions" : [ ], "creationDate" : ISODate("2019-04-24T01:48:15.351Z"), "id" : "robot1", "type" : "Robot", "name" : "robot01", "service" : "factory", "subservice" : "/robots", "registrationId" : "5cbfc05e75c52beb3d046835", "internalId" : null, "internalAttributes" : { "lwm2mResourceMapping" : { "Battery" : { "objectType" : 7392, "objectInstance" : 0, "objectResource" : 1 }, "Message" : { "objectType" : 7392, "objectInstance" : 0, "objectResource" : 2 }, "Position" : { "objectType" : 7392, "objectInstance" : 0, "objectResource" : 3 } } }, "__v" : 0 }
Let me know if you need more info.
any advice on this issue?