I'm trying to populate a bunch of Homeseer devices with current weather and forecast data using node red open weather map. I managed to get current temp working using a function but I keep reading that I should be able to do this with a change node. essentially openweathermap returns an object with a bunch of data in it so I grab the current temp with var t and wipe out all the other data and generate just what I want to control the device in homeseer.
I really don't understand how the change node works. I've watched some tutorials but for some reason I just don't get it.
Is it possible to do this with a change node instead?
The function I wrote is:
I really don't understand how the change node works. I've watched some tutorials but for some reason I just don't get it.
Is it possible to do this with a change node instead?
The function I wrote is:
Code:
var t = msg.payload.current.temp msg.payload = {}; msg.topic = "update" msg.payload.status = t msg.payload.value = parseInt(t) //msg.payload.value = t return msg;
Comment