CANDY-LINE / node-red-contrib-lwm2m

Step-by-step tutorial is available at
http://candy-line.tumblr.com/post/166976363228/oma-lwm2m-node-red-node
Apache License 2.0
7 stars 3 forks source link

send resource value from msg.payload #9

Closed djDuff closed 5 years ago

djDuff commented 5 years ago

@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 commented 5 years ago

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.

djDuff commented 5 years ago

@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 commented 5 years ago

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.

djDuff commented 5 years ago

@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 commented 5 years ago

@djDuff Got it, thanks.