lightweightm2m-iotagent icon indicating copy to clipboard operation
lightweightm2m-iotagent copied to clipboard

Active attributes are not correctly observed

Open dcalvoalonso opened this issue 7 years ago • 11 comments

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.

dcalvoalonso avatar Jan 17 '18 11:01 dcalvoalonso

@fgalan Can you tell us something about this issue? Are you guys supporting https://github.com/telefonicaid/lwm2m-node-lib? @FRDavid @jgato

dcalvoalonso avatar Feb 21 '18 07:02 dcalvoalonso

Not at the present moment... but of course we will be more than happy to review any PR fixing this issue :)

fgalan avatar Feb 22 '18 12:02 fgalan

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

dcalvoalonso avatar Feb 22 '18 14:02 dcalvoalonso

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?

fgalan avatar Feb 22 '18 16:02 fgalan

(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)

fgalan avatar Feb 22 '18 16:02 fgalan

@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?

fgalan avatar Feb 23 '18 15:02 fgalan

Thanks @fgalan. I will do some tests and let you know if it is working now.

dcalvoalonso avatar Feb 24 '18 14:02 dcalvoalonso

What is the status of this? I tried but still CB does not read the active attributes sent by the client (device).

letavia avatar Apr 24 '19 12:04 letavia

@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?

fgalan avatar Apr 24 '19 14:04 fgalan

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.

letavia avatar Apr 25 '19 15:04 letavia

any advice on this issue?

letavia avatar May 06 '19 12:05 letavia