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

send resource value from msg.payload #9

Closed
djDuff opened this issue Jun 18, 2019 · 5 comments
Closed

send resource value from msg.payload #9

djDuff opened this issue Jun 18, 2019 · 5 comments

Comments

@djDuff
Copy link

djDuff commented Jun 18, 2019

@dbaba Daisuke Baba san,
I have found one more issue.

I want msg.payload to be send as resource value using lwm2m client node.

I added simple Inject node,
topic: /3303/0/5700,
payload: 20 (data type: number),
and wired it with ClientOut node.
ClientOut node successfully register on lwm2m server with this Objects defined in config node:
As you see, "value": "" is empty, so it should gather the value from msg.payload.
At least, it was working like this on my setup with 1.x version of your node.
Now, 0 is sent in this case.

{
    "3303": {
        "1": {
            "5700": {
                "type": "FLOAT",
                "acl": "R",
                "value": ""
            }
        }
    }
}

If I change the "value" to exact value, for example:
value": "100",
100 will be sent to lwm2m server.

Kindly ask you to have a look at this issue, please.
Let me know if anything additional is needed.

My current config:

npm -v
6.4.1

node -v
v8.15.1

Node-red 
v0.20.2

node-red-contrib-lwm2m 
2.0.2
@dbaba
Copy link
Contributor

dbaba commented Jun 20, 2019

Indeed, numeric types have now default 0. I thought numeric values didn't have NULL (empty byte array) but it seems to be my misunderstanding as OMA Spec doesn't mention it (probably because the empty string/null value handling is out of LwM2M spec scope and is implementation dependent). Will revert the default behaviors.
I also introduced a new setting to change its behavior. The current behavior will be optional and can be enabled if necessary.

@dbaba dbaba closed this as completed in 7523619 Jun 20, 2019
@djDuff
Copy link
Author

djDuff commented Jun 20, 2019

@dbaba I have upgraded to 2.1.0 - It is still not working for me.
I tried with both "Subscribe LwM2M object events" enabled and disabled (if it is correct option)
Debug of output:
{ "payload": [{ "uri": "/3303/0/5700", "value": { "type": "FLOAT", "acl": "R", "value": "" } }], "_msgid": "a72e7476.23f9c8" }

My guess would be I use double quotes "value": "", not single quotes for empty value in Config node - Objects.. Maybe that's the case?
Posting current Objects config - just in case:
{ "3303": { "0": { "5700": { "type": "FLOAT", "acl": "R", "value": "" } }, "1": { "5700": { "type": "FLOAT", "acl": "R", "value": "" }, "5701": { "type": "STRING", "acl": "R", "value": "" } }, "2": { "5700": { "type": "FLOAT", "acl": "R", "value": "" } }, "3": { "5700": { "type": "FLOAT", "acl": "R", "value": "" } } } }

@dbaba
Copy link
Contributor

dbaba commented Jun 20, 2019

I misunderstood your question. I though this was just a default value issue but you're talking about writing object resource, aren't you?
If so, could you please post your flow JSON? Let me test it.

@dbaba dbaba reopened this Jun 20, 2019
@djDuff
Copy link
Author

djDuff commented Jun 20, 2019

@dbaba Baba san, excuse me, it was misconfiguration in my Node-Red.
Yes, this issue is fixed: msg.payload from inject node is sent correctly as "value".
Thank you so much!

@dbaba
Copy link
Contributor

dbaba commented Jun 20, 2019

@djDuff Got it, thanks.

@dbaba dbaba closed this as completed Jun 20, 2019
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

2 participants