I'm trying to run a HTTP GET and return a parsed JSON object in the function, to use some the data generated in and in the output of the function.
Let me explain - I have a water flow meter attached to our Rachio irrigation system. Right now I read the pulses and post to a graph every few seconds, with a generic topic of "garden". What I want to do is, when watering occurs, the first time the value exceeds zero, I need to fire the http request at the Rachio API to retrieve the Zone being watered. I then want to use the Zone from the API as the Topic being posted with the value to the graph. For every subsequent value over zero, I will use the Zone number already retrieved.
So I feel that I can handle everything pretty well within the Function - or is there a better way ?
The other way round.
set msg.measure
to msg.payload
Then in your function node the measurement will be available in msg.measure.
Presuming the measurement is in msg.payload.