Using msg.payload.something as a parametre in the exec node

Lets just say that I have 3 values joined together with topic and the join node. I want to use all 3 of them as parametres in the exec node. How would i do that? (i already did try putting {{{payload.something}}})

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.

BX00Cy7yHi

Thank you for your fast response. But I think the path is correct. For more info: I am trying to send data to PVOutput using curL(this is my command: curl -d "d={{payload.date}}}" -d "t={{payload.time}}" -d "v2={{payload.power}}" -d "v4={{payload.usedpower}}" -d "v6= {{payload.battv}}" -H "X-Pvoutput-Apikey: -api-key-" -H "X-Pvoutput-SystemId: -system id-" https://pvoutput.org/service/r2/addstatus.jsp)
This is debug:


Basically instead of sending the value, it sends the path to the message. What am i doing wrong?
(also the top message in debug is before the exec node)

Why are you shelling out to curl? There is a built in node (http request) that avoids having to spawn command.

I know about that, but for no apparent reason that doesnt work. I got it to work when i set the values manually but i cant get it work this way. Do you have any idea why could that be? Thanks

I agree that you would be probably be better to use the http request node, but to understand why what you have done does not work, if you have put that string in the exec node then the reason is that the exec node does not do expansion using that syntax. To do it, a good way is to use a Template node to build the complete command and pass that to the exec node.

2 Likes

Thanks! It works now.

Now you should work on making the not apparent become apparent.

2 Likes

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