my flow get data from a json file. Then the function node will return a number that is corresponding to the img in switch node. For example, if the icon is rain, than return msg.payload =1 , then in the switch node if msg.payload =1 then should switch it to the rain icon. But instead what i get is all of the icon come out at once. My function node is working as I check the debug node, it is returning the correct value.





Function node
if (msg.payload.current_observation.icon === "rain") {
var test = 1 ;
msg.payload = test;
return msg;
}
else if (msg.payload.current_observation.icon === "clear") {
var test = 2 ;
msg.payload = test;
return msg;
}
else if (msg.payload.current_observation.icon === "cloudy") {
var test = 3 ;
msg.payload = test;
return msg;
}