Hello, can me someone explain me how i can extract the value temperature from the following payload?
I tried with a change node but it doesnt work. I can extract the value from the array meters, but not the temperature value. Can someone give me a example for a syntax please?
As you have not used the copy value button in the debug side panel, the object you have shown is confusing.
I believe the correct path is msg.temperature.
If you use the debug panel and hover to side of object name 2 icons appear, one is copy value, the other copy path. Both very helpful.
The copy value icon/button would give you a correctly formated object, and it would be easier to see the correct object structure.
hover mouse near where is says copy value and the copy value and path buttons will appear, use the path button to get the path to the adjacent property value.
And here is an example of moving the temperature value to msg.payload, using a change node.
There’s a great page in the docs (Working with messages : Node-RED) that will explain how to use the debug panel to find the right path to any data item.
Pay particular attention to the part about the buttons that appear under your mouse pointer when you over hover a debug message property in the sidebar.
You will always get the msg object. But you have moved the temp value now to msg.payload.
if you moved msg.status.temperature to msg, node-red would produce an error, as msg has to be returned as an object.
Your debug is set to see the complete object, not just msg.payload.
We can not give a solution as nothing is wrong, You are not understanding message objects and there construction correctly.
As said before, the change node is working properly , moving the temperature in the payload property of the message but not creating a new message that would contain only the temperature….
The tricky thing is that you did not noticed that debug node was configure to display the complete message…