here comes another easy challenge for the Node-Red pros among you Following situation: Based on a certain trigger, I would like to send a message payload to an Alexa node that contains data from some flow variables I defined.
Here is my example for the msg.payload I would like to create from a change node using the JSONata editor:
"Outside temperature is about "& flow.get("OutsideTemp") &" degrees at "& flow.get("Humidity") &" % humidity"
Unfortunately, the variables get simply ignored when creating the actual object. Now tell me what´s the trick to integrate flow variables into messages
I will do this myself in a function node.
In a function node you concatenate strings with a + instead &.
msg.payload= "Outside temperature is about "+ flow.get("OutsideTemp") +" degrees at "+ flow.get("Humidity") +" % humidity"
In JSONata expression it would be
$flowContext("OutsideTemp") not flow.get
Beautiful Thanks both @edje11 & @E1cid for the quick response!
Here's a picture of my flow to get a report on my Raspberry Pi.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.