Hi,
I'd like to publish several JSON object values from my weather station via MQTT. I am using a http request node to get the JSON object. First I started off using a change node to extract only one value but now I've decided it could be useful in the future to publish all of them. Is there a better approach than using a function node to loop through the array of objects, outputting to a mqtt output node for each value?
Here's my array of objects, just the 2 so far.
[{"macAddress":"XX:XX:XX:XX:XX:XX","lastData":{"dateutc":1563819660000,"winddir":206,"windspeedmph":0.45,"windgustmph":1.12,"maxdailygust":9.17,"tempf":81.3,"battout":1,"humidity":43,"hourlyrainin":0,"eventrainin":0,"dailyrainin":0,"weeklyrainin":0,"monthlyrainin":0.12,"yearlyrainin":0.12,"totalrainin":0.12,"tempinf":73,"battin":1,"humidityin":52,"baromrelin":29.37,"baromabsin":29.31,"uv":7,"solarradiation":750.41,"temp1f":69.26,"humidity1":58,"batt1":1,"feelsLike":81.2,"dewPoint":56.64,"lastRain":"2019-07-17T20:16:00.000Z","tz":"America/Chicago","date":"2019-07-22T18:21:00.000Z"},"info":{"name":"Name1","location":""}},{"macAddress":"XX:XX:XX:XX:XX:XX","lastData":{"dateutc":1563819660000,"winddir":266,"windspeedmph":3.36,"windgustmph":4.47,"maxdailygust":10.29,"tempf":77.5,"battout":1,"humidity":47,"hourlyrainin":0,"eventrainin":0,"dailyrainin":0,"weeklyrainin":0,"monthlyrainin":0.02,"yearlyrainin":0.02,"totalrainin":0.02,"uv":7,"solarradiation":789.92,"feelsLike":77.16,"dewPoint":55.66,"lastRain":"2019-07-19T01:07:00.000Z","tz":"America/Chicago","date":"2019-07-22T18:21:00.000Z"},"info":{"location":"","name":"Name2"}}]