Integer from a payload with the function node

NR receives a payload from a Seeed node that contains the light intensity in lux (image). The path of the decoded luminosity payload is:


With a function node I only want to use an integer with the de lux value (as in example 4099) and I can't do that. The code below generates an error and as a beginner I wouldn't know how else to do it. Can someone help me with this?

var newMsg = { payload: payload.uplink_message.decoded_payload.messages[0].measurementValue };
return newMsg


Just to the right of that 4099 value if you move the mouse there, a couple of icons appear.

One will look like >_
That copies the PATH.

Click on it then paste the value here.

Poor example of where this is.

Screenshot from 2023-02-24 19-26-17

Thanks for helping. The path is:


In the function node:

let x = msg.payload.uplink_message.decoded_payload.messages[0].measurementValue;
msg.payload = x;
return msg;

I think that should work.

IF you don't want anything else from the message.

1 Like

You solved my problem, thank you very much!

Glad I could help.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.