How to apply if else condition?


Hi,
I am trying to design a smart irrigation app in my academic project. In this image, I got the Average value of all sensor input but now I need to add some condition like if average < 35000 then it will generate an email notification. so I have no idea how to implement the condition. So, please help me out...

A switch allows you to do an "if" operation so instead of using JS in a function, you could add a switch node BEFORE and use the < less than compare option.

NOTE: By the looks of it, you could benefit from spendin an hour watching this playlist: Node-RED Essentials. It is by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about an hour. A small investment for a lot of gain.

Thank you buddy
I have tried this and put switch but it is not working so am I doing something wrong in switch..? please check it..

Is the value in msg.payload or msg.payload.avg? also are you testing a number or string?