Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Execute resource without provide value #82

Open
FRDavid opened this issue Nov 18, 2016 · 0 comments
Open

Execute resource without provide value #82

FRDavid opened this issue Nov 18, 2016 · 0 comments

Comments

@FRDavid
Copy link

FRDavid commented Nov 18, 2016

Hello,

We didn't find a way to execute a resource without provide an attribute value. Maybe someone knows how to carry out this?

We used a query such as the next one:

(curl http://127.0.0.1:1026/v1/updateContext -s -S --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'fiware-service: HOPBeacon' --header 'fiware-servicepath: /hopbeacon' \
 -d @- | python -mjson.tool) <<EOF
{
    "contextElements": [
        {
            "type": "HOPBeacon",
            "isPattern": "false",
            "id": "HOPe0e5cfb1f4df",
            "attributes": [
            {
                "name": "Temperature Reset Min and Max Measured Values",
                "type": "String",
                "value": ""
            }
            ]
        }
    ],
    "updateAction": "UPDATE"
}
EOF

When value field is empty or value field is not present, the next error is raised in the Lightweight-IOTAgent:

time=2016-11-16T17:53:00.330Z | lvl=DEBUG | corr=n/a | trans=n/a | op=LWM2MLib.DeviceManagement | msg=Writting a new value [function (err, v) {
                results[index] = v;
                callback(err);
            }] on resource /3303/0/5605 in device [1]
time=2016-11-16T17:55:25.859Z | lvl=FATAL | corr=n/a | trans=n/a | op=n/a | msg=An unexpected exception has been raised. Ignoring: TypeError: Invalid non-string/buffer chunk

And the query receives the next response:

{
    "errorCode": {
        "code": "404", 
        "details": "error forwarding update", 
        "reasonPhrase": "No context element found"
    }
}

This is what happen in our devices in case of specify a dummy value:

execute2

And the query receives the next response:

{
    "errorCode": {
        "code": "404", 
        "reasonPhrase": "No context element found"
    }
}

Not all the available LwM2M Clients are able to manage this extra value.

If there is no way to send an execute command without value, send a dummy value isn't a correct behaviour to execute some resources in LwM2M, most of the executable resources does not receive value, some example of executable resources without value are:

  • Reset device (3/0/4)
  • Factory reset (3/0/5)
  • Registration Update Trigger (1/0/8)
  • Reset Min/Max values for some sensor (some IPSO objects)
  • ...

We expect to hear about other way to carry out this, but in the meantime we introduced a condition to allow execute commands without specify a value.

execute1

and the query result is ok:

{
    "contextResponses": [
        {
            "contextElement": {
                "attributes": [
                    {
                        "name": "Temperature Reset Min and Max Measured Values", 
                        "type": "String", 
                        "value": ""
                    }
                ], 
                "id": "HOPe0e5cfb1f4df", 
                "isPattern": "false", 
                "type": "HOPBeacon"
            }, 
            "statusCode": {
                "code": "200", 
                "reasonPhrase": "OK"
            }
        }
    ]
}

Tests are passed correctly.

BR,
David

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant